Add application credential finalizer management#643
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Deydra71 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 |
d14e484 to
ec6c565
Compare
ec6c565 to
60522f3
Compare
bshephar
left a comment
There was a problem hiding this comment.
I'm an outsider now, as an outsider it would be nice to have some more context about this change in the commit message. :)
Maybe it's still a WIP, but there's a few important things I've noted in-line.
| // crashed after adding the finalizer but before updating the status. | ||
| for _, secretName := range []string{ | ||
| instance.Status.ApplicationCredentialSecret, | ||
| instance.Spec.Auth.ApplicationCredentialSecret, |
There was a problem hiding this comment.
Where is Auth coming from? The HeatSpec doesn't have a Auth defined. Should this change also be adding Auth?
There was a problem hiding this comment.
Hi @bshephar! Thanks for reviewing.
Auth comes from HeatTemplate (embedded inline in HeatSpecBase -> HeatSpec), defined in common_types.go https://github.com/openstack-k8s-operators/heat-operator/blob/main/api/v1beta1/common_types.go#L63 . So, it already comes from earlier change.
There was a problem hiding this comment.
I think my fork was out of sync. Yeah, I see it there, my bad.
| if instance.Spec.Auth.ApplicationCredentialSecret != "" || instance.Status.ApplicationCredentialSecret != "" { | ||
| if err := keystonev1.ManageACSecretFinalizer(ctx, helper, instance.Namespace, | ||
| instance.Spec.Auth.ApplicationCredentialSecret, | ||
| instance.Status.ApplicationCredentialSecret, |
There was a problem hiding this comment.
Just a note that Status.ApplicationCredentialSecret is set to omitempty, so if this is undefined for any reason, you will be passing nil here which could end up with nil pointer deref issues. I would either check that instance.Status.ApplicationCredentialSecret != nil before doing this, or if you think it will always be set, remove the omitempty from the Status field?
There was a problem hiding this comment.
ApplicationCredentialSecret is a string type, so its zero value is "", not nil, as far as I see there's no nil pointer dereference risk here. And the != "" check on the line above already guards against passing an empty string to the finalizer function
|
@bshephar: changing LGTM is restricted to collaborators 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 kubernetes-sigs/prow repository. |
60522f3 to
4e9ab56
Compare
|
Build failed (check pipeline). Post ✔️ openstack-k8s-operators-content-provider SUCCESS in 1h 56m 15s |
4e9ab56 to
32c942f
Compare
|
Build failed (check pipeline). Post ❌ openstack-k8s-operators-content-provider FAILURE in 4m 09s |
|
/test heat-operator-build-deploy-kuttl |
|
recheck |
Heat now tracks which AC secret it is consuming via Status.ApplicationCredentialSecret and manages the openstack.org/heat-ac-consumer finalizer on that secret. This ensures keystone-operator does not prematurely revoke the application credential while Heat is still using it. On rotation (when the spec reference changes), the finalizer is moved from the old secret to the new one. On Heat CR deletion, the finalizer is cleaned up from all referenced secrets. Signed-off-by: Veronika Fisarova <vfisarov@redhat.com>
32c942f to
422f1b9
Compare
|
Following the discussion in watcher-operator the AC finalizer management is now split into two phases:
This prevents a race condition where rapid AC rotations could revoke credentials still in use by running pods. The new file |
Jira: OSPRH-29269
Application Credential dev-doc: https://github.com/openstack-k8s-operators/dev-docs/blob/main/application_credentials.md
Status.ApplicationCredentialSecretopenstack.org/heat-ac-consumerfinalizer to the AC secret after service config is renderedThis ensures that the keystone-operator cannot revoke a rotated AC secret while Heat is still consuming it.
Depends-On: openstack-k8s-operators/keystone-operator#685
Assisted-by: Claude Opus 4.6 noreply@anthropic.com