NO-JIRA: kms rotation prototype#2297
Conversation
|
@tjungblu: This pull request explicitly references no jira issue. DetailsIn response to this:
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. |
|
Skipping CI for Draft Pull Request. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughAdds KEK migration annotations/types, secret helpers, a ConfigMap-backed converged-KEK reporter, a new KMS rotation controller that reconciles KEK annotations on write-key secrets, and guards/wiring to block key operations while KEK migration is in flight. ChangesKMS KEK Rotation Feature
🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 13 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (13 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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/operator/encryption/controllers/kms_rotation_controller.go`:
- Around line 164-174: The current logic can promote a KEK immediately if
kekMigration.KekConvergedAt is zero; add a zero-time guard before the delay
check: when convergedKekID == kekMigration.KekConvergedID, first test if
kekMigration.KekConvergedAt.IsZero() and if so call updateWriteKeySecret with
setKekConvergenceClock(...) to record c.now(); otherwise perform the existing
time-difference check (c.now().Sub(kekMigration.KekConvergedAt) >=
secrets.KekConvergenceDelay) and only then call
promoteConvergedKekToTarget(...). Ensure you use the same functions
(updateWriteKeySecret, setKekConvergenceClock, promoteConvergedKekToTarget) and
fields (convergedKekID, kekMigration.KekConvergedAt) from the diff.
🪄 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: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 802cafc8-5bbd-4860-b024-4d7c8decbaaa
📒 Files selected for processing (15)
pkg/operator/apiserver/controllerset/apiservercontrollerset.gopkg/operator/encryption/controllers.gopkg/operator/encryption/controllers/key_controller.gopkg/operator/encryption/controllers/key_controller_test.gopkg/operator/encryption/controllers/kms_rotation_controller.gopkg/operator/encryption/controllers/kms_rotation_controller_test.gopkg/operator/encryption/controllers/migration_controller.gopkg/operator/encryption/secrets/kek.gopkg/operator/encryption/secrets/kek_test.gopkg/operator/encryption/secrets/secrets.gopkg/operator/encryption/secrets/types.gopkg/operator/encryption/state/types.gopkg/operator/encryption/statemachine/transition.gopkg/operator/encryption/statemachine/transition_test.gotest/e2e-encryption/encryption_test.go
There was a problem hiding this comment.
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/operator/apiserver/controllerset/apiservercontrollerset.go`:
- Around line 406-410: The fluent setter
WithMOCK_ConfigMapConvergedKEKReporterForEncryptionControllers currently
dereferences cs.encryptionControllers by calling ConfigMapLister() eagerly;
instead, change the setter to only store the provided configMapName (and a flag)
on the APIServerControllerSet/encryptionControllerBuilder state and remove the
immediate call to kmshealth.NewMOCK_ConfigMapConvergedKEKReporter, then move
construction of the mock reporter into encryptionControllerBuilder.build() where
encryptionControllers and its informer listers are guaranteed to be initialized;
update build() to call
kmshealth.NewMOCK_ConfigMapConvergedKEKReporter(cs.encryptionControllers.kubeInformersForNamespaces.ConfigMapLister(),
storedConfigMapName) and assign the result to
encryptionControllers.convergedKEKReporter.
🪄 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: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 009fd4e6-24f1-4242-98ec-7a8af91b7bb1
📒 Files selected for processing (5)
pkg/operator/apiserver/controllerset/apiservercontrollerset.gopkg/operator/encryption/controllers.gopkg/operator/encryption/controllers/kms_rotation_controller.gopkg/operator/encryption/kms/health/configmap_reporter.gopkg/operator/encryption/kms/health/configmap_reporter_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
- pkg/operator/encryption/controllers.go
| func (cs *APIServerControllerSet) WithMOCK_ConfigMapConvergedKEKReporterForEncryptionControllers(configMapName string) *APIServerControllerSet { | ||
| cs.encryptionControllers.convergedKEKReporter = kmshealth.NewMOCK_ConfigMapConvergedKEKReporter( | ||
| cs.encryptionControllers.kubeInformersForNamespaces.ConfigMapLister(), | ||
| configMapName, | ||
| ) |
There was a problem hiding this comment.
Avoid eager informer dereference in the fluent setter.
WithMOCK_ConfigMapConvergedKEKReporterForEncryptionControllers eagerly calls ConfigMapLister(). If this setter is invoked before WithEncryptionControllers, setup can panic on a zero-value informer holder. Defer mock reporter construction to encryptionControllerBuilder.build() and store only configMapName in the builder state.
🤖 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/apiserver/controllerset/apiservercontrollerset.go` around lines
406 - 410, The fluent setter
WithMOCK_ConfigMapConvergedKEKReporterForEncryptionControllers currently
dereferences cs.encryptionControllers by calling ConfigMapLister() eagerly;
instead, change the setter to only store the provided configMapName (and a flag)
on the APIServerControllerSet/encryptionControllerBuilder state and remove the
immediate call to kmshealth.NewMOCK_ConfigMapConvergedKEKReporter, then move
construction of the mock reporter into encryptionControllerBuilder.build() where
encryptionControllers and its informer listers are guaranteed to be initialized;
update build() to call
kmshealth.NewMOCK_ConfigMapConvergedKEKReporter(cs.encryptionControllers.kubeInformersForNamespaces.ConfigMapLister(),
storedConfigMapName) and assign the result to
encryptionControllers.convergedKEKReporter.
Signed-off-by: Thomas Jungblut <[email protected]>
ea13d22 to
e3c679d
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: tjungblu 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.
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/operator/encryption/controllers.go`:
- Around line 53-56: The code currently wires the test-only MOCK reporter
(NewMOCK_ConfigMapConvergedKEKReporter) into the production path used by
NewKMSRotationController and exposes ConvergedKekID(), so replace or gate the
mock: detect production runtime (env/config flag or build tag) and only
instantiate NewMOCK_ConfigMapConvergedKEKReporter for non-production/local;
otherwise construct and pass the real ConvergedKEKReporter (or return an
error/fallback that prevents using the mock) to NewKMSRotationController. Update
the convergedKEKReporter creation site to branch on that condition and ensure
ConvergedKekID() calls resolve against the real reporter in production.
🪄 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: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 91c6cd51-666f-42da-8816-a2eb8cd28f65
📒 Files selected for processing (4)
pkg/operator/encryption/controllers.gopkg/operator/encryption/controllers/kms_rotation_controller.gopkg/operator/encryption/kms/health/configmap_reporter.gopkg/operator/encryption/kms/health/configmap_reporter_test.go
🚧 Files skipped from review as they are similar to previous changes (3)
- pkg/operator/encryption/kms/health/configmap_reporter_test.go
- pkg/operator/encryption/kms/health/configmap_reporter.go
- pkg/operator/encryption/controllers/kms_rotation_controller.go
/hold
Summary by CodeRabbit
New Features
Bug Fixes
Tests