Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit bec108a

Browse files
authored
Merge pull request #99 from reasonerjt/bump-up-to-v1
Bump up the API from v1beta1 to v1
2 parents 079131f + b5a4f62 commit bec108a

17 files changed

+134
-136
lines changed

.github/auto-assignees.yml

-4
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,10 @@ reviewers:
99

1010
groups:
1111
maintainers:
12-
- dsu-igeek
13-
- jenting
1412
- sseago
1513
- reasonerjt
1614
- ywk253100
1715
- blackpiglet
18-
- qiuming-best
19-
2016
options:
2117
ignore_draft: true
2218
ignored_keywords:

changelogs/unreleased/99-reasonerjt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Bump up the API from v1beta1 to v1

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/vmware-tanzu/velero-plugin-for-csi
33
go 1.17
44

55
require (
6-
github.com/kubernetes-csi/external-snapshotter/client/v4 v4.0.0
6+
github.com/kubernetes-csi/external-snapshotter/client/v4 v4.2.0
77
github.com/pkg/errors v0.9.1
88
github.com/sirupsen/logrus v1.8.1
99
github.com/spf13/pflag v1.0.5

go.sum

+2-1
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,9 @@ github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
436436
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
437437
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
438438
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
439-
github.com/kubernetes-csi/external-snapshotter/client/v4 v4.0.0 h1:ipLtV9ubLEYx42YvwDa12eVPQvjuGZoPdbCozGzVNRc=
440439
github.com/kubernetes-csi/external-snapshotter/client/v4 v4.0.0/go.mod h1:YBCo4DoEeDndqvAn6eeu0vWM7QdXmHEeI9cFWplmBys=
440+
github.com/kubernetes-csi/external-snapshotter/client/v4 v4.2.0 h1:nHHjmvjitIiyPlUHk/ofpgvBcNcawJLtf4PYHORLjAA=
441+
github.com/kubernetes-csi/external-snapshotter/client/v4 v4.2.0/go.mod h1:YBCo4DoEeDndqvAn6eeu0vWM7QdXmHEeI9cFWplmBys=
441442
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE=
442443
github.com/lithammer/dedent v1.1.0/go.mod h1:jrXYCQtgg0nJiN+StA2KgR7w6CiQNv9Fd/Z9BP0jIOc=
443444
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=

internal/backup/pvc_action.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -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
}

