-
Notifications
You must be signed in to change notification settings - Fork 184
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
add VolumeGroupSnapshotClass for CephFS and RBD #2859
base: main
Are you sure you want to change the base?
add VolumeGroupSnapshotClass for CephFS and RBD #2859
Conversation
acdabd0
to
de40e7b
Compare
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.
disable bool | ||
} | ||
|
||
var driverName, driverValue string |
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.
any specific to have global variable?
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.
No, changing them to local variables.
break | ||
} | ||
|
||
r.Log.Info("Uninstall: Deleting GroupSnapshotClass.", "GroupSnapshotClass", klog.KRef(existing.Namespace, existing.Name)) |
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 dont need to log Namespace for groupsnapshot as its a cluster scoped resouces
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.
This is applicable for all the places where we are logging the groupsnapshot name
|
||
vsc := vscc.groupSnapshotClass | ||
existing := &groupsnapapi.VolumeGroupSnapshotClass{} | ||
err := r.Client.Get(context.TODO(), types.NamespacedName{Name: vsc.Name, Namespace: vsc.Namespace}, existing) |
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 context.TODO use the context inside StorageClusterReconciler r.ctx
case errors.IsNotFound(err): | ||
r.Log.Info("Uninstall: GroupSnapshotClass not found, nothing to do.", "GroupSnapshotClass", klog.KRef(sc.Namespace, sc.Name)) | ||
default: | ||
r.Log.Error(err, "Uninstall: Error while getting GroupSnapshotClass.", "GroupSnapshotClass", klog.KRef(sc.Namespace, sc.Name)) |
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.
dont we need to retry if there is any deletion error? i see we are returning nil at the end of this function.
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.
Yes adding that in the switch case
@@ -186,6 +188,7 @@ func (r *StorageRequestReconciler) SetupWithManager(mgr ctrl.Manager) error { | |||
Watches(&rookCephv1.CephClient{}, enqueueForOwner). | |||
Watches(&storagev1.StorageClass{}, enqueueStorageConsumerRequest). | |||
Watches(&snapapi.VolumeSnapshotClass{}, enqueueStorageConsumerRequest). | |||
Watches(&groupsnapapi.VolumeGroupSnapshotClass{}, enqueueStorageConsumerRequest). |
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.
i think we dont need snapshot,groupsnapshot,pv,storageclass permission in storagerequest_controller. @leelavg can you please confirm it?
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.
hmm, I didn't get the GH notification 🤔. Anyways, yes, we don't watch for these resources and need the struct to be encoded in gRPC response.
Just rechecked existing code and I don't think anything necessary for provider mode. do we need more info than below inaddition to changes to storageclaimcontroller in https://github.com/red-hat-storage/ocs-client-operator/pull/168/files?
ocs-operator/services/provider/server/server.go
Lines 730 to 735 in 1ea3ed4
&pb.ExternalResource{ | |
Name: "ceph-rbd", | |
Kind: "VolumeGroupSnapshotClass", | |
Data: mustMarshal(map[string]string{ | |
"csi.storage.k8s.io/group-snapshotter-secret-name": provisionerSecretName, | |
})}, |
}, | ||
Driver: generateNameForSnapshotClassDriver(SnapshotterType(groupSnaphotterType)), | ||
Parameters: map[string]string{ | ||
"clusterID": instance.Namespace, |
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.
where are we setting filesystem name and blockpool in the class?
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.
it is set by the driverName
and driverValue
variables whose values are assigned by the setParameterBasedOnSnapshotterType
function.
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.
Right, this confused me a bit too, it is well hidden. driverName
is not really a very suitable name, as the parameter is called fsName
for CephFS or pool
for RBD. But, I expect this to work correctly. Having a test that validates these kind of parameters would be nice to have.
See kubernetes-csi/external-snapshotter#1150 for the BETA status PR. |
we might need to have a VGSC CRD check as ocs-operator 4.18 needs to run on OCP 4.16 without any problem for EUS to EUS upgrade? @iamniting @Nikhil-Ladha thoughts? |
return "ms_mode=secure" | ||
} | ||
|
||
// If Encryption is not enabled, but Compression or RequireMsgr2 is enabled, use prefer-crc mode | ||
if sc.Spec.Network != nil && sc.Spec.Network.Connections != nil && | ||
((sc.Spec.Network.Connections.Compression != nil && sc.Spec.Network.Connections.Compression.Enabled) || | ||
sc.Spec.Network.Connections.RequireMsgr2) { | ||
return "ms_mode=prefer-crc" | ||
} | ||
|
||
// Network spec always has higher precedence even in the External or Provider cluster. so they are checked first above | ||
|
||
// None of Encryption, Compression, RequireMsgr2 are enabled on the StorageCluster | ||
// If it's an External or Provider cluster, We don't require msgr2 by default so no mount options are needed | ||
if sc.Spec.ExternalStorage.Enable || sc.Spec.AllowRemoteStorageConsumers { | ||
return "ms_mode=legacy" | ||
} | ||
// If none of the above cases apply, We set RequireMsgr2 true by default on the cephcluster | ||
// so we need to set the mount options to prefer-crc | ||
// If encryption is not enabled, use prefer-crc mode |
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.
I think this auto-generated file change is already merged, please rebase your PR once to fix this.
Yep, as going forward the plan will be updgrade ODF first, it is advisable to have these checks in place for new changes. |
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.
Break the PR into multiple commits, where as keep the generated changes into 1 commit, and the code changes into another.
I agree we should have such checks, But let's not use |
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.
Pls have a generated changes in the separate commit.
de40e7b
to
be56914
Compare
3ec52f3
to
6c2c34e
Compare
6c2c34e
to
1a7d990
Compare
I have added a plain check for VGSC CRD as well. Please do review it. @Madhu-1 @iamniting @Nikhil-Ladha |
if vgsc { | ||
objs = append(objs, &ocsGroupSnapshotClass{}) | ||
} |
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.
The check should be inside the ensure funcs not here.
@@ -244,6 +245,7 @@ func (r *StorageClusterReconciler) SetupWithManager(mgr ctrl.Manager) error { | |||
). | |||
Watches(&storagev1.StorageClass{}, enqueueStorageClusterRequest). | |||
Watches(&volumesnapshotv1.VolumeSnapshotClass{}, enqueueStorageClusterRequest). | |||
Watches(&volumegroupsnapshotv1a1.VolumeGroupSnapshotClass{}, enqueueStorageClusterRequest). |
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 can make use of available CRD feature as we are watching the resource.
6379d30
to
71316e5
Compare
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 pls fix tests?
71316e5
to
7b37de4
Compare
CSI-drivers requires VolumeGroupSnapshotClass for VolumeGroupSnapshot. Signed-off-by: ShravaniVangur <shravanivangur@gmail.com>
Contains generated files for vgsc. Signed-off-by: ShravaniVangur <shravanivangur@gmail.com>
7b37de4
to
5a66a16
Compare
}, | ||
Driver: generateNameForSnapshotClassDriver(SnapshotterType(groupSnaphotterType)), | ||
Parameters: map[string]string{ | ||
"clusterID": instance.Namespace, |
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.
Right, this confused me a bit too, it is well hidden. driverName
is not really a very suitable name, as the parameter is called fsName
for CephFS or pool
for RBD. But, I expect this to work correctly. Having a test that validates these kind of parameters would be nice to have.
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: nixpanic, ShravaniVangur 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 |
Testing creation of VolumeGroupSnapshotClass and related functionalities: