@@ -23,7 +23,7 @@ import (
2323 "github.com/pkg/errors"
2424 "github.com/sirupsen/logrus"
2525
26- snapshotv1beta1api "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1beta1 "
26+ snapshotv1api "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1 "
2727 corev1api "k8s.io/api/core/v1"
2828 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2929 "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
@@ -105,7 +105,7 @@ func (p *PVCBackupItemAction) Execute(item runtime.Unstructured, backup *velerov
105105 return nil , nil , errors .Wrap (err , "error getting storage class" )
106106 }
107107 p .Log .Debugf ("Fetching volumesnapshot class for %s" , storageClass .Provisioner )
108- snapshotClass , err := util .GetVolumeSnapshotClassForStorageClass (storageClass .Provisioner , snapshotClient .SnapshotV1beta1 ())
108+ snapshotClass , err := util .GetVolumeSnapshotClassForStorageClass (storageClass .Provisioner , snapshotClient .SnapshotV1 ())
109109 if err != nil {
110110 return nil , nil , errors .Wrapf (err , "failed to get volumesnapshotclass for storageclass %s" , storageClass .Name )
111111 }
@@ -114,28 +114,28 @@ func (p *PVCBackupItemAction) Execute(item runtime.Unstructured, backup *velerov
114114 // If deletetionPolicy is not Retain, then in the event of a disaster, the namespace is lost with the volumesnapshot object in it,
115115 // the underlying volumesnapshotcontent and the volume snapshot in the storage provider is also deleted.
116116 // In such a scenario, the backup objects will be useless as the snapshot handle itself will not be valid.
117- if snapshotClass .DeletionPolicy != snapshotv1beta1api .VolumeSnapshotContentRetain {
117+ if snapshotClass .DeletionPolicy != snapshotv1api .VolumeSnapshotContentRetain {
118118 p .Log .Warnf ("DeletionPolicy on VolumeSnapshotClass %s is not %s; Deletion of VolumeSnapshot objects will lead to deletion of snapshot in the storage provider." ,
119- snapshotClass .Name , snapshotv1beta1api .VolumeSnapshotContentRetain )
119+ snapshotClass .Name , snapshotv1api .VolumeSnapshotContentRetain )
120120 }
121121 // Craft the snapshot object to be created
122- snapshot := snapshotv1beta1api .VolumeSnapshot {
122+ snapshot := snapshotv1api .VolumeSnapshot {
123123 ObjectMeta : metav1.ObjectMeta {
124124 GenerateName : "velero-" + pvc .Name + "-" ,
125125 Namespace : pvc .Namespace ,
126126 Labels : map [string ]string {
127127 velerov1api .BackupNameLabel : label .GetValidName (backup .Name ),
128128 },
129129 },
130- Spec : snapshotv1beta1api .VolumeSnapshotSpec {
131- Source : snapshotv1beta1api .VolumeSnapshotSource {
130+ Spec : snapshotv1api .VolumeSnapshotSpec {
131+ Source : snapshotv1api .VolumeSnapshotSource {
132132 PersistentVolumeClaimName : & pvc .Name ,
133133 },
134134 VolumeSnapshotClassName : & snapshotClass .Name ,
135135 },
136136 }
137137
138- upd , err := snapshotClient .SnapshotV1beta1 ().VolumeSnapshots (pvc .Namespace ).Create (context .TODO (), & snapshot , metav1.CreateOptions {})
138+ upd , err := snapshotClient .SnapshotV1 ().VolumeSnapshots (pvc .Namespace ).Create (context .TODO (), & snapshot , metav1.CreateOptions {})
139139 if err != nil {
140140 return nil , nil , errors .Wrapf (err , "error creating volume snapshot" )
141141 }
0 commit comments