Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: shirady 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 |
|
leelavg
left a comment
There was a problem hiding this comment.
didn't review the controller yet as pr is in draft.
| &nbv1.ObjectBucketClaim{}: { | ||
| Namespaces: map[string]cache.Config{corev1.NamespaceAll: {}}, | ||
| }, |
There was a problem hiding this comment.
even the returned OB/Secret/Configmap should be watched in other namespaces, isn't it?
There was a problem hiding this comment.
The secret and config map should be watched in other namespaces as well, yes -I added the change.
OB is cluster-scoped, so I didn't change.
a8fa7f2 to
d7c518a
Compare
From what I understand from @nb-ohad for testing we can install the CRD that we need.
Yes, you are correct. We would need to make changes. As we didn't want to be blocked at this point, it was suggested that we add the finalizer for testing purposes. |
159612a to
622dfff
Compare
e1d0de3 to
2f407e5
Compare
|
@leelavg @rewantsoni, Please take a look |
| if err := r.Get(r.ctx, types.NamespacedName{Name: ownerRef.Name}, storageClient); err != nil { | ||
| return nil, fmt.Errorf("get StorageClient %q (owner of StorageClass %q): %w", ownerRef.Name, storageClassName, err) | ||
| } | ||
| if storageClient.Status.ConsumerID == "" || storageClient.Spec.StorageProviderEndpoint == "" { |
There was a problem hiding this comment.
Maybe check if storageClient is onboarded or not. If onboarding succeeded, we should have the consumerUID and the storageProviderEndpoint as well
There was a problem hiding this comment.
Do you mean to check if the phase is StorageClientConnected?
But it is not the same as checking those fields, from what I see.
For example, when there was an issue in the cluster:
phase: Initializingoc get storageclient storage-client-2202 -o json | jq .spec.storageProviderEndpoint(output with value)oc get storageclient storage-client-2202 -o json | jq .status.consumerIDnull
The storage client was successfully onboarded in the past.
If I check the phase, it will not be able to create OBCs...
There was a problem hiding this comment.
If the storageClient is not Onboarding, we shouldn't be performing any calls
There was a problem hiding this comment.
The storageClient is onboarded.
In this example, an unrelated issue caused the phase to change to Initializing.
@rewantsoni Would you like me to remove this condition, or do you have another suggestion?
There was a problem hiding this comment.
And I don't think we should be having this check here; this should only return the Storage Client
There was a problem hiding this comment.
I am trying to think of a case where the Client will be Connected, but the consumer UID will be empty 🤔
There was a problem hiding this comment.
Probably would not happen, it is set as the last step in onboarding.
Signed-off-by: shirady <57721533+shirady@users.noreply.github.com>
Signed-off-by: shirady <57721533+shirady@users.noreply.github.com>
Signed-off-by: shirady <57721533+shirady@users.noreply.github.com>
Signed-off-by: shirady <57721533+shirady@users.noreply.github.com>
2f407e5 to
d45478a
Compare
Signed-off-by: shirady <57721533+shirady@users.noreply.github.com>
d45478a to
5d62d88
Compare
Signed-off-by: shirady <57721533+shirady@users.noreply.github.com>
Signed-off-by: shirady <57721533+shirady@users.noreply.github.com>
Signed-off-by: shirady <57721533+shirady@users.noreply.github.com>
Signed-off-by: shirady <57721533+shirady@users.noreply.github.com>
Signed-off-by: shirady <57721533+shirady@users.noreply.github.com>
Signed-off-by: shirady <57721533+shirady@users.noreply.github.com>
| "sigs.k8s.io/controller-runtime/pkg/client" | ||
| "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" | ||
| "sigs.k8s.io/controller-runtime/pkg/predicate" | ||
| "sigs.k8s.io/controller-runtime/pkg/reconcile" |
There was a problem hiding this comment.
Please format the imports as
standard
pkg
others
There was a problem hiding this comment.
Thanks, I'll look again.
| err := r.Get(r.ctx, req.NamespacedName, obc) | ||
| if err != nil { |
| if err != nil { | ||
| r.log.Error(err, "failed to get StorageClient for OBC create") | ||
| obc.Status.Phase = ObjectBucketClaimStatusPhaseFailed | ||
| if statusErr := r.Client.Status().Update(r.ctx, obc); statusErr != nil { |
There was a problem hiding this comment.
It would be good if have status updates from a single place. Can you split reconcile into reconcile and reconcilePhases, and update the status towards the end of the reconcile similar to what we are doing for storageclient controller?
There was a problem hiding this comment.
I tried to refactor it so we will have the reconcile function, reconcilePhases function (and more functions called inside it), and update the status toward the end of the reconcile.
My only concern with this change is a race condition between the status update and the "Bound" that is patched from outside.
Therefore, I tried to status was saved, and the update will be called only if it was changed (and it changes to Failed only in the creation/update flow).
| if err := r.Get(r.ctx, types.NamespacedName{Name: ownerRef.Name}, storageClient); err != nil { | ||
| return nil, fmt.Errorf("get StorageClient %q (owner of StorageClass %q): %w", ownerRef.Name, storageClassName, err) | ||
| } | ||
| if storageClient.Status.ConsumerID == "" || storageClient.Spec.StorageProviderEndpoint == "" { |
There was a problem hiding this comment.
And I don't think we should be having this check here; this should only return the Storage Client
…rEndpoint Signed-off-by: shirady <57721533+shirady@users.noreply.github.com>
Signed-off-by: shirady <57721533+shirady@users.noreply.github.com>
Signed-off-by: shirady <57721533+shirady@users.noreply.github.com>
like in storage client controller Signed-off-by: shirady <57721533+shirady@users.noreply.github.com>
Signed-off-by: shirady <57721533+shirady@users.noreply.github.com>
Signed-off-by: shirady <57721533+shirady@users.noreply.github.com>
Describe the problem
Part of RHSTOR-6230
Continue of PRs red-hat-storage/ocs-operator#3692 by calling the Notify when an OBC is created and deleted.
Explain the changes
Note: to avoid direct import of lib-bucket-provision, I had to add them manually.
In case we decide to import it directly, it can be in the same style as others.
Notify.Notes:
Failed.Pending.ownerReferencesfrom the storageclass.Notifyand remove finalizer.make manifestsandmake bundle.Testing Instructions:
Manual Test:
kubectl apply -f ./noobaa-operator/deploy/obc/objectbucket.io_objectbucketclaims_crd.yamlownerReferencesof the storage client (you can copy from another storage class on the cluster) manually with a temp finalizer (else it is deleted).Example of storage class:
Example of OBC:
Note: OBC can be created in any namespace, if you want to test on another namespace - create the namespace (
kubectl create ns <namespacename>) and change thenamespacevalue in the yaml.Boundphase.Since we do not have the copy mechanism implemented yet, we would test only OBC deletin (without additional resources):
a. Install the OB CRD (
kubectl apply -f noobaa-operator/deploy/obc/objectbucket.io_objectbuckets_crd.yaml)b. Change the clusterRole (use Ai generated file from the kubebuilder marks).