internal/backup/volumesnapshot_action.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -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
"k8s.io/apimachinery/pkg/api/resource"
2828
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2929
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
@@ -57,7 +57,7 @@ func (p *VolumeSnapshotBackupItemAction) AppliesTo() (velero.ResourceSelector, e
5757
func (p *VolumeSnapshotBackupItemAction) Execute(item runtime.Unstructured, backup *velerov1api.Backup) (runtime.Unstructured, []velero.ResourceIdentifier, error) {
5858
p.Log.Infof("Executing VolumeSnapshotBackupItemAction")
5959

60-
var vs snapshotv1beta1api.VolumeSnapshot
60+
var vs snapshotv1api.VolumeSnapshot
6161
if err := runtime.DefaultUnstructuredConverter.FromUnstructured(item.UnstructuredContent(), &vs); err != nil {
6262
return nil, nil, errors.WithStack(err)
6363
}
@@ -90,7 +90,7 @@ func (p *VolumeSnapshotBackupItemAction) Execute(item runtime.Unstructured, back
9090

9191
p.Log.Infof("Getting VolumesnapshotContent for Volumesnapshot %s/%s", vs.Namespace, vs.Name)
9292

93-
vsc, err := util.GetVolumeSnapshotContentForVolumeSnapshot(&vs, snapshotClient.SnapshotV1beta1(), p.Log, backupOngoing)
93+
vsc, err := util.GetVolumeSnapshotContentForVolumeSnapshot(&vs, snapshotClient.SnapshotV1(), p.Log, backupOngoing)
9494
if err != nil {
9595
return nil, nil, errors.WithStack(err)
9696
}
@@ -137,7 +137,7 @@ func (p *VolumeSnapshotBackupItemAction) Execute(item runtime.Unstructured, back
137137
// Further, we want to add this label only on volumesnapshotcontents that were created during an ongoing velero backup.
138138

139139
pb := []byte(fmt.Sprintf(`{"metadata":{"labels":{"%s":"%s"}}}`, velerov1api.BackupNameLabel, label.GetValidName(backup.Name)))
140-
if _, vscPatchError := snapshotClient.SnapshotV1beta1().VolumeSnapshotContents().Patch(context.TODO(), vsc.Name, types.MergePatchType, pb, metav1.PatchOptions{}); vscPatchError != nil {
140+
if _, vscPatchError := snapshotClient.SnapshotV1().VolumeSnapshotContents().Patch(context.TODO(), vsc.Name, types.MergePatchType, pb, metav1.PatchOptions{}); vscPatchError != nil {
141141
p.Log.Warnf("Failed to patch volumesnapshotcontent %s: %v", vsc.Name, vscPatchError)
142142
}
143143
}

internal/backup/volumesnapshotclass_action.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"github.com/pkg/errors"
2121
"github.com/sirupsen/logrus"
2222

23-
snapshotv1beta1api "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1beta1"
23+
snapshotv1api "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1"
2424
"k8s.io/apimachinery/pkg/runtime"
2525
"k8s.io/apimachinery/pkg/runtime/schema"
2626

@@ -48,7 +48,7 @@ func (p *VolumeSnapshotClassBackupItemAction) AppliesTo() (velero.ResourceSelect
4848
func (p *VolumeSnapshotClassBackupItemAction) Execute(item runtime.Unstructured, backup *velerov1api.Backup) (runtime.Unstructured, []velero.ResourceIdentifier, error) {
4949
p.Log.Infof("Executing VolumeSnapshotClassBackupItemAction")
5050

51-
var snapClass snapshotv1beta1api.VolumeSnapshotClass
51+
var snapClass snapshotv1api.VolumeSnapshotClass
5252
if err := runtime.DefaultUnstructuredConverter.FromUnstructured(item.UnstructuredContent(), &snapClass); err != nil {
5353
return nil, nil, errors.WithStack(err)
5454
}

internal/backup/volumesnapshotcontent_action.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ limitations under the License.
1717
package backup
1818

1919
import (
20+
snapshotv1api "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1"
2021
"github.com/pkg/errors"
2122
"github.com/sirupsen/logrus"
2223

23-
snapshotv1beta1api "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1beta1"
2424
"k8s.io/apimachinery/pkg/runtime"
2525
"k8s.io/apimachinery/pkg/runtime/schema"
2626

@@ -49,7 +49,7 @@ func (p *VolumeSnapshotContentBackupItemAction) AppliesTo() (velero.ResourceSele
4949
func (p *VolumeSnapshotContentBackupItemAction) Execute(item runtime.Unstructured, backup *velerov1api.Backup) (runtime.Unstructured, []velero.ResourceIdentifier, error) {
5050
p.Log.Infof("Executing VolumeSnapshotContentBackupItemAction")
5151

52-
var snapCont snapshotv1beta1api.VolumeSnapshotContent
52+
var snapCont snapshotv1api.VolumeSnapshotContent
5353
if err := runtime.DefaultUnstructuredConverter.FromUnstructured(item.UnstructuredContent(), &snapCont); err != nil {
5454
return nil, nil, errors.WithStack(err)
5555
}

internal/delete/volumesnapshot_action.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1212
"k8s.io/apimachinery/pkg/runtime"
1313

14-
snapshotv1beta1api "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1beta1"
14+
snapshotv1api "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1"
1515
apierrors "k8s.io/apimachinery/pkg/api/errors"
1616
)
1717

@@ -32,7 +32,7 @@ func (p *VolumeSnapshotDeleteItemAction) AppliesTo() (velero.ResourceSelector, e
3232
func (p *VolumeSnapshotDeleteItemAction) Execute(input *velero.DeleteItemActionExecuteInput) error {
3333
p.Log.Info("Starting VolumeSnapshotDeleteItemAction for volumeSnapshot")
3434

35-
var vs snapshotv1beta1api.VolumeSnapshot
35+
var vs snapshotv1api.VolumeSnapshot
3636

3737
if err := runtime.DefaultUnstructuredConverter.FromUnstructured(input.Item.UnstructuredContent(), &vs); err != nil {
3838
return errors.Wrapf(err, "failed to convert input.Item from unstructured")
@@ -54,7 +54,7 @@ func (p *VolumeSnapshotDeleteItemAction) Execute(input *velero.DeleteItemActionE
5454
if vs.Status != nil && vs.Status.BoundVolumeSnapshotContentName != nil {
5555
// we patch the DeletionPolicy of the volumesnapshotcontent to set it to Delete.
5656
// This ensures that the volume snapshot in the storage provider is also deleted.
57-
err := util.SetVolumeSnapshotContentDeletionPolicy(*vs.Status.BoundVolumeSnapshotContentName, snapClient.SnapshotV1beta1())
57+
err := util.SetVolumeSnapshotContentDeletionPolicy(*vs.Status.BoundVolumeSnapshotContentName, snapClient.SnapshotV1())
5858
if err != nil && !apierrors.IsNotFound(err) {
5959
return errors.Wrapf(err, fmt.Sprintf("failed to patch DeletionPolicy of volume snapshot %s/%s", vs.Namespace, vs.Name))
6060
}
@@ -63,7 +63,7 @@ func (p *VolumeSnapshotDeleteItemAction) Execute(input *velero.DeleteItemActionE
6363
return nil
6464
}
6565
}
66-
err = snapClient.SnapshotV1beta1().VolumeSnapshots(vs.Namespace).Delete(context.TODO(), vs.Name, metav1.DeleteOptions{})
66+
err = snapClient.SnapshotV1().VolumeSnapshots(vs.Namespace).Delete(context.TODO(), vs.Name, metav1.DeleteOptions{})
6767
if err != nil && !apierrors.IsNotFound(err) {
6868
return err
6969
}

internal/delete/volumesnapshotcontent_action.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1313
"k8s.io/apimachinery/pkg/runtime"
1414

15-
snapshotv1beta1api "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1beta1"
15+
snapshotv1api "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1"
1616
)
1717

1818
// VolumeSnapshotContentDeleteItemAction is a restore item action plugin for Velero
@@ -31,7 +31,7 @@ func (p *VolumeSnapshotContentDeleteItemAction) AppliesTo() (velero.ResourceSele
3131
func (p *VolumeSnapshotContentDeleteItemAction) Execute(input *velero.DeleteItemActionExecuteInput) error {
3232
p.Log.Info("Starting VolumeSnapshotContentDeleteItemAction")
3333

34-
var snapCont snapshotv1beta1api.VolumeSnapshotContent
34+
var snapCont snapshotv1api.VolumeSnapshotContent
3535
if err := runtime.DefaultUnstructuredConverter.FromUnstructured(input.Item.UnstructuredContent(), &snapCont); err != nil {
3636
return errors.Wrapf(err, "failed to convert input.Item from unstructured")
3737
}
@@ -51,7 +51,7 @@ func (p *VolumeSnapshotContentDeleteItemAction) Execute(input *velero.DeleteItem
5151
return errors.WithStack(err)
5252
}
5353

54-
err = util.SetVolumeSnapshotContentDeletionPolicy(snapCont.Name, snapClient.SnapshotV1beta1())
54+
err = util.SetVolumeSnapshotContentDeletionPolicy(snapCont.Name, snapClient.SnapshotV1())
5555
if err != nil {
5656
if apierrors.IsNotFound(err) {
5757
p.Log.Infof("VolumeSnapshotContent %s not found", snapCont.Name)
@@ -60,7 +60,7 @@ func (p *VolumeSnapshotContentDeleteItemAction) Execute(input *velero.DeleteItem
6060
return errors.Wrapf(err, fmt.Sprintf("failed to set DeletionPolicy on volumesnapshotcontent %s. Skipping deletion", snapCont.Name))
6161
}
6262

63-
err = snapClient.SnapshotV1beta1().VolumeSnapshotContents().Delete(context.TODO(), snapCont.Name, metav1.DeleteOptions{})
63+
err = snapClient.SnapshotV1().VolumeSnapshotContents().Delete(context.TODO(), snapCont.Name, metav1.DeleteOptions{})
6464
if err != nil && !apierrors.IsNotFound(err) {
6565
p.Log.Infof("VolumeSnapshotContent %s not found", snapCont.Name)
6666
return err

internal/restore/pvc_action.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ import (
2020
"context"
2121
"fmt"
2222

23+
snapshotv1api "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1"
2324
"github.com/pkg/errors"
2425
"github.com/sirupsen/logrus"
2526

26-
snapshotv1beta1api "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1beta1"
2727
corev1api "k8s.io/api/core/v1"
2828
"k8s.io/apimachinery/pkg/api/resource"
2929
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -71,7 +71,7 @@ func resetPVCSpec(pvc *corev1api.PersistentVolumeClaim, vsName string) {
7171
// So clear out the volume name, which is a ref to the PV
7272
pvc.Spec.VolumeName = ""
7373
pvc.Spec.DataSource = &corev1api.TypedLocalObjectReference{
74-
APIGroup: &snapshotv1beta1api.SchemeGroupVersion.Group,
74+
APIGroup: &snapshotv1api.SchemeGroupVersion.Group,
7575
Kind: "VolumeSnapshot",
7676
Name: vsName,
7777
}
@@ -123,7 +123,7 @@ func (p *PVCRestoreItemAction) Execute(input *velero.RestoreItemActionExecuteInp
123123
return nil, errors.WithStack(err)
124124
}
125125

126-
vs, err := snapClient.SnapshotV1beta1().VolumeSnapshots(pvc.Namespace).Get(context.TODO(), volumeSnapshotName, metav1.GetOptions{})
126+
vs, err := snapClient.SnapshotV1().VolumeSnapshots(pvc.Namespace).Get(context.TODO(), volumeSnapshotName, metav1.GetOptions{})
127127
if err != nil {
128128
return nil, errors.Wrapf(err, fmt.Sprintf("Failed to get Volumesnapshot %s/%s to restore PVC %s/%s", pvc.Namespace, volumeSnapshotName, pvc.Namespace, pvc.Name))
129129
}

internal/restore/volumesnapshot_action.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"github.com/pkg/errors"
2323
"github.com/sirupsen/logrus"
2424

25-
snapshotv1beta1api "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1beta1"
25+
snapshotv1api "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1"
2626
core_v1 "k8s.io/api/core/v1"
2727
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2828
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
@@ -47,7 +47,7 @@ func (p *VolumeSnapshotRestoreItemAction) AppliesTo() (velero.ResourceSelector,
4747
}, nil
4848
}
4949

50-
func resetVolumeSnapshotSpecForRestore(vs *snapshotv1beta1api.VolumeSnapshot, vscName *string) {
50+
func resetVolumeSnapshotSpecForRestore(vs *snapshotv1api.VolumeSnapshot, vscName *string) {
5151
// Spec of the backed-up object used the PVC as the source of the volumeSnapshot.
5252
// Restore operation will however, restore the volumesnapshot from the volumesnapshotcontent
5353
vs.Spec.Source.PersistentVolumeClaimName = nil
@@ -58,7 +58,7 @@ func resetVolumeSnapshotSpecForRestore(vs *snapshotv1beta1api.VolumeSnapshot, vs
5858
// to recreate a volumesnapshotcontent object and statically bind the Volumesnapshot object being restored.
5959
func (p *VolumeSnapshotRestoreItemAction) Execute(input *velero.RestoreItemActionExecuteInput) (*velero.RestoreItemActionExecuteOutput, error) {
6060
p.Log.Info("Starting VolumeSnapshotRestoreItemAction")
61-
var vs snapshotv1beta1api.VolumeSnapshot
61+
var vs snapshotv1api.VolumeSnapshot
6262

6363
if err := runtime.DefaultUnstructuredConverter.FromUnstructured(input.Item.UnstructuredContent(), &vs); err != nil {
6464
return &velero.RestoreItemActionExecuteOutput{}, errors.Wrapf(err, "failed to convert input.Item from unstructured")
@@ -75,7 +75,7 @@ func (p *VolumeSnapshotRestoreItemAction) Execute(input *velero.RestoreItemActio
7575
return nil, errors.WithStack(err)
7676
}
7777

78-
if !util.IsVolumeSnapshotExists(&vs, snapClient.SnapshotV1beta1()) {
78+
if !util.IsVolumeSnapshotExists(&vs, snapClient.SnapshotV1()) {
7979
snapHandle, exists := vs.Annotations[util.VolumeSnapshotHandleAnnotation]
8080
if !exists {
8181
return nil, errors.Errorf("Volumesnapshot %s/%s does not have a %s annotation", vs.Namespace, vs.Name, util.VolumeSnapshotHandleAnnotation)
@@ -90,26 +90,26 @@ func (p *VolumeSnapshotRestoreItemAction) Execute(input *velero.RestoreItemActio
9090
if !exists {
9191
p.Log.Infof("Volumesnapshot %s/%s does not have a %s annotation using DeletionPolicy Retain for volumesnapshotcontent",
9292
vs.Namespace, vs.Name, util.CSIVSCDeletionPolicy)
93-
deletionPolicy = string(snapshotv1beta1api.VolumeSnapshotContentRetain)
93+
deletionPolicy = string(snapshotv1api.VolumeSnapshotContentRetain)
9494
}
9595

9696
// TODO: generated name will be like velero-velero-something. Fix that.
97-
vsc := snapshotv1beta1api.VolumeSnapshotContent{
97+
vsc := snapshotv1api.VolumeSnapshotContent{
9898
ObjectMeta: metav1.ObjectMeta{
9999
GenerateName: "velero-" + vs.Name + "-",
100100
Labels: map[string]string{
101101
velerov1api.RestoreNameLabel: label.GetValidName(input.Restore.Name),
102102
},
103103
},
104-
Spec: snapshotv1beta1api.VolumeSnapshotContentSpec{
105-
DeletionPolicy: snapshotv1beta1api.DeletionPolicy(deletionPolicy),
104+
Spec: snapshotv1api.VolumeSnapshotContentSpec{
105+
DeletionPolicy: snapshotv1api.DeletionPolicy(deletionPolicy),
106106
Driver: csiDriverName,
107107
VolumeSnapshotRef: core_v1.ObjectReference{
108108
Kind: "VolumeSnapshot",
109109
Namespace: vs.Namespace,
110110
Name: vs.Name,
111111
},
112-
Source: snapshotv1beta1api.VolumeSnapshotContentSource{
112+
Source: snapshotv1api.VolumeSnapshotContentSource{
113113
SnapshotHandle: &snapHandle,
114114
},
115115
},
@@ -121,7 +121,7 @@ func (p *VolumeSnapshotRestoreItemAction) Execute(input *velero.RestoreItemActio
121121
// between the volumesnapshotcontent and volumesnapshot objects have to be setup.
122122
// Further, it is disallowed to convert a dynamically created volumesnapshotcontent for static binding.
123123
// See: https://github.com/kubernetes-csi/external-snapshotter/issues/274
124-
vscupd, err := snapClient.SnapshotV1beta1().VolumeSnapshotContents().Create(context.TODO(), &vsc, metav1.CreateOptions{})
124+
vscupd, err := snapClient.SnapshotV1().VolumeSnapshotContents().Create(context.TODO(), &vsc, metav1.CreateOptions{})
125125
if err != nil {
126126
return nil, errors.Wrapf(err, "failed to create volumesnapshotcontents %s", vsc.GenerateName)
127127
}

0 commit comments

Comments
 (0)