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

onboard a client onto already created storageconsumer based on token #3075

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

leelavg
Copy link
Contributor

@leelavg leelavg commented Mar 10, 2025

storageconsumer controllers creates a secret for user to be mentioned in storageclient for onboarding onto that specific storageconsumer. Until the storageconsumer is enabled, deletion of secret is considered as rotation of token.

Onboarding adds the supplied ticket to the storageconsumer as annotation as the linking b/n the storageclient to storageconsumer.

Copy link
Contributor

openshift-ci bot commented Mar 10, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: leelavg
Once this PR has been reviewed and has the lgtm label, please assign blaineexe for approval. For more information see the 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

Comment on lines +138 to +148
// get the consumer corresponding to this ticket
storageConsumerList := &ocsv1alpha1.StorageConsumerList{}
if err := s.client.List(ctx, storageConsumerList, client.InNamespace(s.namespace)); err != nil {
klog.Errorf("failed to get storageconsumers in the namespace: %v", err)
return nil, status.Errorf(codes.Internal, "failed to get storageconsumers. %v", err)
} else if len(storageConsumerList.Items) < 1 {
return nil, status.Errorf(codes.FailedPrecondition, "no storageconsumers exist in the namespace")
}

consumerName := ""
for idx := range storageConsumerList.Items {
Copy link
Member

Choose a reason for hiding this comment

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

Instead of fetching each consumer, getting the secret attached and comparing the onboarding ticket in the secret, why not add the consumer name to the onboarding ticket struct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we could do that after a small discussion as it implies the token will be applicable only to the specific storageconsumer.

@@ -135,11 +139,50 @@ func (r *StorageConsumerReconciler) initReconciler(request reconcile.Request) {

func (r *StorageConsumerReconciler) reconcilePhases() (reconcile.Result, error) {

secret := &corev1.Secret{}
secret.Name = r.storageConsumer.Name
Copy link
Member

Choose a reason for hiding this comment

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

Should we add an annotation to storageConsumer that points to the onboarding ticket secret for that conusmer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the intention was to have the same name for consumer & secret, didn't get your suggestion.

Comment on lines +200 to +201
err = fmt.Errorf("storageconsumers.ocs.openshift.io %s already exists", storageConsumer.Name)
return nil, status.Errorf(codes.AlreadyExists, "failed to onboard on storageConsumer resources. %v", err)
Copy link
Member

Choose a reason for hiding this comment

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

Since we are not creating the consumer anymore in this rpc, could we update the err message to be something more meaningful like "storageconsumer already has a client attached to it"?

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

Successfully merging this pull request may close these issues.

2 participants