fix: default empty CertManager managementState to Managed for GitOps#441
Conversation
GitOps-created CertManager CRs often omit managementState, which left static resources applied but deployment controllers idle. Treat unknown state as Managed during reconcile and default the CRD field to Managed. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Skipping CI for Draft Pull Request. |
WalkthroughThe PR adds a ChangesDefault managementState to Managed
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 13 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (13 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: vishalgaikwad1979 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pkg/operator/operatorclient/operatorclient_test.go (1)
23-24: ⚡ Quick winBound cache sync waits in the first two tests.
Use
context.WithTimeout(..., wait.ForeverTestTimeout)(like Line 83) so informer sync failures can’t hang CI indefinitely.Suggested change
- ctx, cancel := context.WithCancel(context.Background()) + ctx, cancel := context.WithTimeout(context.Background(), wait.ForeverTestTimeout) t.Cleanup(cancel) ... - ctx, cancel := context.WithCancel(context.Background()) + ctx, cancel := context.WithTimeout(context.Background(), wait.ForeverTestTimeout) t.Cleanup(cancel)Also applies to: 37-37, 53-54, 67-67
🤖 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/operator/operatorclient/operatorclient_test.go` around lines 23 - 24, The test cases are using context.WithCancel which can hang indefinitely if informer sync fails. Replace all instances of context.WithCancel(context.Background()) with context.WithTimeout(context.Background(), wait.ForeverTestTimeout) to add a timeout that prevents CI hangs. This pattern is already demonstrated elsewhere in the file (line 83) and should be applied consistently to all affected test setup locations where ctx and cancel are initialized.
🤖 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.
Nitpick comments:
In `@pkg/operator/operatorclient/operatorclient_test.go`:
- Around line 23-24: The test cases are using context.WithCancel which can hang
indefinitely if informer sync fails. Replace all instances of
context.WithCancel(context.Background()) with
context.WithTimeout(context.Background(), wait.ForeverTestTimeout) to add a
timeout that prevents CI hangs. This pattern is already demonstrated elsewhere
in the file (line 83) and should be applied consistently to all affected test
setup locations where ctx and cancel are initialized.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 73ba1298-aed3-422e-aa84-7241aa8cacda
📒 Files selected for processing (6)
bundle/manifests/operator.openshift.io_certmanagers.yamlconfig/crd/bases/operator.openshift.io_certmanagers.yamlconfig/crd/kustomization.yamlconfig/crd/patches/managementstate_default_in_certmanagers.yamlpkg/operator/operatorclient/operatorclient.gopkg/operator/operatorclient/operatorclient_test.go
|
@vishalgaikwad1979: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |
GitOps-created CertManager CRs often omit managementState, which left static resources applied but deployment controllers idle. Treat unknown state as Managed during reconcile and default the CRD field to Managed.
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests