Skip to content

OCPBUGS-83281: Wait for Gateway deletion before removing GatewayClass in test cleanup#31010

Open
gcs278 wants to merge 1 commit intoopenshift:mainfrom
gcs278:fix-gwapi-wait-gateway-deletion
Open

OCPBUGS-83281: Wait for Gateway deletion before removing GatewayClass in test cleanup#31010
gcs278 wants to merge 1 commit intoopenshift:mainfrom
gcs278:fix-gwapi-wait-gateway-deletion

Conversation

@gcs278
Copy link
Copy Markdown
Contributor

@gcs278 gcs278 commented Apr 14, 2026

Summary

  • Gateway API test cleanup was deleting Gateways and immediately removing the GatewayClass/istiod without waiting for Gateway resources to be fully deleted
  • The gateway deployment/pods have an owner reference to the Gateway and are cascade-deleted by Kubernetes GC, but only after the Gateway is gone
  • Removing istiod before the gateway pods are cleaned up causes them to crash-loop, generating pathological "Back-off restarting failed container" events that fail CI invariant monitors
  • Add a shared waitForGatewayDeletion helper used by both the upgrade test Teardown and the controller test AfterEach to ensure proper cleanup ordering

Test plan

  • Verify upgrade test cleanup waits for Gateway deletion before removing GatewayClass
  • Verify controller test AfterEach waits for Gateway deletion before removing GatewayClass
  • Verify no "Back-off restarting failed container" pathological events for gateway pods in openshift-ingress after test cleanup
  • Run e2e-aws-ovn-upgrade-fips job to confirm the regression is resolved

Bug: https://redhat.atlassian.net/browse/OCPBUGS-83281

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Improved Gateway cleanup in test infrastructure: teardown now waits for associated gateway deployments to be removed before proceeding, making test cleanup more reliable and reducing leftover resources.

@openshift-merge-bot
Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: automatic mode

@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Apr 14, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@gcs278: This pull request references Jira Issue OCPBUGS-83281, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Summary

  • Gateway API test cleanup was deleting Gateways and immediately removing the GatewayClass/istiod without waiting for Gateway resources to be fully deleted
  • The gateway deployment/pods have an owner reference to the Gateway and are cascade-deleted by Kubernetes GC, but only after the Gateway is gone
  • Removing istiod before the gateway pods are cleaned up causes them to crash-loop, generating pathological "Back-off restarting failed container" events that fail CI invariant monitors
  • Add a shared waitForGatewayDeletion helper used by both the upgrade test Teardown and the controller test AfterEach to ensure proper cleanup ordering

Test plan

  • Verify upgrade test cleanup waits for Gateway deletion before removing GatewayClass
  • Verify controller test AfterEach waits for Gateway deletion before removing GatewayClass
  • Verify no "Back-off restarting failed container" pathological events for gateway pods in openshift-ingress after test cleanup
  • Run e2e-aws-ovn-upgrade-fips job to confirm the regression is resolved

Bug: https://redhat.atlassian.net/browse/OCPBUGS-83281

🤖 Generated with Claude Code

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ee3972d6-50d8-4bc7-a70d-d35f5ac0514d

📥 Commits

Reviewing files that changed from the base of the PR and between 4cfb628 and 29cb6d7.

📒 Files selected for processing (2)
  • test/extended/router/gatewayapi_upgrade.go
  • test/extended/router/gatewayapicontroller.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/extended/router/gatewayapi_upgrade.go

Walkthrough

Replaced inline polling that waited for Gateways to be removed with a new helper that waits for the associated Gateway deployment deletion. Added waitForGatewayDeploymentDeletion and updated test teardown/cleanup calls to use it, adjusting log messages accordingly.

Changes

