Skip to content
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

Support annotation in VolumeSnapshot and VolumeSnapshotContent resources #2986

Merged
merged 28 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4bc7da9
WIP
saima-s Jul 17, 2024
43c1170
fix test and support annotation
saima-s Jul 17, 2024
dac2180
Add test for annotation support
saima-s Jul 23, 2024
42fe44a
Removed annotation support from kanister functions
saima-s Jul 23, 2024
98e0ef1
Removed annotation support from test
saima-s Jul 23, 2024
c3865d5
added logs
saima-s Jul 25, 2024
679a7ca
removed logs and fix linter issue
saima-s Jul 25, 2024
fae441e
Merge branch 'master' into orange/saima/support-snapshot-annotation
saima-s Jul 25, 2024
2b9fe1c
add comment on method definition
saima-s Jul 25, 2024
e49bb8f
Merge remote-tracking branch 'origin/orange/saima/support-snapshot-an…
saima-s Jul 25, 2024
8f8efcf
update test comment
saima-s Jul 25, 2024
c5f136d
Merge branch 'master' into orange/saima/support-snapshot-annotation
saima-s Jul 25, 2024
216a9ef
Fixed review comments
saima-s Jul 26, 2024
e03ba27
Fixed review comment with new struct
saima-s Jul 30, 2024
a3b15cc
Renamed struct
saima-s Jul 30, 2024
e1de82f
Renamed unused fields
saima-s Jul 30, 2024
3de7196
fix linter goimport and added comments to functions.
saima-s Jul 30, 2024
5ed6db4
fix review comment
saima-s Jul 30, 2024
20f8818
add release notes and fix review comments
saima-s Aug 1, 2024
043d6a6
fix review comment
saima-s Aug 1, 2024
0a455e9
fix review comments
saima-s Aug 1, 2024
b27193d
Merge branch 'master' into orange/saima/support-snapshot-annotation
saima-s Aug 2, 2024
cbbe269
fix review comments for fixing comments
saima-s Aug 2, 2024
39a1f2f
fix release notes
saima-s Aug 2, 2024
1d6e2e3
Update pkg/kube/snapshot/types.go
saima-s Aug 5, 2024
3d62652
Merge branch 'master' into orange/saima/support-snapshot-annotation
saima-s Aug 5, 2024
a4f271e
fix review comment on test
saima-s Aug 5, 2024
1dc0df3
Merge branch 'master' into orange/saima/support-snapshot-annotation
saima-s Aug 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pkg/function/create_csi_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,12 @@ func (*createCSISnapshotFunc) Arguments() []string {
}

