Skip to content

OCPCLOUD-3442: Migrate four controllers to per-controller condition reporting#577

Open
stefanonardo wants to merge 5 commits into
openshift:mainfrom
stefanonardo:OCPCLOUD-3442
Open

OCPCLOUD-3442: Migrate four controllers to per-controller condition reporting#577
stefanonardo wants to merge 5 commits into
openshift:mainfrom
stefanonardo:OCPCLOUD-3442

Conversation

@stefanonardo

@stefanonardo stefanonardo commented Jun 4, 2026

Copy link
Copy Markdown

Summary

  • Migrate CoreCluster, InfraCluster, Kubeconfig, and SecretSync controllers from ClusterOperatorStatusClient (merge-patch, shared top-level conditions) to ControllerResultGenerator (server-side apply, per-controller prefixed conditions)
  • Each controller now reports its own Available and Progressing conditions on the ClusterOperator object, which are aggregated into top-level conditions by the ClusterOperator controller
  • Delete ClusterOperatorStatusClient and GetClusterOperatorStatusClient — no remaining consumers

Depends on #574

Test plan

  • make build passes
  • make lint reports 0 issues
  • Unit tests pass for all affected packages: corecluster, infracluster, kubeconfig, secretsync, clusteroperator
  • Condition assertions added to all four controllers verifying Available/Progressing are written to ClusterOperator on success and error paths
  • ClusterOperator aggregation tests updated with all six sub-controllers

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Aggregated ClusterOperator status conditions and improved operator-version reporting when components are up-to-date.
    • Standardized result-driven status updates across controllers for more consistent status behavior.
  • Bug Fixes
    • Improved condition merge behavior (preserving transitions) and correction of stale operator-version entries.
    • Added clearer waiting behavior when infrastructure platform status is missing, including timed requeues.
  • Refactor
    • Unified reconcile/result flow and centralized status-writing logic.
  • Tests
    • Expanded coverage for condition aggregation, version handling, and reconciliation permutations.
  • Chores
    • Build/verify now run code generation as part of the workflow.

@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: LGTM mode

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jun 4, 2026
@openshift-ci-robot

openshift-ci-robot commented Jun 4, 2026

Copy link
Copy Markdown

@stefanonardo: This pull request references OCPCLOUD-3442 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

  • Migrate CoreCluster, InfraCluster, Kubeconfig, and SecretSync controllers from ClusterOperatorStatusClient (merge-patch, shared top-level conditions) to ControllerResultGenerator (server-side apply, per-controller prefixed conditions)
  • Each controller now reports its own Available and Progressing conditions on the ClusterOperator object, which are aggregated into top-level conditions by the ClusterOperator controller
  • Delete ClusterOperatorStatusClient and GetClusterOperatorStatusClient — no remaining consumers

Depends on #574

Test plan

  • make build passes
  • make lint reports 0 issues
  • Unit tests pass for all affected packages: corecluster, infracluster, kubeconfig, secretsync, clusteroperator
  • Condition assertions added to all four controllers verifying Available/Progressing are written to ClusterOperator on success and error paths
  • ClusterOperator aggregation tests updated with all six sub-controllers

🤖 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

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 0af30601-9a24-49cd-9e5f-438193d9d00c

📥 Commits

Reviewing files that changed from the base of the PR and between 181c66b and 8253aeb.

