Skip to content

Conversation

@Tharsanan1
Copy link
Contributor

@Tharsanan1 Tharsanan1 commented Jan 5, 2026

Purpose

$subject

Summary by CodeRabbit

  • Tests

    • Added a CI test step that simulates a gateway Helm upgrade, verifies detection of the upgrade, and confirms successful rollouts across gateway deployments and health checks.
  • Improvements

    • Operator now respects retry backoff windows to avoid repeated rapid reconciliation attempts, improving stability during transient failures.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 5, 2026

Walkthrough

Adds a GitHub Actions step that triggers and verifies a Gateway Helm upgrade via a ConfigMap values.yaml annotation change, and introduces backoff handling in the RestApiReconciler to delay processing when NextRetryTime is in the future.

Changes

Cohort / File(s) Summary
GitHub Actions Workflow
.github/workflows/operator-integration-test.yml
Added "Test Gateway Helm Upgrade" step: updates test gateway ConfigMap values.yaml annotations to force a Helm upgrade, applies the change, waits for operator detection via deployment annotations, waits for gateway deployments to roll out, and performs a controller health check.
Controller backoff logic
kubernetes/gateway-operator/internal/controller/restapi_controller.go
Adds backoff handling in RestApiReconciler.processDeployment: when a tracking entry matches the generation and NextRetryTime is in the future, the reconciler logs and returns a RequeueAfter to delay processing until backoff expires.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant GH as GitHub Actions
  participant CLI as kubectl/helm
  participant K8s as Kubernetes API
  participant Operator as Gateway Operator
  participant Gateway as Gateway Deployments

  note right of GH: "Test Gateway Helm Upgrade" step
  GH->>CLI: modify test-gateway `values.yaml` annotations\nkubectl apply -f ...
  CLI->>K8s: apply ConfigMap
  K8s->>Operator: ConfigMap annotation change event
  Operator->>Operator: detect annotation -> trigger Helm upgrade
  Operator->>K8s: update/upgrade Gateway deployments
  K8s->>Gateway: rollout updated deployments
  Gateway->>Operator: update deployment annotations/status
  Operator->>GH: deployment annotations show upgrade detected
  GH->>CLI: wait for rollouts, port-forward controller, curl /health
  CLI->>GH: return health status (pass/fail)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I poked a values.yaml with glee,

An annotation hop, a Helm melody.
Deployments rolled, the operator knew,
I waited politely — backoffs too.
🥕🎩

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete, containing only a Purpose section header with a placeholder variable and no actual content or details about the changes. Complete the description by filling in the Purpose section with actual details and include other relevant sections such as Goals, Approach, Automation tests (test details and coverage), and Documentation.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'test: add Helm upgrade verification for Gateway' directly matches the main changeset, which adds a test step for Helm upgrade verification.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Tharsanan1 Tharsanan1 marked this pull request as ready for review January 5, 2026 08:31
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
.github/workflows/operator-integration-test.yml (2)

1103-1103: Consider a more targeted annotation update.

The sed command with the /g flag replaces ALL occurrences of annotations: {} throughout the values.yaml file, affecting ConfigMap annotations (line 590), service annotations (lines 602, 732, 789), and deployment annotations (lines 689, 746, 801). While this works for the test, a more surgical approach would modify only the specific field needed to trigger the Helm upgrade.

🔎 More targeted approaches

Option 1: Target specific line with sed addressing

-sed -i 's/annotations: {}/annotations: {helm-upgrade-test: "true"}/g' values.yaml
+# Only replace annotations under gateway.router.deployment (around line 746 in the original)
+sed -i '/gateway:/{:a;N;/deployment:/!ba;s/annotations: {}/annotations: {helm-upgrade-test: "true"}/}' values.yaml

Option 2: Use yq for structured YAML manipulation (more robust)

-sed -i 's/annotations: {}/annotations: {helm-upgrade-test: "true"}/g' values.yaml
+# Install yq if not available and use it for precise YAML path modification
+yq eval '.gateway.router.deployment.annotations.helm-upgrade-test = "true"' -i values.yaml

1105-1109: Add verification that the ConfigMap update succeeded.

The test applies the ConfigMap update but doesn't verify it succeeded before waiting for the operator to detect changes. Adding a verification step improves test reliability and makes failures easier to diagnose.

🔎 Suggested verification step
 kubectl create configmap test-gateway-config --from-file=values.yaml=values.yaml --dry-run=client -o yaml | kubectl apply -f -
 
+# Verify ConfigMap was updated with the new annotation
+kubectl get configmap test-gateway-config -o jsonpath='{.data.values\.yaml}' | grep -q 'helm-upgrade-test: "true"' || {
+  echo "ERROR: ConfigMap update failed - annotation not found"
+  exit 1
+}
+
 echo "Waiting for deployment update..."
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a5dbad4 and 804e621.

📒 Files selected for processing (1)
  • .github/workflows/operator-integration-test.yml

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
kubernetes/gateway-operator/internal/controller/restapi_controller.go (1)

299-309: Consider adding unit tests for time-based backoff logic.

Time-based logic is error-prone and should be covered by unit tests to verify:

  • Behavior when NextRetryTime is zero (unset)
  • Behavior when NextRetryTime is in the past
  • Behavior when NextRetryTime is in the future
  • Correct calculation of RequeueAfter duration
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 81a1bd1 and 065fea9.

📒 Files selected for processing (2)
  • .github/workflows/operator-integration-test.yml
  • kubernetes/gateway-operator/internal/controller/restapi_controller.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/operator-integration-test.yml
🔇 Additional comments (2)
kubernetes/gateway-operator/internal/controller/restapi_controller.go (2)

299-309: Excellent defensive guard for backoff enforcement.

This check prevents early retry attempts when reconciliation is triggered by other events (e.g., Gateway status changes) before the backoff period expires. The logic correctly handles zero (unset) and past times, ensuring backoff is respected across reconciliation triggers.


299-309: The original review comment is based on an incorrect assumption. The actual commit title is "fix: enhance Helm upgrade verification and add health check for Gateway Controller," not "test: add Helm upgrade verification for Gateway." The "fix:" prefix is correct for production code changes, and the workflow file .github/workflows/operator-integration-test.yml exists in the repository. No action is required.

Likely an incorrect or invalid review comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant