-
Notifications
You must be signed in to change notification settings - Fork 185
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
base: main
Are you sure you want to change the base?
Conversation
40ccc42
to
dad66a1
Compare
Signed-off-by: Leela Venkaiah G <[email protected]>
|
||
func (s *storageConsumer) ensureCreated(r *StorageClusterReconciler, storageCluster *ocsv1.StorageCluster) (ctrl.Result, error) { | ||
storageConsumer := &ocsv1a1.StorageConsumer{} | ||
storageConsumer.Name = localStorageConsumerName |
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.
We need to make sure that we are not creating this in 4.18 provider mode clusters
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.
done.
|
||
var _ resourceManager = &storageConsumer{} | ||
|
||
const localStorageConsumerName = "storageconsumer-local" |
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.
CR name is already storageConsumer, cant we use local
?
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.
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) |
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.
Can you please add a comment of this change
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.
done.
} else { | ||
return reconcile.Result{}, fmt.Errorf("failed to get cluster id") | ||
} |
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.
instead of if else, fail early if the clusterID is empty?
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.
done.
/hold |
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 { |
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.
Don't use a create or update in this case. You intent is to update only and ignore not found errors
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.
need more discussion on this based on who owns the creation of storageconsumer.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: leelavg 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 |
Signed-off-by: Leela Venkaiah G <[email protected]>
/hold will squash after final review |
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.