⛔ Files ignored due to path filters (2)
  • vendor/golang.org/x/tools/cmd/stringer/stringer.go is excluded by !**/vendor/**, !vendor/**
  • vendor/modules.txt is excluded by !**/vendor/**, !vendor/**
📒 Files selected for processing (26)
  • Makefile
  • cmd/capi-controllers/main.go
  • cmd/capi-operator/main.go
  • go.mod
  • pkg/commoncmdoptions/commonoptions.go
  • pkg/controllers/clusteroperator/clusteroperator_controller.go
  • pkg/controllers/clusteroperator/clusteroperator_controller_test.go
  • pkg/controllers/clusteroperator/suite_test.go
  • pkg/controllers/common_consts.go
  • pkg/controllers/corecluster/corecluster_controller.go
  • pkg/controllers/corecluster/corecluster_controller_test.go
  • pkg/controllers/infracluster/infracluster_controller.go
  • pkg/controllers/infracluster/infracluster_controller_test.go
  • pkg/controllers/installer/installer_controller.go
  • pkg/controllers/kubeconfig/kubeconfig.go
  • pkg/controllers/kubeconfig/kubeconfig_test.go
  • pkg/controllers/revision/revision_controller.go
  • pkg/controllers/revision/revision_controller_test.go
  • pkg/controllers/secretsync/secret_sync_controller.go
  • pkg/controllers/secretsync/secret_sync_controller_test.go
  • pkg/operatorstatus/controller_status.go
  • pkg/operatorstatus/controller_status_test.go
  • pkg/operatorstatus/operator_status.go
  • pkg/operatorstatus/reason_string.go
  • pkg/operatorstatus/watch_predicates.go
  • pkg/test/conditions.go
💤 Files with no reviewable changes (3)
  • pkg/controllers/common_consts.go
  • pkg/operatorstatus/operator_status.go
  • pkg/commoncmdoptions/commonoptions.go
✅ Files skipped from review due to trivial changes (2)
  • go.mod
  • pkg/controllers/installer/installer_controller.go
🚧 Files skipped from review as they are similar to previous changes (20)
  • pkg/operatorstatus/reason_string.go
  • pkg/test/conditions.go
  • Makefile
  • pkg/operatorstatus/watch_predicates.go
  • cmd/capi-operator/main.go
  • cmd/capi-controllers/main.go
  • pkg/controllers/clusteroperator/clusteroperator_controller.go
  • pkg/controllers/kubeconfig/kubeconfig_test.go
  • pkg/controllers/infracluster/infracluster_controller_test.go
  • pkg/controllers/revision/revision_controller_test.go
  • pkg/controllers/corecluster/corecluster_controller_test.go
  • pkg/controllers/secretsync/secret_sync_controller.go
  • pkg/controllers/clusteroperator/clusteroperator_controller_test.go
  • pkg/controllers/kubeconfig/kubeconfig.go
  • pkg/operatorstatus/controller_status.go
  • pkg/controllers/clusteroperator/suite_test.go
  • pkg/operatorstatus/controller_status_test.go
  • pkg/controllers/revision/revision_controller.go
  • pkg/controllers/secretsync/secret_sync_controller_test.go
  • pkg/controllers/infracluster/infracluster_controller.go

Walkthrough

This PR updates controller status handling to use shared reconcile results and generated condition reasons, rewires controller startup to pass direct dependencies, and adds status/version update support for ClusterOperator reconciliation. It also adds generate tooling and updates tests for the new status model.

Changes

ClusterOperator status refactor

Layer / File(s) Summary
Tooling and status core
Makefile, go.mod, pkg/operatorstatus/controller_status.go, pkg/operatorstatus/reason_string.go, pkg/operatorstatus/watch_predicates.go, pkg/controllers/common_consts.go
Add generate support and stringer tooling, convert Reason to an enum with generated strings, add operator version writes and merged status patching, add the status-change watch predicate, and remove the shared operator-version constant from controllers.
Status tests and helpers
pkg/operatorstatus/controller_status_test.go
Move status tests to envtest, add ClusterOperator setup/version seeding helpers, and update expectations to generated reason strings and version-field behavior.
ClusterOperator aggregation
pkg/controllers/clusteroperator/clusteroperator_controller.go, pkg/controllers/clusteroperator/clusteroperator_controller_test.go, pkg/controllers/clusteroperator/suite_test.go
Aggregate sub-controller conditions into ClusterOperator status, update unsupported-platform version handling, switch to the status-changed watch predicate, and refactor the controller tests and suite setup around the new flow.
Controller reconcile migration
pkg/controllers/corecluster/corecluster_controller.go, pkg/controllers/corecluster/corecluster_controller_test.go, pkg/controllers/infracluster/infracluster_controller.go, pkg/controllers/infracluster/infracluster_controller_test.go, pkg/controllers/kubeconfig/kubeconfig.go, pkg/controllers/kubeconfig/kubeconfig_test.go, pkg/controllers/installer/installer_controller.go, pkg/controllers/revision/revision_controller.go, pkg/controllers/revision/revision_controller_test.go, pkg/controllers/secretsync/secret_sync_controller.go, pkg/controllers/secretsync/secret_sync_controller_test.go
Switch controllers to client.Client plus shared result generators, centralize ClusterOperator status writes, add operator-version updates in revision handling, and update controller tests to assert the new status conditions and version behavior.
Startup wiring and common options
cmd/capi-operator/main.go, cmd/capi-controllers/main.go, pkg/commoncmdoptions/commonoptions.go
Pass direct runtime dependencies into controllers, add the infra platform-status guard, and remove the shared status-client helper.
Test matcher update
pkg/test/conditions.go
Update the shared matcher to compare stringer values by string output.

🎯 4 (Complex) | ⏱️ ~60 minutes


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 2 warnings)

Check name Status Explanation Resolution
No-Weak-Crypto ❌ Error areSecretsEqual in secret_sync_controller.go compares secret data with reflect.DeepEqual, which is a non-constant-time secret comparison. Avoid direct equality checks on secret/token values; use a constant-time comparison for sensitive byte slices or remove the need to compare secret contents.
Docstring Coverage ⚠️ Warning Docstring coverage is 25.64% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Test Structure And Quality ⚠️ Warning corecluster/infracluster stopManager blocks on <-mgrDone> with no timeout, violating the cluster-wait timeout requirement. Wrap shutdown waits in Eventually(...).WithTimeout(...); avoid bare blocking receives. Consider splitting tests that mix resource changes and ClusterOperator status assertions.
✅ Passed checks (12 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: migrating four controllers to per-controller condition reporting.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed Scanned all affected Ginkgo titles; none use dynamic values or unstable formatting, and titles are static/descriptive.
Microshift Test Compatibility ✅ Passed No new e2e specs were added; the changed Ginkgo tests are envtest/controller tests under pkg/controllers, so MicroShift gating is not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PASS: The added Ginkgo specs are controller/envtest tests under pkg/controllers, not e2e tests, and I found no node/topology/HA assumptions or SNO-sensitive checks.
Topology-Aware Scheduling Compatibility ✅ Passed Touched files are controller/status logic and Makefile only; no pod specs, affinities, nodeSelectors, spread constraints, replicas, or PDBs were added. 'master'/'worker' uses are labels/names.
Ote Binary Stdout Contract ✅ Passed No process-level stdout writes were added; TestMain writes errors to stderr, and suite setup only configures loggers or GinkgoWriter.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PASS: The added Ginkgo specs are package-level controller tests using envtest/local cluster objects; no hardcoded IPv4, host-join URLs, or public-internet calls were found.
Container-Privileges ✅ Passed PASS: Searched non-vendor repo and touched files; no privileged/hostPID/hostNetwork/hostIPC/allowPrivilegeEscalation/CAP_SYS_ADMIN settings found.
No-Sensitive-Data-In-Logs ✅ Passed Only benign logs were added: resource names, status text, versions/ciphers; no raw secrets, tokens, PII, or hostnames are logged.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci openshift-ci Bot requested review from mdbooth and racheljpg June 4, 2026 11:59
@openshift-ci

openshift-ci Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign racheljpg for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/controllers/kubeconfig/kubeconfig_test.go`:
- Around line 159-160: The test mutates the server-managed field by calling
tokenSecret.SetCreationTimestamp(...) and then cl.Update(ctx, tokenSecret);
remove the SetCreationTimestamp call and only modify fields that are
client-editable (e.g., annotations) so the test updates tokenSecret via
cl.Update(...) without touching metadata.creationTimestamp; locate the
tokenSecret variable and the SetCreationTimestamp invocation in
kubeconfig_test.go and delete that mutation, ensuring subsequent cl.Update(ctx,
tokenSecret) only changes annotations or other writable fields.
🪄 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: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: c0c49503-59cf-4e6c-b87f-ccc4dd58187f

📥 Commits

Reviewing files that changed from the base of the PR and between 3f1aa11 and eae2e85.

⛔ Files ignored due to path filters (2)
  • vendor/golang.org/x/tools/cmd/stringer/stringer.go is excluded by !**/vendor/**, !vendor/**
  • vendor/modules.txt is excluded by !**/vendor/**, !vendor/**
📒 Files selected for processing (26)
  • Makefile
  • cmd/capi-controllers/main.go
  • cmd/capi-operator/main.go
  • go.mod
  • pkg/commoncmdoptions/commonoptions.go
  • pkg/controllers/clusteroperator/clusteroperator_controller.go
  • pkg/controllers/clusteroperator/clusteroperator_controller_test.go
  • pkg/controllers/clusteroperator/suite_test.go
  • pkg/controllers/common_consts.go
  • pkg/controllers/corecluster/corecluster_controller.go
  • pkg/controllers/corecluster/corecluster_controller_test.go
  • pkg/controllers/infracluster/infracluster_controller.go
  • pkg/controllers/infracluster/infracluster_controller_test.go
  • pkg/controllers/installer/installer_controller.go
  • pkg/controllers/kubeconfig/kubeconfig.go
  • pkg/controllers/kubeconfig/kubeconfig_test.go
  • pkg/controllers/revision/revision_controller.go
  • pkg/controllers/revision/revision_controller_test.go
  • pkg/controllers/secretsync/secret_sync_controller.go
  • pkg/controllers/secretsync/secret_sync_controller_test.go
  • pkg/operatorstatus/controller_status.go
  • pkg/operatorstatus/controller_status_test.go
  • pkg/operatorstatus/operator_status.go
  • pkg/operatorstatus/reason_string.go
  • pkg/operatorstatus/watch_predicates.go
  • pkg/test/conditions.go
💤 Files with no reviewable changes (3)
  • pkg/controllers/common_consts.go
  • pkg/operatorstatus/operator_status.go
  • pkg/commoncmdoptions/commonoptions.go

Comment thread pkg/controllers/kubeconfig/kubeconfig_test.go Outdated
@stefanonardo

Copy link
Copy Markdown
Author

/hold

@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 Jun 4, 2026

@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: 1

🧹 Nitpick comments (1)
pkg/controllers/clusteroperator/clusteroperator_controller_test.go (1)

94-343: ⚡ Quick win

Use should ... phrasing for table entry names.

Most updated Entry(...) descriptions are "when ..."; switch them to "should ... when ..." to match the test naming convention used in this repo.

As per coding guidelines: Use descriptive test names in 'should...' format in Ginkgo tests (e.g., 'should do nothing').

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/controllers/clusteroperator/clusteroperator_controller_test.go` around
lines 94 - 343, The table-driven test Entries in
clusteroperator_controller_test.go use "when ..." phrasing; update each
Entry(...) description to the repository's "should ... when ..." convention
(e.g., change "when all sub-controllers report success" to "should report
success when all sub-controllers report success") so all Entry(...) strings in
the DescribeTable/Entry block (look for the long DescribeTable block containing
Entry("when all sub-controllers report success", ..., defaultNodeTimeout) and
subsequent Entry calls) follow the "should ..." naming pattern while keeping the
rest of each Entry invocation unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/controllers/clusteroperator/clusteroperator_controller_test.go`:
- Around line 184-187: The test claims to exercise the "missing sub-conditions"
path but instead sets InstallerControllerAvailable/Progressing to Unknown;
replace the explicit subCondition entries with a helper that removes those types
so the conditions are actually absent. Add the helper function
withoutConditionTypes(base
[]*configv1apply.ClusterOperatorStatusConditionApplyConfiguration, types
...string) []*configv1apply.ClusterOperatorStatusConditionApplyConfiguration (as
shown in the comment) and change the test invocation from
withOverrides(allSubControllersSuccessful(), subCondition(...),
subCondition(...)) to
withOverrides(withoutConditionTypes(allSubControllersSuccessful(),
"InstallerControllerAvailable", "InstallerControllerProgressing")) so
getSubcontrollerCondition is exercised for absent conditions.

---

Nitpick comments:
In `@pkg/controllers/clusteroperator/clusteroperator_controller_test.go`:
- Around line 94-343: The table-driven test Entries in
clusteroperator_controller_test.go use "when ..." phrasing; update each
Entry(...) description to the repository's "should ... when ..." convention
(e.g., change "when all sub-controllers report success" to "should report
success when all sub-controllers report success") so all Entry(...) strings in
the DescribeTable/Entry block (look for the long DescribeTable block containing
Entry("when all sub-controllers report success", ..., defaultNodeTimeout) and
subsequent Entry calls) follow the "should ..." naming pattern while keeping the
rest of each Entry invocation unchanged.
🪄 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: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: a7aeda83-7ff2-4d11-acaa-2f829b7ae886

📥 Commits

Reviewing files that changed from the base of the PR and between eae2e85 and 583d1d8.

📒 Files selected for processing (13)
  • cmd/capi-controllers/main.go
  • pkg/commoncmdoptions/commonoptions.go
  • pkg/controllers/clusteroperator/clusteroperator_controller.go
  • pkg/controllers/clusteroperator/clusteroperator_controller_test.go
  • pkg/controllers/corecluster/corecluster_controller.go
  • pkg/controllers/corecluster/corecluster_controller_test.go
  • pkg/controllers/infracluster/infracluster_controller.go
  • pkg/controllers/infracluster/infracluster_controller_test.go
  • pkg/controllers/kubeconfig/kubeconfig.go
  • pkg/controllers/kubeconfig/kubeconfig_test.go
  • pkg/controllers/secretsync/secret_sync_controller.go
  • pkg/controllers/secretsync/secret_sync_controller_test.go
  • pkg/operatorstatus/operator_status.go
💤 Files with no reviewable changes (2)
  • pkg/commoncmdoptions/commonoptions.go
  • pkg/operatorstatus/operator_status.go
🚧 Files skipped from review as they are similar to previous changes (8)
  • cmd/capi-controllers/main.go
  • pkg/controllers/infracluster/infracluster_controller_test.go
  • pkg/controllers/kubeconfig/kubeconfig_test.go
  • pkg/controllers/secretsync/secret_sync_controller_test.go
  • pkg/controllers/clusteroperator/clusteroperator_controller.go
  • pkg/controllers/infracluster/infracluster_controller.go
  • pkg/controllers/corecluster/corecluster_controller_test.go
  • pkg/controllers/secretsync/secret_sync_controller.go

Comment thread pkg/controllers/clusteroperator/clusteroperator_controller_test.go Outdated
}

return ctrl.Result{}, nil
return ResultGenerator.Success()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should probably be WaitingOnExternal.

You should also check if this controller watches the Infrastructure object (check in SetupWithManager). If it doesn't we'll either need to watch it or also add a RequeueAfter here. Polling should be fine in this case if we don't already have a watch: we don't really expect this to happen.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

we don' watch it, I'll requeue it after 1 minute

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pkg/controllers/kubeconfig/kubeconfig.go (1)

147-162: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Return a waiting result after clearing the token secret.

This branch deliberately empties the token data so another controller can repopulate it. Returning Success() here briefly reports Available=True/Progressing=False before the next reconcile flips back to WaitingOnExternal, which makes the ClusterOperator condition false-green during refresh.

Suggested fix
 		if err := r.Update(ctx, tokenSecret); err != nil {
 			return ResultGenerator.Error(fmt.Errorf("unable to clear token secret data: %w", err))
 		}
 
-		return ResultGenerator.Success()
+		return ResultGenerator.WaitingOnExternal("token secret population").WithRequeueAfter(1 * time.Minute)
 	}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/controllers/kubeconfig/kubeconfig.go` around lines 147 - 162, The code
clears tokenSecret.Data and sets tokenRefreshAnnotationKey then returns
ResultGenerator.Success(), which briefly marks the operator Available=true;
instead return a waiting result so the operator reflects that it is waiting for
the external token controller to repopulate the secret: after calling
r.Update(ctx, tokenSecret) replace the Success() return with
ResultGenerator.WaitingOnExternal() (or the appropriate Waiting result used
elsewhere) so reconcile reports a waiting state until the token is restored;
update references around tokenSecret, tokenRefreshAnnotationKey, r.Update, and
ResultGenerator accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@pkg/controllers/kubeconfig/kubeconfig.go`:
- Around line 147-162: The code clears tokenSecret.Data and sets
tokenRefreshAnnotationKey then returns ResultGenerator.Success(), which briefly
marks the operator Available=true; instead return a waiting result so the
operator reflects that it is waiting for the external token controller to
repopulate the secret: after calling r.Update(ctx, tokenSecret) replace the
Success() return with ResultGenerator.WaitingOnExternal() (or the appropriate
Waiting result used elsewhere) so reconcile reports a waiting state until the
token is restored; update references around tokenSecret,
tokenRefreshAnnotationKey, r.Update, and ResultGenerator accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 265a4a4f-618d-4950-b037-566ee03e1f5b

📥 Commits

Reviewing files that changed from the base of the PR and between cbd5749 and 181c66b.

📒 Files selected for processing (13)
  • cmd/capi-controllers/main.go
  • pkg/commoncmdoptions/commonoptions.go
  • pkg/controllers/clusteroperator/clusteroperator_controller.go
  • pkg/controllers/clusteroperator/clusteroperator_controller_test.go
  • pkg/controllers/corecluster/corecluster_controller.go
  • pkg/controllers/corecluster/corecluster_controller_test.go
  • pkg/controllers/infracluster/infracluster_controller.go
  • pkg/controllers/infracluster/infracluster_controller_test.go
  • pkg/controllers/kubeconfig/kubeconfig.go
  • pkg/controllers/kubeconfig/kubeconfig_test.go
  • pkg/controllers/secretsync/secret_sync_controller.go
  • pkg/controllers/secretsync/secret_sync_controller_test.go
  • pkg/operatorstatus/operator_status.go
💤 Files with no reviewable changes (2)
  • pkg/operatorstatus/operator_status.go
  • pkg/commoncmdoptions/commonoptions.go
🚧 Files skipped from review as they are similar to previous changes (10)
  • pkg/controllers/secretsync/secret_sync_controller_test.go
  • cmd/capi-controllers/main.go
  • pkg/controllers/kubeconfig/kubeconfig_test.go
  • pkg/controllers/corecluster/corecluster_controller_test.go
  • pkg/controllers/infracluster/infracluster_controller.go
  • pkg/controllers/infracluster/infracluster_controller_test.go
  • pkg/controllers/clusteroperator/clusteroperator_controller_test.go
  • pkg/controllers/secretsync/secret_sync_controller.go
  • pkg/controllers/clusteroperator/clusteroperator_controller.go
  • pkg/controllers/corecluster/corecluster_controller.go

@stefanonardo

Copy link
Copy Markdown
Author

/test unit

mdbooth and others added 5 commits June 25, 2026 11:42
Add WithUpdateOperatorVersion() to ReconcileResult, allowing controllers
to optionally update the operator version in the ClusterOperator status
when writing their conditions.

Also switches controller_status tests from fake client to envtest for
accurate SSA field ownership testing.
Convert Reason from string constants to an ordered iota type, enabling
severity-based comparison for condition aggregation.

Replaces ReasonSyncFailed with the standardised ReasonEphemeralError.
ClusterOperator version is now written by the revision controller
instead of the clusteroperator controller.
Rewrite ClusterOperatorController to aggregate per-controller
sub-conditions (Available/Progressing) into top-level ClusterOperator
conditions.
Migrate CoreCluster, InfraCluster, Kubeconfig, and SecretSync controllers
from ClusterOperatorStatusClient (merge-patch, shared top-level conditions)
to ControllerResultGenerator (server-side apply, per-controller prefixed
conditions).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@openshift-ci

openshift-ci Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

@stefanonardo: 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.

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

Labels

do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. 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