-
Notifications
You must be signed in to change notification settings - Fork 317
feat: Use RequiresRepublish for secret rotation #1622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Hi @dargudear-google. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approach broadly LGTM! IIUC, once this PR is submitted, auto-rotation won't work for k8s clusters < 1.21. What is the process to announce and manage this breaking change?
Discussed in the last community call that we should publish that "For clusters < 1.21, please use v.1.4.5 or earlier." |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1622 +/- ##
==========================================
- Coverage 35.83% 32.07% -3.77%
==========================================
Files 63 57 -6
Lines 3759 3838 +79
==========================================
- Hits 1347 1231 -116
- Misses 2268 2501 +233
+ Partials 144 106 -38 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
/ok-to-test |
aa6ffcb
to
8d332b7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First pass.
In bats tests, where sleep duration/timeout is increased, could you re-evaluate if it's necessary? If yes then could you add a note to make sure we have context?
/retest-required |
Yes, this will need to be merged before we can merge #1755. We want to include both changes in the next minor release. I still need to review the recent updates. I'm currently in the middle of the Kubernetes v1.34 enhancements freeze but will take a look soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think my main suggestion would be to read the CSIDriver into a local cache and have NodePubilshVolume()
read the requiresRepublish
value from that local cache. That way users can avoid a CSI Driver restart if they change the value
manifest_staging/charts/secrets-store-csi-driver/templates/csidriver.yaml
Outdated
Show resolved
Hide resolved
reader client.Reader | ||
providerClients *PluginClientBuilder | ||
tokenClient *k8s.TokenClient | ||
rotationConfig *rotationConfig |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of instead of having a rotationConfig that isn't thread-safe or configurable, using a (wrapped) K8s client to dynamically read this value off the CSIDriver?
Right now, if a user changes requiresRepublish
on their driver configuration, they'll have to restart every CSI driver pod to update if this is enabled, because you're setting this value once in main.go
.
In my PR I created a CSIDriver client that would just watch the one CSIDriver resource, and NodePublishVolume()
would read from the local cache.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as we're doing a filtered watch on the specific driver name, it would be fine.
However, this does mean we will now have to ask users to set and unset requiresRepublish
on the CSI driver object to enable/disable rotation unlike the current approach of setting the flag on the driver. This will be a breaking change.
How often is the value going to be flipped between true/false? Would a single restart of the driver to change from no rotation to rotation enabled be cumbersome?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as we're doing a filtered watch on the specific driver name, it would be fine.
👍 yep thats the plan
However, this does mean we will now have to ask users to set and unset
requiresRepublish
on the CSI driver object to enable/disable rotation unlike the current approach of setting the flag on the driver. This will be a breaking change.
We could decide if we want to make this a "must be enabled on both CSIDriver object and driver flag" or just "fully controlled on CSIDriver object" to be enabled.
I'd advocate toward the latter, as the --enable-secret-rotation
flag help text only claims to be alpha. That is kind of a breaking change, but for an alpha feature, which seems within reason.
enableSecretRotation = flag.Bool(
"enable-secret-rotation",
false,
"Enable secret rotation feature [alpha]")
How often is the value going to be flipped between true/false? Would a single restart of the driver to change from no rotation to rotation enabled be cumbersome?
Well, probably no one or very few users who have the driver installed today has requiresRepublish
set, so they're all going to have to flip it. If they don't flip the value before upgrading the driver, they'll have to do a driver restart. Also if we made it "must be enabled on driver flag and CSIDriver object", you're bound to get some users trying to make it work by flipping the CSIDriver object flag expecting it to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So what are we doing here is setting the requiresRepublish
to true, but that doesn't start the rotation unless customer set enable-secret-rotation
. For the customers, behaviour won't change. It will just change how we implement the rotation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another pass.
reader client.Reader | ||
providerClients *PluginClientBuilder | ||
tokenClient *k8s.TokenClient | ||
rotationConfig *rotationConfig |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as we're doing a filtered watch on the specific driver name, it would be fine.
However, this does mean we will now have to ask users to set and unset requiresRepublish
on the CSI driver object to enable/disable rotation unlike the current approach of setting the flag on the driver. This will be a breaking change.
How often is the value going to be flipped between true/false? Would a single restart of the driver to change from no rotation to rotation enabled be cumbersome?
6bd5eaf
to
2e0ab2f
Compare
2e0ab2f
to
d030467
Compare
8ae9b6f
to
1b8606f
Compare
@dargudear-google is this PR still active? I see it is out of date with no changes in a month |
@dargudear-google could you rebase the PR when you get a chance? I'll do another round of review this week for the metrics + rotation changes and if all looks good, we'll plan this for the v1.6.0 release along with other feature PRs. |
@dargudear-google: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. |
Done |
Yes, rebased and resolved the issues. |
Remove the rotation controller and rely exclusively on RequiresRepublish for secret rotation.