Cohort / File(s) Summary
Gateway API controller helper & cleanup
test/extended/router/gatewayapicontroller.go
Added waitForGatewayDeploymentDeletion(oc *exutil.CLI, gatewayName string) which polls the computed Deployment in openshift-ingress until NotFound (5m timeout, 5s interval). Cleanup now waits for the deployment deletion after deleting each Gateway.
Gateway API upgrade test teardown
test/extended/router/gatewayapi_upgrade.go
Removed inline wait.PollUntilContextTimeout polling from Teardown; replaced with call to waitForGatewayDeploymentDeletion(t.oc, t.gatewayName) and updated Ginkgo log message to reference “gateway deployment” deletion.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 9 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (9 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a wait for Gateway deletion before removing GatewayClass in test cleanup, which matches the core purpose of the code modifications.
Stable And Deterministic Test Names ✅ Passed All Ginkgo test titles in modified files use static, descriptive strings with no dynamic information.
Test Structure And Quality ✅ Passed The waitForGatewayDeploymentDeletion helper function implements proper test structure with 5-minute timeouts, meaningful assertions, logging, and consistent Gomega patterns.
Microshift Test Compatibility ✅ Passed PR adds no new Ginkgo e2e tests, only refactors existing cleanup helper functions used in test infrastructure.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No new Ginkgo e2e test cases (It(), Describe(), Context(), When()) were added. The PR only includes a helper function and modifications to existing test cleanup logic.
Topology-Aware Scheduling Compatibility ✅ Passed PR modifies only test code files without introducing deployment manifests, operator code, or controllers that would affect scheduling topology.
Ote Binary Stdout Contract ✅ Passed All code changes are within test-level helper functions called from Ginkgo test blocks where stdout is properly intercepted. No process-level code modifications found that would violate the OTE binary stdout contract.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR adds only test cleanup helper function without new Ginkgo test definitions, so custom check does not apply.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci openshift-ci bot requested review from candita and jcmoraisjr April 14, 2026 17:40
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 14, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gcs278

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 14, 2026
@openshift-merge-bot
Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e-aws-csi
/test e2e-aws-ovn-fips
/test e2e-aws-ovn-microshift
/test e2e-aws-ovn-microshift-serial
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-gcp-csi
/test e2e-gcp-ovn
/test e2e-gcp-ovn-upgrade
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

@gcs278
Copy link
Copy Markdown
Contributor Author

gcs278 commented Apr 15, 2026

Looks like there may be a gateway hanging out that @rhamini3 pointed out.
/hold

/retest

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 15, 2026
@gcs278 gcs278 force-pushed the fix-gwapi-wait-gateway-deletion branch from 4cfb628 to 1441e6e Compare April 15, 2026 01:24
… in test cleanup

The Gateway API test cleanup was deleting Gateways and immediately
proceeding to delete the GatewayClass and istiod without waiting for
the Gateway resources to be fully removed. Since the gateway
deployment and pods have an owner reference to the Gateway, they are
cascade-deleted by Kubernetes GC only after the Gateway is gone. If
the GatewayClass and istiod are removed first, the gateway pods lose
their control plane and crash-loop, generating pathological "Back-off
restarting failed container" events that fail CI invariant monitors.

Add a shared waitForGatewayDeletion helper that both the upgrade test
Teardown and the controller test AfterEach use to ensure Gateways are
fully deleted before proceeding with GatewayClass cleanup.

https://redhat.atlassian.net/browse/OCPBUGS-83281

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@gcs278 gcs278 force-pushed the fix-gwapi-wait-gateway-deletion branch from 1441e6e to 29cb6d7 Compare April 15, 2026 01:25
@openshift-ci-robot openshift-ci-robot added the jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. label Apr 15, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@gcs278: This pull request references Jira Issue OCPBUGS-83281, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

Summary

  • Gateway API test cleanup was deleting Gateways and immediately removing the GatewayClass/istiod without waiting for Gateway resources to be fully deleted
  • The gateway deployment/pods have an owner reference to the Gateway and are cascade-deleted by Kubernetes GC, but only after the Gateway is gone
  • Removing istiod before the gateway pods are cleaned up causes them to crash-loop, generating pathological "Back-off restarting failed container" events that fail CI invariant monitors
  • Add a shared waitForGatewayDeletion helper used by both the upgrade test Teardown and the controller test AfterEach to ensure proper cleanup ordering

Test plan

  • Verify upgrade test cleanup waits for Gateway deletion before removing GatewayClass
  • Verify controller test AfterEach waits for Gateway deletion before removing GatewayClass
  • Verify no "Back-off restarting failed container" pathological events for gateway pods in openshift-ingress after test cleanup
  • Run e2e-aws-ovn-upgrade-fips job to confirm the regression is resolved

Bug: https://redhat.atlassian.net/browse/OCPBUGS-83281

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
  • Improved Gateway cleanup in test infrastructure: teardown now waits for associated gateway deployments to be removed before proceeding, making test cleanup more reliable and reducing leftover resources.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot removed the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label Apr 15, 2026
@openshift-merge-bot
Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e-aws-csi
/test e2e-aws-ovn-fips
/test e2e-aws-ovn-microshift
/test e2e-aws-ovn-microshift-serial
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-gcp-csi
/test e2e-gcp-ovn
/test e2e-gcp-ovn-upgrade
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 15, 2026

@gcs278: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-vsphere-ovn 29cb6d7 link true /test e2e-vsphere-ovn
ci/prow/e2e-vsphere-ovn-upi 29cb6d7 link true /test e2e-vsphere-ovn-upi
ci/prow/e2e-aws-ovn-fips 29cb6d7 link true /test e2e-aws-ovn-fips
ci/prow/e2e-gcp-ovn 29cb6d7 link true /test e2e-gcp-ovn
ci/prow/e2e-metal-ipi-ovn-ipv6 29cb6d7 link true /test e2e-metal-ipi-ovn-ipv6

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants