Skip to content

PROOF: certrotation refactor (structural only)#2089

Closed
sanchezl wants to merge 2 commits into
openshift:mainfrom
sanchezl:certrotation-refactor-proof-2151
Closed

PROOF: certrotation refactor (structural only)#2089
sanchezl wants to merge 2 commits into
openshift:mainfrom
sanchezl:certrotation-refactor-proof-2151

Conversation

@sanchezl

@sanchezl sanchezl commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

Summary

For the full PKI integration proof, see #2087 (vendors openshift/library-go#2152).

Test plan

  • go build ./... passes
  • e2e

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 3, 2026
@openshift-ci

openshift-ci Bot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@coderabbitai

coderabbitai Bot commented Apr 3, 2026

Copy link
Copy Markdown

Walkthrough

This PR updates Go module dependencies, refactors feature gate handling in certificate rotation controllers to pass feature gate snapshots instead of accessor objects, restructures certificate rotation controller configuration using new config types, and simplifies e2e test control flow for pod stability validation.

Changes

Cohort / File(s) Summary
Go Module Updates
go.mod
Updated github.com/openshift/api and github.com/openshift/client-go to newer pseudo-versions; added replace directive for github.com/openshift/library-go mapped to github.com/sanchezl/library-go.
Feature Gate Refactoring
pkg/cmd/certregenerationcontroller/cmd.go, pkg/operator/starter.go
Changed controller initialization to capture and pass resolved feature gate snapshots instead of accessor objects to controller constructors.
Certificate Rotation Controller Restructuring
pkg/operator/certrotationcontroller/certrotationcontroller.go
Updated NewCertRotationController and NewCertRotationControllerOnlyWhenExpired signatures to accept featuregates.FeatureGate parameter; replaced config types (RotatedSigningCASecretSigningCAConfig, CABundleConfigMapCABundleConfig, rotated cert types → TargetCertKeyPairConfig, CertCreator fields → CertConfig fields); centralized kubeClient and kubeInformersForNamespaces argument passing instead of per-rotator wiring.
End-to-End Test Updates
test/e2e/bound_sa_token.go
Removed crash-loop pod bounce helpers; refactored bound token operator secret deletion test to use API server revision stabilization checks with extended pod stability waits and higher success thresholds.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 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

openshift-ci Bot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sanchezl

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 3, 2026
@sanchezl
sanchezl force-pushed the certrotation-refactor-proof-2151 branch 2 times, most recently from 71def72 to 9c024ca Compare April 3, 2026 14:48
@sanchezl
sanchezl force-pushed the certrotation-refactor-proof-2151 branch from 9c024ca to 15520e3 Compare April 3, 2026 20:51
@sanchezl
sanchezl marked this pull request as ready for review April 7, 2026 16:15
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 7, 2026
@sanchezl

sanchezl commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

/hold for openshift/library-go#2151

@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 7, 2026
@openshift-ci
openshift-ci Bot requested review from p0lyn0mial and tkashem April 7, 2026 16:17

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@go.mod`:
- Around line 139-140: Remove the temporary replace directive that points
github.com/openshift/library-go to the personal fork (the replace line in
go.mod); update the module to reference the official upstream
(github.com/openshift/library-go) and ensure any required changes are merged
into that upstream, then run go mod tidy and re-vendor modules (e.g., go mod
vendor or your repo's vendoring step) so the repository no longer depends on
github.com/sanchezl/library-go before merging.

In `@test/e2e/bound_sa_token.go`:
- Around line 182-183: The call to
testlibraryapi.WaitForAPIServerToStabilizeOnTheSameRevision currently ignores
its error return; change the call to capture the error (e.g., err :=
testlibraryapi.WaitForAPIServerToStabilizeOnTheSameRevision(t,
kubeClient.Pods(operatorclient.TargetNamespace))) and fail the test on error
(e.g., t.Fatalf or t.Fatalff with a clear message and the error) so the test
stops if stabilization times out or fails.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 22fa1a8f-28fe-458f-809a-0e6fa936d382

📥 Commits

Reviewing files that changed from the base of the PR and between 360d3fe and 15520e3.

⛔ Files ignored due to path filters (108)
  • go.sum is excluded by !**/*.sum
  • vendor/github.com/openshift/api/.coderabbit.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/Makefile is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/types_apiserver.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/types_cluster_version.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.featuregated-crd-manifests.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.swagger_doc_generated.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1alpha1/register.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1alpha1/types_cluster_image_policy.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1alpha1/types_cluster_monitoring.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1alpha1/types_image_policy.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1alpha1/zz_generated.deepcopy.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1alpha1/zz_generated.featuregated-crd-manifests.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1alpha1/zz_generated.swagger_doc_generated.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/envtest-releases.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/features.md is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/features/features.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/features/legacyfeaturegates.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/operator/v1/types_machineconfiguration.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfigurations-Default.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfigurations-OKD.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/operator/v1/zz_generated.featuregated-crd-manifests.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1/apiserverspec.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1/prefixedclaimmapping.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1/tokenclaimmapping.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1/update.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1/usernameclaimmapping.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/additionalalertmanagerconfig.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/alertmanagercustomconfig.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/authorizationconfig.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/basicauth.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/certificateconfig.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/clusterimagepolicy.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/clusterimagepolicyspec.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/clusterimagepolicystatus.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/clustermonitoringspec.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/custompkipolicy.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/defaultcertificateconfig.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/dropequalactionconfig.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/ecdsakeyconfig.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/hashmodactionconfig.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/imagepolicyfulciocawithrekorrootoftrust.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/imagepolicypkirootoftrust.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/imagepolicypublickeyrootoftrust.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/imagepolicyspec.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/imagepolicystatus.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/imagesigstoreverificationpolicy.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/keepequalactionconfig.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/keyconfig.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/label.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/labelmapactionconfig.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/lowercaseactionconfig.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/metadataconfig.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/metadataconfigcustom.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/oauth2.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/oauth2endpointparam.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/openshiftstatemetricsconfig.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/pki.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/pkicertificatemanagement.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/pkicertificatesubject.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/pkiprofile.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/pkispec.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/policyfulciosubject.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/policyidentity.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/policymatchexactrepository.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/policymatchremapidentity.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/policyrootoftrust.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/prometheusconfig.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/prometheusremotewriteheader.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/queueconfig.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/relabelactionconfig.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/relabelconfig.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/remotewriteauthorization.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/remotewritespec.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/replaceactionconfig.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/retention.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/rsakeyconfig.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/secretkeyselector.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/sigv4.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/tlsconfig.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1/uppercaseactionconfig.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/applyconfigurations/internal/internal.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/clientset/versioned/typed/config/v1alpha1/clusterimagepolicy.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/clientset/versioned/typed/config/v1alpha1/config_client.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/clientset/versioned/typed/config/v1alpha1/generated_expansion.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/clientset/versioned/typed/config/v1alpha1/imagepolicy.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/clientset/versioned/typed/config/v1alpha1/pki.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/informers/externalversions/config/v1alpha1/clusterimagepolicy.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/informers/externalversions/config/v1alpha1/interface.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/informers/externalversions/config/v1alpha1/pki.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/informers/externalversions/generic.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/listers/config/v1alpha1/clusterimagepolicy.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/listers/config/v1alpha1/expansion_generated.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/listers/config/v1alpha1/imagepolicy.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/config/listers/config/v1alpha1/pki.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/operator/applyconfigurations/internal/internal.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/operatorcontrolplane/applyconfigurations/internal/internal.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/client-go/security/applyconfigurations/internal/internal.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/library-go/pkg/crypto/cert_config.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/library-go/pkg/crypto/keygen.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/library-go/pkg/crypto/options.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/library-go/pkg/crypto/tls_adherence.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/library-go/pkg/operator/certrotation/cabundle.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/library-go/pkg/operator/certrotation/client_cert_rotation_controller.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/library-go/pkg/operator/certrotation/signer.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/library-go/pkg/operator/certrotation/target.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/library-go/pkg/operator/v1helpers/helpers.go is excluded by !vendor/**, !**/vendor/**
  • vendor/modules.txt is excluded by !vendor/**, !**/vendor/**
📒 Files selected for processing (5)
  • go.mod
  • pkg/cmd/certregenerationcontroller/cmd.go
  • pkg/operator/certrotationcontroller/certrotationcontroller.go
  • pkg/operator/starter.go
  • test/e2e/bound_sa_token.go

Comment thread go.mod
Comment on lines +139 to +140

replace github.com/openshift/library-go => github.com/sanchezl/library-go v0.0.0-20260403202735-a957edb574ab

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if the upstream library-go PR is merged
gh pr view 2151 --repo openshift/library-go --json state,mergedAt,title

Repository: openshift/cluster-kube-apiserver-operator

Length of output: 183


🏁 Script executed:

#!/bin/bash
# First, let's verify the go.mod file and the replace directive
echo "=== Reading go.mod around lines 139-140 ==="
sed -n '130,145p' go.mod

echo ""
echo "=== All replace directives in go.mod ==="
grep -n "^replace " go.mod

Repository: openshift/cluster-kube-apiserver-operator

Length of output: 965


Remove replace directive pointing to personal fork before merging.

The replace directive for github.com/openshift/library-go points to a personal fork (github.com/sanchezl/library-go) instead of the official repository. While acceptable for a work-in-progress PR, this must be removed before the code can be merged to main. Ensure the upstream changes are merged to openshift/library-go and properly vendored.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@go.mod` around lines 139 - 140, Remove the temporary replace directive that
points github.com/openshift/library-go to the personal fork (the replace line in
go.mod); update the module to reference the official upstream
(github.com/openshift/library-go) and ensure any required changes are merged
into that upstream, then run go mod tidy and re-vendor modules (e.g., go mod
vendor or your repo's vendoring step) so the repository no longer depends on
github.com/sanchezl/library-go before merging.

Comment on lines +182 to +183
// deletion triggers a roll-out - wait until a new version has been rolled out
testlibraryapi.WaitForAPIServerToStabilizeOnTheSameRevision(t, kubeClient.Pods(operatorclient.TargetNamespace))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== helper signature =="
sed -n '/func WaitForAPIServerToStabilizeOnTheSameRevision/,/}/p' \
  vendor/github.com/openshift/library-go/test/library/apiserver/apiserver.go

echo
echo "== local call site =="
rg -n -C2 'WaitForAPIServerToStabilizeOnTheSameRevision\(' test/e2e/bound_sa_token.go

Repository: openshift/cluster-kube-apiserver-operator

Length of output: 756


Handle the API server stabilization error.

Line 183 ignores the error return value from WaitForAPIServerToStabilizeOnTheSameRevision. If the stabilization wait times out, the test continues to run assertions against an unstabilized rollout, producing misleading and flaky test failures.

Capture and assert on the error:

Fix
-	testlibraryapi.WaitForAPIServerToStabilizeOnTheSameRevision(t, kubeClient.Pods(operatorclient.TargetNamespace))
+	err = testlibraryapi.WaitForAPIServerToStabilizeOnTheSameRevision(t, kubeClient.Pods(operatorclient.TargetNamespace))
+	require.NoError(t, err)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// deletion triggers a roll-out - wait until a new version has been rolled out
testlibraryapi.WaitForAPIServerToStabilizeOnTheSameRevision(t, kubeClient.Pods(operatorclient.TargetNamespace))
// deletion triggers a roll-out - wait until a new version has been rolled out
err = testlibraryapi.WaitForAPIServerToStabilizeOnTheSameRevision(t, kubeClient.Pods(operatorclient.TargetNamespace))
require.NoError(t, err)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/e2e/bound_sa_token.go` around lines 182 - 183, The call to
testlibraryapi.WaitForAPIServerToStabilizeOnTheSameRevision currently ignores
its error return; change the call to capture the error (e.g., err :=
testlibraryapi.WaitForAPIServerToStabilizeOnTheSameRevision(t,
kubeClient.Pods(operatorclient.TargetNamespace))) and fail the test on error
(e.g., t.Fatalf or t.Fatalff with a clear message and the error) so the test
stops if stabilization times out or fails.

Comment on lines +192 to 208
// Use a higher success threshold (15) with a longer interval (3 min) to
// ensure pods stay stable for 45 minutes (15 × 3 min). This accounts for
// delayed rollouts triggered by configmap deletion, where the operator's
// propagation delay can cause the stability check to falsely pass on the
// old revision. KAS rollouts can take 15-20 minutes each.
const (
extendedSuccessThreshold = 15
successInterval = 3 * time.Minute
pollInterval = 30 * time.Second
timeout = 45 * time.Minute
)
err = libgotest.WaitForPodsToStabilizeOnTheSameRevision(t, kubeClient.Pods(operatorclient.TargetNamespace), "apiserver=true", extendedSuccessThreshold, successInterval, pollInterval, timeout)
require.NoError(t, err)

t.Log("bouncing crash-looping pods to refresh SA tokens after cleanup")
bounceCrashLoopingPods(ctx, t, kubeClient)
waitForBouncedPodsHealthy(ctx, t, kubeClient)

t.Log("waiting for all ClusterOperators to stabilize after cleanup rollout")
err = waitForAllClusterOperatorsStable(t, configClient, clusterStabilityTimeout)
t.Log("waiting for all ClusterOperators to stabilize")
err = waitForAllClusterOperatorsStable(t, configClient, timeout)
require.NoError(t, err)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Keep the deferred recovery inside one timeout budget.

Lines 197-208 can already spend 90 minutes in the defer path by themselves (45m + 45m). Because this test does more work before reaching the defer, the outer [Timeout:90m] can fire before recovery finishes.

Proposed fix
 		const (
 			extendedSuccessThreshold = 15
 			successInterval          = 3 * time.Minute
 			pollInterval             = 30 * time.Second
 			timeout                  = 45 * time.Minute
 		)
+		cleanupStart := time.Now()
 		err = libgotest.WaitForPodsToStabilizeOnTheSameRevision(t, kubeClient.Pods(operatorclient.TargetNamespace), "apiserver=true", extendedSuccessThreshold, successInterval, pollInterval, timeout)
 		require.NoError(t, err)

 		t.Log("waiting for all ClusterOperators to stabilize")
-		err = waitForAllClusterOperatorsStable(t, configClient, timeout)
+		remaining := timeout - time.Since(cleanupStart)
+		if remaining < 0 {
+			remaining = 0
+		}
+		err = waitForAllClusterOperatorsStable(t, configClient, remaining)
 		require.NoError(t, err)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Use a higher success threshold (15) with a longer interval (3 min) to
// ensure pods stay stable for 45 minutes (15 × 3 min). This accounts for
// delayed rollouts triggered by configmap deletion, where the operator's
// propagation delay can cause the stability check to falsely pass on the
// old revision. KAS rollouts can take 15-20 minutes each.
const (
extendedSuccessThreshold = 15
successInterval = 3 * time.Minute
pollInterval = 30 * time.Second
timeout = 45 * time.Minute
)
err = libgotest.WaitForPodsToStabilizeOnTheSameRevision(t, kubeClient.Pods(operatorclient.TargetNamespace), "apiserver=true", extendedSuccessThreshold, successInterval, pollInterval, timeout)
require.NoError(t, err)
t.Log("bouncing crash-looping pods to refresh SA tokens after cleanup")
bounceCrashLoopingPods(ctx, t, kubeClient)
waitForBouncedPodsHealthy(ctx, t, kubeClient)
t.Log("waiting for all ClusterOperators to stabilize after cleanup rollout")
err = waitForAllClusterOperatorsStable(t, configClient, clusterStabilityTimeout)
t.Log("waiting for all ClusterOperators to stabilize")
err = waitForAllClusterOperatorsStable(t, configClient, timeout)
require.NoError(t, err)
// Use a higher success threshold (15) with a longer interval (3 min) to
// ensure pods stay stable for 45 minutes (15 × 3 min). This accounts for
// delayed rollouts triggered by configmap deletion, where the operator's
// propagation delay can cause the stability check to falsely pass on the
// old revision. KAS rollouts can take 15-20 minutes each.
const (
extendedSuccessThreshold = 15
successInterval = 3 * time.Minute
pollInterval = 30 * time.Second
timeout = 45 * time.Minute
)
cleanupStart := time.Now()
err = libgotest.WaitForPodsToStabilizeOnTheSameRevision(t, kubeClient.Pods(operatorclient.TargetNamespace), "apiserver=true", extendedSuccessThreshold, successInterval, pollInterval, timeout)
require.NoError(t, err)
t.Log("waiting for all ClusterOperators to stabilize")
remaining := timeout - time.Since(cleanupStart)
if remaining < 0 {
remaining = 0
}
err = waitForAllClusterOperatorsStable(t, configClient, remaining)
require.NoError(t, err)

@gangwgr

gangwgr commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

/retest-required

@gangwgr

gangwgr commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

/test e2e-gcp-operator-serial-ote

1 similar comment
@gangwgr

gangwgr commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

/test e2e-gcp-operator-serial-ote

@openshift-ci

openshift-ci Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

@sanchezl: The following test 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-gcp-operator-serial-ote 15520e3 link true /test e2e-gcp-operator-serial-ote

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.

@sanchezl

sanchezl commented Apr 9, 2026

Copy link
Copy Markdown
Contributor Author

Closing — proof for library-go#2151 (structural refactor). Went with library-go#2145 + CKAO#2051 instead due to how CEO uses the certrotation package.

@sanchezl sanchezl closed this Apr 9, 2026
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants