-
Notifications
You must be signed in to change notification settings - Fork 270
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
fix: Use storage class from annotation for host-assisted PVC operation #3585
base: main
Are you sure you want to change the base?
fix: Use storage class from annotation for host-assisted PVC operation #3585
Conversation
modify the `getStorageClassCorrespondingToSnapClass` function to use the storage class from the annotation for host-assisted PVC operations. Fixes: kubevirt#3530 Signed-off-by: Sibasish Behera <[email protected]>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
cc: @akalenyu |
Thank you for the PR! 🙏 What do you think about capturing the mapping between the volumesnapshotclass->storageclass |
@TheRealSibasishBehera: The following tests failed, say
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
@@ -450,7 +450,12 @@ func (r *SnapshotCloneReconciler) createTempHostAssistedSourcePvc(dv *cdiv1.Data | |||
return nil | |||
} | |||
|
|||
func (r *SnapshotCloneReconciler) getStorageClassCorrespondingToSnapClass(driver string) (string, error) { | |||
func (r *SnapshotCloneReconciler) getStorageClassCorrespondingToSnapClass(dv *cdiv1.DataVolume, driver string) (string, error) { |
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.
So this only covers the non-CSI path (initLegacyClone
), I assume you're more interested in the CSI one?
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 changes I made are for cases where TempHostAssistedSourcePvc is created, i.e., the csi driver is not present, or the csi driver for the source and target is mismatched. IIRC both are triggered by initLegacyClone . the first one is my use case
happy to work on any similar cases. Are you referring to the remaining case, which is the csi driver for target pvc and snapshot match? It tries for a direct snapshot to target pvc restore , but it fails because of a csi incompatibility issue ?
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.
Oh right, I forgot the issue details. Let me stress again that what you're describing is very unusual today
the csi driver is not present
It tries for a direct snapshot to target pvc restore , but it fails because of a csi incompatibility issue ?
Yes, here's a ref to this path
func getStorageClassNameForTempSourceClaim(ctx context.Context, vsc *snapshotv1.VolumeSnapshotContent, client client.Client) (string, error) { |
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.
Thanks! I will work on this
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.
So just to poke at the setup a little bit again, the provisioner has VolumeSnapshots support (which I thought implies it's CSI) but there's no CSIDriver object?
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, that's the case. The provisioner is openebs mayastor The deployment manifest does not contain a
CSIDriver
packaged withinThat sounds unintended, how would you then configure things like
fsGroupPolicy
? https://kubernetes-csi.github.io/docs/support-fsgroup.html
These are filled in as parameters for the storage class (not exactly the same names but similar functionality that made it possible before GA, I believe). I have confirmed with their community that they do not have a CSIDriver
.
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.
wdyt think about also using pv.spec.CSI since it is directly populated in when using a csi driver
I don't think it's possible since a PV does not exist at the time CDI is interested in this
so its not evaluated on fly for each dv/pvc ?
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 don't understand the motivation to avoid a CSIDriver object.. AFAIK it's a requirement https://kubernetes-csi.github.io/docs/csi-driver-object.html
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.
wdyt think about also using pv.spec.CSI since it is directly populated in when using a csi driver
I don't think it's possible since a PV does not exist at the time CDI is interested in this
so its not evaluated on fly for each dv/pvc ?
It's evaluated prior to PVC creation to understand if we can use populators
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 don't understand the motivation to avoid a CSIDriver object.. AFAIK it's a requirement https://kubernetes-csi.github.io/docs/csi-driver-object.html
Yeah I agree it’s a standard and should be supported 😞
This seems like a case of delayed adoption to me, as it used to work without it
Yes it sounds good that the configuration can be set once . If I understand correctly, we would refer to the VolumeSnapshotClass from the source snapshot during restores. However, I am wondering about the scenario where the VolumeSnapshotClass is deleted after the snapshot is created. In such case we cant refer to the appropriate storageclass used in VolumeSnapshotClass annotation |
I think that is either unlikely or impossible when a snapshot that was provisioned by it still exists |
Got it, I’ll update the implementation Also, do you think this ability needs to be documented anywhere? |
Yes, feel free to drop a hint at
|
Just realized we already have a mechanism to tie storageclass->snapclass via #2898 so we could just use this instead of an annotation? |
This would not work if we check the status. If multiple StorageProfiles have the same snapshot class (e.g., because it is set as the default or is the first in a sorted list), we might end up picking a storage class(say the first one in loop over storageprofiles with vsc == sourceSnap.vsc ) which is not intentionally set by the admin and is incompatible we can check the spec for this, as it is user-defined. This way, we can trust that the storage class and snapshot class are compatible as a pair, and the selection is not arbitrary |
I'm afraid that would suffer from the same issue where two profiles point to the same volumesnapshotclass |
What this PR does / why we need it:
modify the
getStorageClassCorrespondingToSnapClass
function to use the storage class from the annotation for host-assisted PVC operations.Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #3530
Special notes for your reviewer:
Release note: