Skip to content

OCPBUGS-81751: Fix GatewayClass update conflict in markTestDone#30964

Merged
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
gcs278:fix-ensure-gc-sail-finalizer-flake
Apr 7, 2026
Merged

OCPBUGS-81751: Fix GatewayClass update conflict in markTestDone#30964
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
gcs278:fix-ensure-gc-sail-finalizer-flake

Conversation

@gcs278
Copy link
Copy Markdown
Contributor

@gcs278 gcs278 commented Apr 6, 2026

Description

Fix flake in Gateway API tests caused by concurrent updates to GatewayClass.

Problem

The markTestDone() function was experiencing 409 Conflict errors when trying to update GatewayClass annotations:

Operation cannot be fulfilled on gatewayclasses.gateway.networking.k8s.io 
"openshift-default": the object has been modified; please apply your 
changes to the latest version and try again

This happens because the Cluster Ingress Operator (CIO) actively manages the GatewayClass resource, updating conditions (Accepted, ControllerInstalled, CRDsReady), status, and finalizers. When the test reads the GatewayClass and then tries to update it, the resourceVersion can be stale.

Solution

Wrapped the Get-Modify-Update logic in retry.RetryOnConflict() which:

  • Automatically re-fetches the latest GatewayClass on conflict
  • Retries up to 5 times with exponential backoff
  • Only fails if genuinely unable to update after retries

Testing

  • ✅ Code compiles successfully
  • Will monitor CI for reduced flakes in Gateway API tests

Changes

  • Add k8s.io/client-go/util/retry import
  • Update markTestDone() to use RetryOnConflict

/assign @gcs278

@openshift-ci-robot
Copy link
Copy Markdown

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 openshift-ci Bot requested review from candita and rfredette April 6, 2026 19:11
@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 6, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 6, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0cd65ebd-ac96-4a3c-9374-33f111d76435

📥 Commits

Reviewing files that changed from the base of the PR and between c05ea8a and 8e4e43a.

📒 Files selected for processing (1)
  • test/extended/router/gatewayapicontroller.go
✅ Files skipped from review due to trivial changes (1)
  • test/extended/router/gatewayapicontroller.go

Walkthrough

markTestDone in the test file was changed to perform the GatewayClass Get → annotate → Update sequence inside retry.RetryOnConflict(retry.DefaultRetry, ...), returning any Get/Update errors from the retry closure and preserving the final assertion.

Changes

Cohort / File(s) Summary
Test Retry Logic
test/extended/router/gatewayapicontroller.go
Moved GatewayClass GET/annotation/UPDATE sequence into retry.RetryOnConflict(retry.DefaultRetry, ...); retry closure returns Get/Update errors so annotation update is re-attempted on conflicts; final error assertion remains.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

✨ 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-robot
Copy link
Copy Markdown

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

Add retry logic to markTestDone to handle optimistic locking conflicts
when updating GatewayClass annotations. The CIO actively manages the
GatewayClass (updating conditions, status, finalizers) which can cause
409 Conflict errors when tests try to update annotations.

Using RetryOnConflict ensures the test automatically retries with the
latest resourceVersion when concurrent updates occur.

Fixes flake:
  Operation cannot be fulfilled on gatewayclasses.gateway.networking.k8s.io
  "openshift-default": the object has been modified; please apply your
  changes to the latest version and try again

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

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gcs278 gcs278 force-pushed the fix-ensure-gc-sail-finalizer-flake branch from c05ea8a to 8e4e43a Compare April 6, 2026 19:45
@gcs278 gcs278 changed the title Fix GatewayClass update conflict in markTestDone OCPBUGS-81751: Fix GatewayClass update conflict in markTestDone Apr 6, 2026
@openshift-ci-robot openshift-ci-robot added jira/severity-low Referenced Jira bug's severity is low for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. labels Apr 6, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@gcs278: This pull request references Jira Issue OCPBUGS-81751, 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 (4.22.0) matches configured target version for branch (4.22.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @lihongan

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

Details

In response to this:

Description

Fix flake in Gateway API tests caused by concurrent updates to GatewayClass.

Problem

The markTestDone() function was experiencing 409 Conflict errors when trying to update GatewayClass annotations:

Operation cannot be fulfilled on gatewayclasses.gateway.networking.k8s.io 
"openshift-default": the object has been modified; please apply your 
changes to the latest version and try again

This happens because the Cluster Ingress Operator (CIO) actively manages the GatewayClass resource, updating conditions (Accepted, ControllerInstalled, CRDsReady), status, and finalizers. When the test reads the GatewayClass and then tries to update it, the resourceVersion can be stale.

Solution