func createCSISnapshot(ctx context.Context, snapshotter snapshot.Snapshotter, name, namespace, pvc, snapshotClass string, wait bool, labels map[string]string) (*v1.VolumeSnapshot, error) {
if err := snapshotter.Create(ctx, name, namespace, pvc, &snapshotClass, wait, labels, nil); err != nil {
if err := snapshotter.Create(ctx, pvc, &snapshotClass, wait, metav1.ObjectMeta{
Name: name,
Namespace: namespace,
Labels: labels,
Annotations: nil,
}); err != nil {
saima-s marked this conversation as resolved.
Show resolved Hide resolved
return nil, err
}
vs, err := snapshotter.Get(ctx, name, namespace)
Expand Down
2 changes: 1 addition & 1 deletion pkg/function/create_csi_snapshot_static.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func createCSISnapshotStatic(
Driver: driver,
VolumeSnapshotClassName: snapshotClass,
}
if err := snapshotter.CreateFromSource(ctx, source, name, namespace, wait, nil, nil); err != nil {
if err := snapshotter.CreateFromSource(ctx, source, wait, metav1.ObjectMeta{Name: name, Namespace: namespace}, metav1.ObjectMeta{}); err != nil {
saima-s marked this conversation as resolved.
Show resolved Hide resolved
return nil, err
}

Expand Down
11 changes: 7 additions & 4 deletions pkg/function/delete_csi_snapshot_content_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,13 @@ func (testSuite *DeleteCSISnapshotContentTestSuite) TestDeleteCSISnapshotContent
VolumeSnapshotClassName: snapshotClassName,
}
err = fakeSnapshotter.CreateContentFromSource(ctx, source,
snapshotContentName,
snapshotName,
snapshotNamespace,
deletionPolicy, nil)
deletionPolicy, metav1.ObjectMeta{
Name: snapshotName,
Namespace: snapshotNamespace,
},
metav1.ObjectMeta{
Name: snapshotContentName,
})
saima-s marked this conversation as resolved.
Show resolved Hide resolved
c.Assert(err, IsNil)

gv := strings.Split(api.GroupVersion, "/")
Expand Down
6 changes: 5 additions & 1 deletion pkg/function/delete_csi_snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ func (testSuite *DeleteCSISnapshotTestSuite) TestDeleteCSISnapshot(c *C) {
_, err = fakeCli.CoreV1().PersistentVolumeClaims(testSuite.namespace).Create(ctx, originalPVC, metav1.CreateOptions{})
c.Assert(err, IsNil)

err = fakeSnapshotter.Create(ctx, testSuite.snapName, testSuite.namespace, testSuite.pvcName, &testSuite.volumeSnapshotClass, false, nil, nil)
err = fakeSnapshotter.Create(ctx, testSuite.pvcName, &testSuite.volumeSnapshotClass, false,
metav1.ObjectMeta{
Name: testSuite.snapName,
Namespace: testSuite.namespace,
})
saima-s marked this conversation as resolved.
Show resolved Hide resolved
c.Assert(err, IsNil)

vs, err := fakeSnapshotter.Get(ctx, testSuite.snapName, testSuite.namespace)
Expand Down
2 changes: 1 addition & 1 deletion pkg/function/restore_csi_snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (testSuite *RestoreCSISnapshotTestSuite) TestRestoreCSISnapshot(c *C) {
originalPVC := getOriginalPVCManifest(testSuite.pvcName, testSuite.storageClass)
createPVC(c, testSuite.namespace, originalPVC, fakeCli)

err = fakeSnapshotter.Create(ctx, testSuite.snapName, testSuite.namespace, testSuite.pvcName, &testSuite.volumeSnapshotClass, false, nil, nil)
err = fakeSnapshotter.Create(ctx, testSuite.pvcName, &testSuite.volumeSnapshotClass, false, metav1.ObjectMeta{Name: testSuite.snapName, Namespace: testSuite.namespace})
saima-s marked this conversation as resolved.
Show resolved Hide resolved
c.Assert(err, IsNil)

vs, err := fakeSnapshotter.Get(ctx, testSuite.snapName, testSuite.namespace)
Expand Down
41 changes: 22 additions & 19 deletions pkg/kube/snapshot/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ type Snapshotter interface {
CloneVolumeSnapshotClass(ctx context.Context, sourceClassName, targetClassName, newDeletionPolicy string, excludeAnnotations []string) error
// Create creates a VolumeSnapshot and returns it or any error happened meanwhile.
//
// 'name' is the name of the VolumeSnapshot.
// 'namespace' is namespace of the PVC. VolumeSnapshot will be crated in the same namespace.
// 'pvcName' is the name of the PVC of which we will take snapshot. It must be in the same namespace 'ns'.
// 'waitForReady' will block the caller until the snapshot status is 'ReadyToUse'.
// or 'ctx.Done()' is signalled. Otherwise it will return immediately after the snapshot is cut.
// 'labels' can also be addded to the volume snapshot.
// 'annotations' can also be addded to the volume snapshot.
Create(ctx context.Context, name, namespace, pvcName string, snapshotClass *string, waitForReady bool, labels map[string]string, annotations map[string]string) error
// snapshotMeta object has 'name' as name of the VolumeSnapshot.
// snapshotMeta object has 'namespace' as namespace of the PVC. VolumeSnapshot will be crated in the same namespace.
// snapshotMeta object has 'labels' that can also be addded to the volume snapshot.
// snapshotMeta object has 'annotations' that can also be addded to the volume snapshot.
saima-s marked this conversation as resolved.
Show resolved Hide resolved
Create(ctx context.Context, pvcName string, snapshotClass *string, waitForReady bool, snapshotMeta metav1.ObjectMeta) error
// Get will return the VolumeSnapshot in the namespace 'namespace' with given 'name'.
//
// 'name' is the name of the VolumeSnapshot that will be returned.
Expand All @@ -85,12 +85,13 @@ type Snapshotter interface {
//
// 'name' is the name of the VolumeSnapshot that will be cloned.
// 'namespace' is the namespace of the VolumeSnapshot that will be cloned.
// 'cloneName' is name of the clone.
// 'cloneNamespace' is the namespace where the clone will be created.
// 'waitForReady' will make the function blocks until the clone's status is ready to use.
// 'labels' is the labels to set on the created VSC
// 'annotations' is the annotation to set on the created VS and VSC
Clone(ctx context.Context, name, namespace, cloneName, cloneNamespace string, waitForReady bool, labels map[string]string, annotations map[string]interface{}) error
// snapshotMeta object has 'name' as name of the clone.
// snapshotMeta object has 'namespace' as the namespace where the clone will be created.
// snapshotMeta object has 'labels' as the labels to set on the created VSC
// snapshotMeta object has 'annotations' as the annotation to set on the created VS
// contentMeta object has 'annotations' as the annotation to set on the created VSC
saima-s marked this conversation as resolved.
Show resolved Hide resolved
Clone(ctx context.Context, name, namespace string, waitForReady bool, snapshotMeta, contentMeta metav1.ObjectMeta) error
// GetSource will return the CSI source that backs the volume snapshot.
//
// 'snapshotName' is the name of the Volumesnapshot.
Expand All @@ -99,21 +100,23 @@ type Snapshotter interface {
// CreateFromSource will create a 'Volumesnapshot' and 'VolumesnaphotContent' pair for the underlying snapshot source.
//
// 'source' contains information about CSI snapshot.
// 'snapshotName' is the name of the snapshot that will be created.
// 'namespace' is the namespace of the snapshot.
// 'waitForReady' blocks the caller until snapshot is ready to use or context is cancelled.
// 'labels' is the labels to set on the created VSC
// 'annotations' is the annotation to set on the created VS and VSC
saima-s marked this conversation as resolved.
Show resolved Hide resolved
CreateFromSource(ctx context.Context, source *Source, snapshotName, namespace string, waitForReady bool, labels map[string]string, annotations map[string]interface{}) error
// snapshotMeta object has 'name' as the name of the snapshot that will be created.
// snapshotMeta object has 'namespace' as the namespace of the snapshot.
// snapshotMeta object has 'labels' as the labels to set on the created VSC
// snapshotMeta object has 'annotations' as the annotation to set on the created VS
// contentMeta object has 'annotations' as the annotation to set on the created VSC
saima-s marked this conversation as resolved.
Show resolved Hide resolved
CreateFromSource(ctx context.Context, source *Source, waitForReady bool, snapshotMeta, contentMeta metav1.ObjectMeta) error
// CreateContentFromSource will create a 'VolumesnaphotContent' for the underlying snapshot source.
//
// 'source' contains information about CSI snapshot.
// 'contentName' is the name of the VSC that will be created
// 'snapshotName' is the name of the snapshot that will be reference the VSC
// 'namespace' is the namespace of the snapshot.
// 'deletionPolicy' is the deletion policy to set on the created VSC
// 'annotations' is the annotation to set on the created VSC
CreateContentFromSource(ctx context.Context, source *Source, contentName, snapshotName, namespace, deletionPolicy string, annotations map[string]string) error
// snapshotMeta object has 'name' as the name of the snapshot that will be reference the VSC
// snapshotMeta object has 'namespace' as the namespace of the snapshot.
// contentMeta object has 'name' as the name of the VSC that will be created.
// contentMeta object has 'annotations' as the annotation to set on the created VSC
saima-s marked this conversation as resolved.
Show resolved Hide resolved
CreateContentFromSource(ctx context.Context, source *Source, deletionPolicy string, snapshotMeta, contentMeta metav1.ObjectMeta) error
// WaitOnReadyToUse will block until the Volumesnapshot in namespace 'namespace' with name 'snapshotName'
// has status 'ReadyToUse' or 'ctx.Done()' is signalled.
WaitOnReadyToUse(ctx context.Context, snapshotName, namespace string) error
Expand Down
88 changes: 40 additions & 48 deletions pkg/kube/snapshot/snapshot_alpha.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,27 +89,28 @@ func (sna *SnapshotAlpha) GetVolumeSnapshotClass(ctx context.Context, annotation
}

// Create creates a VolumeSnapshot and returns it or any error that happened meanwhile.
func (sna *SnapshotAlpha) Create(ctx context.Context, name, namespace, pvcName string, snapshotClass *string, waitForReady bool, labels, annotations map[string]string) error {
if _, err := sna.kubeCli.CoreV1().PersistentVolumeClaims(namespace).Get(ctx, pvcName, metav1.GetOptions{}); err != nil {
func (sna *SnapshotAlpha) Create(ctx context.Context, pvcName string, snapshotClass *string, waitForReady bool, snapshotMeta metav1.ObjectMeta) error {
if _, err := sna.kubeCli.CoreV1().PersistentVolumeClaims(snapshotMeta.Namespace).Get(ctx, pvcName, metav1.GetOptions{}); err != nil {
if apierrors.IsNotFound(err) {
return errkit.New("Failed to find PVC", "pvc", pvcName, "namespace", namespace)
return errkit.New("Failed to find PVC", "pvc", pvcName, "namespace", snapshotMeta.Namespace)
}
return errkit.Wrap(err, "Failed to query PVC", "pvc", pvcName, "namespace", namespace)
return errkit.Wrap(err, "Failed to query PVC", "pvc", pvcName, "namespace", snapshotMeta.Namespace)
}
snap := UnstructuredVolumeSnapshotAlpha(name, namespace, pvcName, "", *snapshotClass, blockstorage.SanitizeTags(labels), annotations)
if _, err := sna.dynCli.Resource(v1alpha1.VolSnapGVR).Namespace(namespace).Create(ctx, snap, metav1.CreateOptions{}); err != nil {
snapshotMeta.SetLabels(blockstorage.SanitizeTags(snapshotMeta.Labels))
snap := UnstructuredVolumeSnapshotAlpha(pvcName, *snapshotClass, snapshotMeta, metav1.ObjectMeta{})
if _, err := sna.dynCli.Resource(v1alpha1.VolSnapGVR).Namespace(snapshotMeta.Namespace).Create(ctx, snap, metav1.CreateOptions{}); err != nil {
return err
}

if !waitForReady {
return nil
}

if err := sna.WaitOnReadyToUse(ctx, name, namespace); err != nil {
if err := sna.WaitOnReadyToUse(ctx, snapshotMeta.Name, snapshotMeta.Namespace); err != nil {
return err
}

_, err := sna.Get(ctx, name, namespace)
_, err := sna.Get(ctx, snapshotMeta.Name, snapshotMeta.Namespace)
return err
}

Expand Down Expand Up @@ -218,20 +219,20 @@ func (sna *SnapshotAlpha) DeleteContent(ctx context.Context, name string) error

// Clone will clone the VolumeSnapshot to namespace 'cloneNamespace'.
// Underlying VolumeSnapshotContent will be cloned with a different name.
func (sna *SnapshotAlpha) Clone(ctx context.Context, name, namespace, cloneName, cloneNamespace string, waitForReady bool, labels map[string]string, annotations map[string]interface{}) error {
_, err := sna.Get(ctx, cloneName, cloneNamespace)
func (sna *SnapshotAlpha) Clone(ctx context.Context, name, namespace string, waitForReady bool, snapshotMeta, contentMeta metav1.ObjectMeta) error {
_, err := sna.Get(ctx, snapshotMeta.Name, snapshotMeta.Namespace)
if err == nil {
return errkit.New("Target snapshot already exists in target namespace", "name", cloneName, "namespace", cloneNamespace)
return errkit.New("Target snapshot already exists in target namespace", "name", snapshotMeta.Name, "namespace", snapshotMeta.Namespace)
}
if !apierrors.IsNotFound(err) {
return errkit.Wrap(err, "Failed to query target Volumesnapshot", "name", cloneName, "namespace", cloneNamespace)
return errkit.Wrap(err, "Failed to query target Volumesnapshot", "name", snapshotMeta.Name, "namespace", snapshotMeta.Namespace)
}

src, err := sna.GetSource(ctx, name, namespace)
if err != nil {
return errkit.Wrap(err, "Failed to get source")
}
return sna.CreateFromSource(ctx, src, cloneName, cloneNamespace, waitForReady, labels, annotations)
return sna.CreateFromSource(ctx, src, waitForReady, snapshotMeta, contentMeta)
}

// GetSource will return the CSI source that backs the volume snapshot.
Expand Down Expand Up @@ -261,33 +262,24 @@ func (sna *SnapshotAlpha) GetSource(ctx context.Context, snapshotName, namespace
}

// CreateFromSource will create a 'Volumesnapshot' and 'VolumesnaphotContent' pair for the underlying snapshot source.
func (sna *SnapshotAlpha) CreateFromSource(ctx context.Context, source *Source, snapshotName, namespace string, waitForReady bool, labels map[string]string, annotations map[string]interface{}) error {
func (sna *SnapshotAlpha) CreateFromSource(ctx context.Context, source *Source, waitForReady bool, snapshotMeta, contentMeta metav1.ObjectMeta) error {
deletionPolicy, err := sna.getDeletionPolicyFromClass(source.VolumeSnapshotClassName)
if err != nil {
return errkit.Wrap(err, "Failed to get DeletionPolicy from VolumeSnapshotClass")
}
contentName := snapshotName + "-content-" + string(uuid.NewUUID())
snapshotAnnotation := getAnnotation(annotations, SnapshotAnnotation)
snap := UnstructuredVolumeSnapshotAlpha(snapshotName, namespace, "", contentName, source.VolumeSnapshotClassName, blockstorage.SanitizeTags(labels), snapshotAnnotation)
contentAnnotation := getAnnotation(annotations, SnapshotContentAnnotation)
if err := sna.CreateContentFromSource(ctx, source, contentName, snapshotName, namespace, deletionPolicy, contentAnnotation); err != nil {
contentMeta.SetName(snapshotMeta.Name + "-content-" + string(uuid.NewUUID()))
snapshotMeta.SetLabels(blockstorage.SanitizeTags(snapshotMeta.Labels))
snap := UnstructuredVolumeSnapshotAlpha("", source.VolumeSnapshotClassName, snapshotMeta, contentMeta)
if err := sna.CreateContentFromSource(ctx, source, deletionPolicy, snapshotMeta, contentMeta); err != nil {
return err
}
if _, err := sna.dynCli.Resource(v1alpha1.VolSnapGVR).Namespace(namespace).Create(ctx, snap, metav1.CreateOptions{}); err != nil {
return errkit.Wrap(err, "Failed to create content", "name", snap.GetName(), "namespace", namespace)
if _, err := sna.dynCli.Resource(v1alpha1.VolSnapGVR).Namespace(snapshotMeta.Namespace).Create(ctx, snap, metav1.CreateOptions{}); err != nil {
return errkit.Wrap(err, "Failed to create content", "name", snap.GetName(), "namespace", snapshotMeta.Namespace)
}
if !waitForReady {
return nil
}
return sna.WaitOnReadyToUse(ctx, snapshotName, namespace)
}

func getAnnotation(annotations map[string]interface{}, key string) map[string]string {
if val, ok := annotations[key]; ok {
return val.(map[string]string)
}

return nil
return sna.WaitOnReadyToUse(ctx, snapshotMeta.Name, snapshotMeta.Namespace)
}

// UpdateVolumeSnapshotStatusAlpha sets the readyToUse valuse of a VolumeSnapshot.
Expand All @@ -309,8 +301,8 @@ func (sna *SnapshotAlpha) UpdateVolumeSnapshotStatusAlpha(ctx context.Context, n
}

// CreateContentFromSource will create a 'VolumesnaphotContent' for the underlying snapshot source.
func (sna *SnapshotAlpha) CreateContentFromSource(ctx context.Context, source *Source, contentName, snapshotName, namespace, deletionPolicy string, annotations map[string]string) error {
content := UnstructuredVolumeSnapshotContentAlpha(contentName, snapshotName, namespace, deletionPolicy, source.Driver, source.Handle, source.VolumeSnapshotClassName, annotations)
func (sna *SnapshotAlpha) CreateContentFromSource(ctx context.Context, source *Source, deletionPolicy string, snapshotMeta, contentMeta metav1.ObjectMeta) error {
content := UnstructuredVolumeSnapshotContentAlpha(deletionPolicy, source.Driver, source.Handle, source.VolumeSnapshotClassName, snapshotMeta, contentMeta)
if _, err := sna.dynCli.Resource(v1alpha1.VolSnapContentGVR).Create(ctx, content, metav1.CreateOptions{}); err != nil {
return errkit.Wrap(err, "Failed to create content", "contentName", content.GetName())
}
Expand Down Expand Up @@ -365,14 +357,14 @@ func (sna *SnapshotAlpha) getDeletionPolicyFromClass(snapClassName string) (stri
return vsc.DeletionPolicy, nil
}

func UnstructuredVolumeSnapshotAlpha(name, namespace, pvcName, contentName, snapClassName string, labels, annotation map[string]string) *unstructured.Unstructured {
func UnstructuredVolumeSnapshotAlpha(pvcName, snapClassName string, snapshotMeta, contentMeta metav1.ObjectMeta) *unstructured.Unstructured {
saima-s marked this conversation as resolved.
Show resolved Hide resolved
snap := &unstructured.Unstructured{
Object: map[string]interface{}{
"apiVersion": fmt.Sprintf("%s/%s", v1alpha1.GroupName, v1alpha1.Version),
"kind": VolSnapKind,
"metadata": map[string]interface{}{
"name": name,
"namespace": namespace,
"name": snapshotMeta.Name,
"namespace": snapshotMeta.Namespace,
},
},
}
Expand All @@ -381,34 +373,34 @@ func UnstructuredVolumeSnapshotAlpha(name, namespace, pvcName, contentName, snap
"source": map[string]interface{}{
"kind": PVCKind,
"name": pvcName,
"namespace": namespace,
"namespace": snapshotMeta.Namespace,
},
"snapshotClassName": snapClassName,
"deletionPolicy": "Delete",
}
}
if contentName != "" {
if contentMeta.Name != "" {
snap.Object["spec"] = map[string]interface{}{
"snapshotContentName": contentName,
"snapshotContentName": contentMeta.Name,
"snapshotClassName": snapClassName,
}
}
if labels != nil {
snap.SetLabels(labels)
if snapshotMeta.Labels != nil {
snap.SetLabels(snapshotMeta.Labels)
}
if annotation != nil {
snap.SetAnnotations(annotation)
if snapshotMeta.Annotations != nil {
snap.SetAnnotations(snapshotMeta.Annotations)
}
return snap
}

func UnstructuredVolumeSnapshotContentAlpha(name, snapshotName, snapshotNs, deletionPolicy, driver, handle, snapClassName string, annotations map[string]string) *unstructured.Unstructured {
func UnstructuredVolumeSnapshotContentAlpha(deletionPolicy, driver, handle, snapClassName string, snapshotMeta, contentMeta metav1.ObjectMeta) *unstructured.Unstructured {
snaphotContent := unstructured.Unstructured{
Object: map[string]interface{}{
"apiVersion": fmt.Sprintf("%s/%s", v1alpha1.GroupName, v1alpha1.Version),
"kind": VolSnapContentKind,
"metadata": map[string]interface{}{
"name": name,
"name": contentMeta.Name,
},
"spec": map[string]interface{}{
"csiVolumeSnapshotSource": map[string]interface{}{
Expand All @@ -417,16 +409,16 @@ func UnstructuredVolumeSnapshotContentAlpha(name, snapshotName, snapshotNs, dele
},
"volumeSnapshotRef": map[string]interface{}{
"kind": VolSnapKind,
"name": snapshotName,
"namespace": snapshotNs,
"name": snapshotMeta.Name,
"namespace": snapshotMeta.Namespace,
},
"snapshotClassName": snapClassName,
"deletionPolicy": deletionPolicy,
},
},
}
if annotations != nil {
snaphotContent.SetAnnotations(annotations)
if contentMeta.Annotations != nil {
saima-s marked this conversation as resolved.
Show resolved Hide resolved
snaphotContent.SetAnnotations(contentMeta.Annotations)
}
return &snaphotContent
}
Expand Down
Loading