NO-JIRA: add two more encryption rotation scenarios#2218
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. |
| // TODO(thomas): wire up a hook to define this from a provider configuration | ||
| // TODO(thomas): when we're on KMS provider we can grab the keyId from an annotation | ||
| // TODO(thomas): a new rotation controller can update the annotation for KMS | ||
|
|
||
| // TODO(thomas): alternative, when we detect a new KeyId, we can also remove the migrated-* annotations, | ||
| // that way the controller will definitely try to reconcile it again. |
There was a problem hiding this comment.
I'll remove that, sorry
|
[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 |
|
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 (4)
💤 Files with no reviewable changes (1)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughAdds test helpers and a shared operator-conditions hook to detect encryption migration progress, refactors tests to apply APIServer encryption type separately, implements polling utilities for stability/rotations and an "in-progress" window, adds two rotation test scenarios using these utilities, removes a duplicate type, and inserts a TODO comment in the migration controller. No production runtime behavior changed. ChangesEncryption Migration Testing Infrastructure
Rotation Test Scenarios
Migration controller note
🎯 3 (Moderate) | ⏱️ ~25 minutes Sequence DiagramsequenceDiagram
participant Test as rgba(0,128,255,0.5)
participant APIServer as rgba(0,200,100,0.5)
participant Kubernetes as rgba(200,100,0,0.5)
participant Operator as rgba(180,0,180,0.5)
Test->>APIServer: ApplyAPIServerEncryptionType (immediate)
APIServer->>Operator: Operator sees desired encryption config
Operator->>Kubernetes: migrate keys / annotate resources
Kubernetes-->>Operator: secret metadata updates (write-key)
Operator-->>Test: Operator condition (Progressing) via GetOperatorConditionsFunc
Test->>Kubernetes: Poll secret metadata (WriteKey ID) / WaitForNRotations
Test->>Operator: ForceKeyRotation (unsupported config)
Operator->>Kubernetes: new write-key secret created
Kubernetes-->>Test: Poll detects expected rotations / stability
Suggested reviewers
🚥 Pre-merge checks | ✅ 11 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (11 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Comment |
This adds two new encryption tests: * Forced rotation during first migration * Forced rotation during a rotation Signed-off-by: Thomas Jungblut <tjungblu@redhat.com>
from library-go openshift/library-go#2218 Signed-off-by: Thomas Jungblut <tjungblu@redhat.com>
p0lyn0mial
left a comment
There was a problem hiding this comment.
I did a first quick pass. I’d like to clarify the scope. Are we creating new cases that will support all providers, or just KMS?
| t.Skipf("initial migration finished before an in-progress window was observed; set GetOperatorConditionsFunc or use a cluster where migration stays visible longer") | ||
| } | ||
|
|
||
| require.NoError(e, ForceKeyRotation(e, scenario.UnsupportedConfigFunc, fmt.Sprintf("test-rotation-during-first-migration-%s", rand.String(4)))) |
There was a problem hiding this comment.
ForceKeyRotation has no effect on KMS. What is out plan here ? Do we want to run the new scenarios for all encryption providers ?
There was a problem hiding this comment.
ForceKeyRotation will be implemented differently later on
| // ClearForcedKeyRotationReason clears encryption.reason under UnsupportedConfigOverrides (same merge path as | ||
| // ForceKeyRotation). Call when a test finishes so the next test in sequence does not inherit a non-empty | ||
| // reason and the key controller does not keep seeing an external rotation request. | ||
| func ClearForcedKeyRotationReason(t testing.TB, updateUnsupportedConfig UpdateUnsupportedConfigFunc) error { |
There was a problem hiding this comment.
instead of a new fn why no to change teh ForceKeyRotation to register a cleanup routine via t.Cleanup ?
There was a problem hiding this comment.
why would I couple those two functionalities together? what if I just want to force a key rotation and not cleanup?
|
|
||
| require.NoError(e, ForceKeyRotation(e, scenario.UnsupportedConfigFunc, fmt.Sprintf("test-rotation-during-first-migration-%s", rand.String(4)))) | ||
| // n=2: one write-key revision from turning encryption on, one from ForceKeyRotation. | ||
| WaitForNRotations(e, clientSet.Kube, scenario.EncryptionProvider, scenario.TargetGRs, ns, labelSelector, prevMeta, 2) |
There was a problem hiding this comment.
also for KMS, rotation will not create a new key.
There was a problem hiding this comment.
yep, so this would be implemented differently in KMS - I assume this would use this API that you and Ben cobbled together so far
|
PR needs rebase. 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. |
This adds two new encryption tests:
Summary by CodeRabbit