Wrapped the Get-Modify-Update logic in retry.RetryOnConflict() which:

  • Automatically re-fetches the latest GatewayClass on conflict
  • Retries up to 5 times with exponential backoff
  • Only fails if genuinely unable to update after retries

Testing

  • ✅ Code compiles successfully
  • Will monitor CI for reduced flakes in Gateway API tests

Changes

  • Add k8s.io/client-go/util/retry import
  • Update markTestDone() to use RetryOnConflict

/assign @gcs278

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 added the jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. label Apr 6, 2026
@openshift-ci openshift-ci Bot requested a review from lihongan April 6, 2026 19:47
@openshift-ci-robot
Copy link
Copy Markdown

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

@lihongan
Copy link
Copy Markdown

lihongan commented Apr 7, 2026

/jira refresh

@openshift-ci-robot
Copy link
Copy Markdown

@lihongan: This pull request references Jira Issue OCPBUGS-81751, which is valid.

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

No GitHub users were found matching the public email listed for the QA contact in Jira (iamin@redhat.com), skipping review request.

Details

In response to this:

/jira refresh

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.

@lihongan
Copy link
Copy Markdown

lihongan commented Apr 7, 2026

/retest

cc @rhamini3

@lihongan
Copy link
Copy Markdown

lihongan commented Apr 7, 2026

/payload-aggregate periodic-ci-openshift-release-main-nightly-4.22-e2e-vsphere-ovn-techpreview 10

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 7, 2026

@lihongan: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-nightly-4.22-e2e-vsphere-ovn-techpreview

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/7a4afee0-324a-11f1-83b8-fe371b409589-0

@lihongan
Copy link
Copy Markdown

lihongan commented Apr 7, 2026

/retest-required

@JoelSpeed
Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Apr 7, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 7, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gcs278, JoelSpeed

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-trt
Copy link
Copy Markdown

openshift-trt Bot commented Apr 7, 2026

Job Failure Risk Analysis for sha: 8e4e43a

Job Name Failure Risk
pull-ci-openshift-origin-main-e2e-metal-ipi-ovn-ipv6 Low
[Jira:Node][sig-node] Node non-cnv swap configuration should reject user override of swap settings via KubeletConfig API [OCP-86395] [Suite:openshift/conformance/parallel]
This test has passed 40.75% of 292 runs on release 5.0 [Overall] in the last week.

@lihongan
Copy link
Copy Markdown

lihongan commented Apr 7, 2026

/verified by CI

some jobs failed install in payload aggregate but no failing gateway tests

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Apr 7, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@lihongan: This PR has been marked as verified by CI.

Details

In response to this:

/verified by CI

some jobs failed install in payload aggregate but no failing gateway tests

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
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 7, 2026

@gcs278: all tests passed!

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.

@openshift-merge-bot openshift-merge-bot Bot merged commit c2c4593 into openshift:main Apr 7, 2026
21 checks passed
@openshift-ci-robot
Copy link
Copy Markdown

@gcs278: Jira Issue Verification Checks: Jira Issue OCPBUGS-81751
✔️ This pull request was pre-merge verified.
✔️ All associated pull requests have merged.
✔️ All associated, merged pull requests were pre-merge verified.

Jira Issue OCPBUGS-81751 has been moved to the MODIFIED state and will move to the VERIFIED state when the change is available in an accepted nightly payload. 🕓

Details

In response to this:

Description

Fix flake in Gateway API tests caused by concurrent updates to GatewayClass.

Problem

The markTestDone() function was experiencing 409 Conflict errors when trying to update GatewayClass annotations:

Operation cannot be fulfilled on gatewayclasses.gateway.networking.k8s.io 
"openshift-default": the object has been modified; please apply your 
changes to the latest version and try again

This happens because the Cluster Ingress Operator (CIO) actively manages the GatewayClass resource, updating conditions (Accepted, ControllerInstalled, CRDsReady), status, and finalizers. When the test reads the GatewayClass and then tries to update it, the resourceVersion can be stale.

Solution

Wrapped the Get-Modify-Update logic in retry.RetryOnConflict() which:

  • Automatically re-fetches the latest GatewayClass on conflict
  • Retries up to 5 times with exponential backoff
  • Only fails if genuinely unable to update after retries

Testing

  • ✅ Code compiles successfully
  • Will monitor CI for reduced flakes in Gateway API tests

Changes

  • Add k8s.io/client-go/util/retry import
  • Update markTestDone() to use RetryOnConflict

/assign @gcs278

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-merge-robot
Copy link
Copy Markdown
Contributor

Fix included in release 4.22.0-0.nightly-2026-04-08-213621

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. jira/severity-low Referenced Jira bug's severity is low for the branch this PR is targeting. 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. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants