-
Notifications
You must be signed in to change notification settings - Fork 155
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
New functions to pre-provision VolumeSnapshot and VolumeSnapshotContent #1282
Conversation
8892549
to
13ba0c6
Compare
@pavannd1 @viveksinghggits While writing my test Also, some existing functions defined their own required arguments that duplicate these resource metadata, and their code don't read from the |
@ihcsim does that mean the |
94d1fe5
to
a71e075
Compare
snapshotClass should be non-mandantory. Kubernetes picks the default if nothing is specified. Apart from that, the functions work like a charm! Thank you so much for implementing them so fast! ❤️ |
Yeah, we have some existing code that check for the existence of the snapshotClass. Since they go all the way back to v1alpha1 of the CRD, I am a bit hesitant to refactor them in this PR. AIUI, a default snapshot class is only set if one of the classes is annotated with |
…tions The new 'create' function allows user to pre-provision a pair of VolumeSnapshot and VolumeSnapshotContent resources, which aren't associated with any existing PersistentVolumeClaim resource. See https://kubernetes.io/docs/concepts/storage/volume-snapshots/ for the difference between dynamic and pre-provisioned snapshots. Signed-off-by: Ivan Sim <[email protected]>
Signed-off-by: Ivan Sim <[email protected]>
Signed-off-by: Ivan Sim <[email protected]>
Signed-off-by: Ivan Sim <[email protected]>
Signed-off-by: Ivan Sim <[email protected]>
Co-authored-by: Pavan Navarathna <[email protected]>
Co-authored-by: Pavan Navarathna <[email protected]>
Signed-off-by: Ivan Sim <[email protected]>
Signed-off-by: Ivan Sim <[email protected]>
7c7657c
to
4ff88c0
Compare
Signed-off-by: Ivan Sim <[email protected]>
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.
LGTM
Change Overview
This PR adds two new functions to manage CSI volume snapshots and snapshot contents:
CreateCSISnapshotStatic
- create a pre-provisionedVolumeSnapshot
/VolumeSnapshotContent
resource pairsDeleteCSISnapshotContent
- deleteVolumeSnapshotContent
resources.For more information on how the pre-provisioned snapshots are different from those created with PVCs, see the Kubernetes documentation here.
This PR is a follow-up on #1246, where we had decided not to extend the existing
KubeOps
function to delete cluster-scoped resources likeVolumeSnapshotContent
, to avoid misuses.Pull request type
Please check the type of change your PR introduces:
Issues
See #1246 (comment).
Test Plan
These test steps require the following 3rd party components to be installed on the Kubernetes cluster:
Create the following blueprint:
Use this
ActionSet
resource to create the static resources:Confirm that the resources are created:
The resource deletion behaviour is defined by the
deletionPolicy
of thesnapshotClass
of the snapshot.Since by default, the
csi-hostpath-snapclass
snapshot class uses theDelete
policy, deleting theVolumeSnapshot
will also delete theVolumeSnapshotContent
:Change the
deletionPolicy
of the snapshot class toRetain
:Recreate the
VolumeSnapshot
andVolumeSnapshotContent
resources.With the
Retain
policy, deleting theVolumeSnapshot
will not delete theVolumeSnapshotContent
:To delete the unbounded
VolumeSnapshotContent
, create anActionSet
to invoke the newDeleteCSISnapshotContent
function:Deleting a bounded
VolumeSnapshotContent
has no effects, as the resource would be protected by the CSI controller: