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

annotate storageconsumer with deployed mode and local to cluster #3068

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

Conversation

leelavg
Copy link
Contributor

@leelavg leelavg commented Feb 27, 2025

this is intended for a backport to older release for configuring storageconsumer with all the details helping in convergence.

annotated details are
running mode: provider/internal (ceph resources among others can be calculated based on this)
consumer type: local (helps webhook to take the storageconsumer UID for defaulting multiple fields in storageclass)

with these details already mentioned in storageconsumer, the corresponding controller would branch out and owns existing resources.

@leelavg leelavg changed the title update storageconsumer spec with ceph storage details and annotate running mode annotate storageconsumer with deployed mode and local to cluster Feb 28, 2025
@leelavg leelavg force-pushed the old-cons branch 3 times, most recently from 40ccc42 to dad66a1 Compare February 28, 2025 10:48

func (s *storageConsumer) ensureCreated(r *StorageClusterReconciler, storageCluster *ocsv1.StorageCluster) (ctrl.Result, error) {
storageConsumer := &ocsv1a1.StorageConsumer{}
storageConsumer.Name = localStorageConsumerName
Copy link
Member

Choose a reason for hiding this comment

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

We need to make sure that we are not creating this in 4.18 provider mode clusters

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.


var _ resourceManager = &storageConsumer{}

const localStorageConsumerName = "storageconsumer-local"
Copy link
Member

Choose a reason for hiding this comment

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

CR name is already storageConsumer, cant we use local?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

@@ -345,6 +353,25 @@ func (r *StorageRequestReconciler) reconcilePhases() (reconcile.Result, error) {
r.StorageRequest.Status.Phase = v1alpha1.StorageRequestReady
}

clusterID := util.GetClusterID(r.ctx, r.Client, &r.log)
Copy link
Member

Choose a reason for hiding this comment

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

Can you please add a comment of this change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

Comment on lines 365 to 367
} else {
return reconcile.Result{}, fmt.Errorf("failed to get cluster id")
}
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 if else, fail early if the clusterID is empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

@nb-ohad
Copy link
Contributor

nb-ohad commented Mar 2, 2025

/hold
We never decided that ODF will be the one to add the annotation.
And for the fact that we are using annotations and not CR fields it might be that we don't need any sort of backport at all

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 2, 2025
Comment on lines +21 to +31
storageConsumer.Namespace = storageCluster.Namespace
if _, err := controllerutil.CreateOrUpdate(r.ctx, r.Client, storageConsumer, func() error {
if err := controllerutil.SetControllerReference(storageCluster, storageConsumer, r.Scheme); err != nil {
return err
}

// TODO: OldModeAnnotation should be removed after convergence
util.AddAnnotation(storageConsumer, defaults.StorageConsumerOldModeAnnotation, defaults.StorageConsumerOldModeInternal)
util.AddAnnotation(storageConsumer, defaults.StorageConsumerTypeAnnotation, defaults.StorageConsumerTypeLocal)
return nil
}); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't use a create or update in this case. You intent is to update only and ignore not found errors

Copy link
Contributor Author

Choose a reason for hiding this comment

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

need more discussion on this based on who owns the creation of storageconsumer.

@leelavg
Copy link
Contributor Author

leelavg commented Mar 3, 2025

/hold We never decided that ODF will be the one to add the annotation. And for the fact that we are using annotations and not CR fields it might be that we don't need any sort of backport at all

  • creation of storageconsumer should be avoided if it is an upgraded internal cluster, we need a marker for that
  • for provider mode we anyways need the marker to distinguish which ceph resources exists are to be created

Copy link
Contributor

openshift-ci bot commented Mar 3, 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 ask for approval from nb-ohad. 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

@leelavg
Copy link
Contributor Author

leelavg commented Mar 5, 2025

/hold

will squash after final review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants