Skip to content
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

controllers: add option to disable key rotation #249

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

black-dragon74
Copy link
Contributor

This PR allows an user to annotate the storageclaim with keyrotation.csiaddons.openshift.io/enable=false to disable key rotation for the RBD storageclasses.

This PR allows an user to annotate the storageclaim
with `keyrotation.csiaddons.openshift.io/enable=false`
to disable key rotation for the RBD storageclasses.

Signed-off-by: Niraj Yadav <[email protected]>
Copy link

openshift-ci bot commented Oct 1, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: black-dragon74
Once this PR has been reviewed and has the lgtm label, please assign leelavg for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@@ -397,6 +398,10 @@ func (r *StorageClaimReconciler) reconcilePhases() (reconcile.Result, error) {
storageClass = r.getCephFSStorageClass(data)
} else if resource.Name == "ceph-rbd" {
storageClass = r.getCephRBDStorageClass(data)

if enable, ok := r.storageClaim.GetAnnotations()[keyRotationEnableAnnotation]; ok && enable != "true" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this ann. value supports anything other than true/false? why to check for a negation, like why not ann[key] == "false" ? set-false

if the value is "true"/"false" then it can be directly used, isn't it?
utils.AddAnnotation(storageClass, keyRotationEnableAnnotation, r.storageClaim.GetAnnotations()[keyRotationEnableAnnotation])

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it does not support any other value than true/false, values other than true are considered false. I have no good reason on why it cannot be used directly (as it will be parsed in csi-addons anyways)

The reason I did not do it such way is to avoid setting it unconditionally because in utils.AddAnnotation we set the value even if it is empty. Want me to change it?

Also, while we are at it, should I update the code to update the SC by patching it instead of deleting and recreating in case the annotations differ? Would be a little efficient IG?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want me to change it?

  • No, annotation w/ an empty value is also a valid identifier, let's not change it

Also, while we are at it, should I update the code to update the SC by patching it instead of deleting and recreating in case the annotations differ? Would be a little efficient IG?

  • these values converge easily in a couple of reconciles and a patch here makes less difference.
  • Nevertheless will revisit when VolumeAttributes (Madhu mentioned it once) feature which helps in storageclass having almost static data.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • No, annotation w/ an empty value is also a valid identifier, let's not change it

I meant changing the current pr aka my change-set to add annotation unconditionally :)

I am still leaning towards adding the annotation only when its value is not truthy.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • these values converge easily in a couple of reconciles and a patch here makes less difference.

Would you please explain it to me? Acc to my understanding we would be deleting and recreating the SC in case annotations differ. That is two different actions while patching the annotations on an existing SC will not disrupt any operations and is one shot.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in case annotations differ

  • yes, I mean these doesn't change often, isn't it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct.

@nb-ohad
Copy link
Contributor

nb-ohad commented Oct 6, 2024

/hold

@nb-ohad
Copy link
Contributor

nb-ohad commented Oct 6, 2024

@black-dragon74
To the best of my understanding, Key rotation controls are storage admin controls. StoargeClaim is not a storage admin-owned CR. It is a CR intended to be used by the application owner and I believe the key rotation control should not be managed by the application owner.

In addition, we are phasing out the StorageClaim CR as a concept, so we should not change/add any new nob on that CR

@iPraveenParihar
Copy link
Member

@black-dragon74 To the best of my understanding, Key rotation controls are storage admin controls. StoargeClaim is not a storage admin-owned CR. It is a CR intended to be used by the application owner and I believe the key rotation control should not be managed by the application owner.

In addition, we are phasing out the StorageClaim CR as a concept, so we should not change/add any new nob on that CR

@nb-ohad, Initially, for the ReclaimSpace disable option we planned to implement on the StorageRequest CR, but IIRC from our last meeting, we agreed to use annotations on the StorageClaim CR for now because we don't have mechanism to pass annotations from the StorageRequest CR to the StorageClass created in the client cluster.
And same approach was decided to be followed for key rotation disable option.

cc @Madhu-1

@openshift-merge-robot
Copy link

PR needs rebase.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants