Skip to content

Commit

Permalink
Merge pull request #99 from reasonerjt/bump-up-to-v1
Browse files Browse the repository at this point in the history
Bump up the API from v1beta1 to v1
  • Loading branch information
ywk253100 authored Apr 7, 2022
2 parents 079131f + b5a4f62 commit bec108a
Show file tree
Hide file tree
Showing 17 changed files with 134 additions and 136 deletions.
4 changes: 0 additions & 4 deletions .github/auto-assignees.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,10 @@ reviewers:

groups:
maintainers:
- dsu-igeek
- jenting
- sseago
- reasonerjt
- ywk253100
- blackpiglet
- qiuming-best

options:
ignore_draft: true
ignored_keywords:
Expand Down
1 change: 1 addition & 0 deletions changelogs/unreleased/99-reasonerjt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bump up the API from v1beta1 to v1
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/vmware-tanzu/velero-plugin-for-csi
go 1.17

require (
github.com/kubernetes-csi/external-snapshotter/client/v4 v4.0.0
github.com/kubernetes-csi/external-snapshotter/client/v4 v4.2.0
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.8.1
github.com/spf13/pflag v1.0.5
Expand Down
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,9 @@ github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kubernetes-csi/external-snapshotter/client/v4 v4.0.0 h1:ipLtV9ubLEYx42YvwDa12eVPQvjuGZoPdbCozGzVNRc=
github.com/kubernetes-csi/external-snapshotter/client/v4 v4.0.0/go.mod h1:YBCo4DoEeDndqvAn6eeu0vWM7QdXmHEeI9cFWplmBys=
github.com/kubernetes-csi/external-snapshotter/client/v4 v4.2.0 h1:nHHjmvjitIiyPlUHk/ofpgvBcNcawJLtf4PYHORLjAA=
github.com/kubernetes-csi/external-snapshotter/client/v4 v4.2.0/go.mod h1:YBCo4DoEeDndqvAn6eeu0vWM7QdXmHEeI9cFWplmBys=
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE=
github.com/lithammer/dedent v1.1.0/go.mod h1:jrXYCQtgg0nJiN+StA2KgR7w6CiQNv9Fd/Z9BP0jIOc=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
Expand Down
16 changes: 8 additions & 8 deletions internal/backup/pvc_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/pkg/errors"
"github.com/sirupsen/logrus"

snapshotv1beta1api "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1beta1"
snapshotv1api "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1"
corev1api "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
Expand Down Expand Up @@ -105,7 +105,7 @@ func (p *PVCBackupItemAction) Execute(item runtime.Unstructured, backup *velerov
return nil, nil, errors.Wrap(err, "error getting storage class")
}
p.Log.Debugf("Fetching volumesnapshot class for %s", storageClass.Provisioner)
snapshotClass, err := util.GetVolumeSnapshotClassForStorageClass(storageClass.Provisioner, snapshotClient.SnapshotV1beta1())
snapshotClass, err := util.GetVolumeSnapshotClassForStorageClass(storageClass.Provisioner, snapshotClient.SnapshotV1())
if err != nil {
return nil, nil, errors.Wrapf(err, "failed to get volumesnapshotclass for storageclass %s", storageClass.Name)
}
Expand All @@ -114,28 +114,28 @@ func (p *PVCBackupItemAction) Execute(item runtime.Unstructured, backup *velerov
// If deletetionPolicy is not Retain, then in the event of a disaster, the namespace is lost with the volumesnapshot object in it,
// the underlying volumesnapshotcontent and the volume snapshot in the storage provider is also deleted.
// In such a scenario, the backup objects will be useless as the snapshot handle itself will not be valid.
if snapshotClass.DeletionPolicy != snapshotv1beta1api.VolumeSnapshotContentRetain {
if snapshotClass.DeletionPolicy != snapshotv1api.VolumeSnapshotContentRetain {
p.Log.Warnf("DeletionPolicy on VolumeSnapshotClass %s is not %s; Deletion of VolumeSnapshot objects will lead to deletion of snapshot in the storage provider.",
snapshotClass.Name, snapshotv1beta1api.VolumeSnapshotContentRetain)
snapshotClass.Name, snapshotv1api.VolumeSnapshotContentRetain)
}
// Craft the snapshot object to be created
snapshot := snapshotv1beta1api.VolumeSnapshot{
snapshot := snapshotv1api.VolumeSnapshot{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "velero-" + pvc.Name + "-",
Namespace: pvc.Namespace,
Labels: map[string]string{
velerov1api.BackupNameLabel: label.GetValidName(backup.Name),
},
},
Spec: snapshotv1beta1api.VolumeSnapshotSpec{
Source: snapshotv1beta1api.VolumeSnapshotSource{
Spec: snapshotv1api.VolumeSnapshotSpec{
Source: snapshotv1api.VolumeSnapshotSource{
PersistentVolumeClaimName: &pvc.Name,
},
VolumeSnapshotClassName: &snapshotClass.Name,
},
}

upd, err := snapshotClient.SnapshotV1beta1().VolumeSnapshots(pvc.Namespace).Create(context.TODO(), &snapshot, metav1.CreateOptions{})
upd, err := snapshotClient.SnapshotV1().VolumeSnapshots(pvc.Namespace).Create(context.TODO(), &snapshot, metav1.CreateOptions{})
if err != nil {
return nil, nil, errors.Wrapf(err, "error creating volume snapshot")
}
Expand Down
8 changes: 4 additions & 4 deletions internal/backup/volumesnapshot_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/pkg/errors"
"github.com/sirupsen/logrus"

snapshotv1beta1api "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1beta1"
snapshotv1api "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
Expand Down Expand Up @@ -57,7 +57,7 @@ func (p *VolumeSnapshotBackupItemAction) AppliesTo() (velero.ResourceSelector, e
func (p *VolumeSnapshotBackupItemAction) Execute(item runtime.Unstructured, backup *velerov1api.Backup) (runtime.Unstructured, []velero.ResourceIdentifier, error) {
p.Log.Infof("Executing VolumeSnapshotBackupItemAction")

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

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

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

pb := []byte(fmt.Sprintf(`{"metadata":{"labels":{"%s":"%s"}}}`, velerov1api.BackupNameLabel, label.GetValidName(backup.Name)))
if _, vscPatchError := snapshotClient.SnapshotV1beta1().VolumeSnapshotContents().Patch(context.TODO(), vsc.Name, types.MergePatchType, pb, metav1.PatchOptions{}); vscPatchError != nil {
if _, vscPatchError := snapshotClient.SnapshotV1().VolumeSnapshotContents().Patch(context.TODO(), vsc.Name, types.MergePatchType, pb, metav1.PatchOptions{}); vscPatchError != nil {
p.Log.Warnf("Failed to patch volumesnapshotcontent %s: %v", vsc.Name, vscPatchError)
}
}
Expand Down
4 changes: 2 additions & 2 deletions internal/backup/volumesnapshotclass_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/pkg/errors"
"github.com/sirupsen/logrus"

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

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

var snapClass snapshotv1beta1api.VolumeSnapshotClass
var snapClass snapshotv1api.VolumeSnapshotClass
if err := runtime.DefaultUnstructuredConverter.FromUnstructured(item.UnstructuredContent(), &snapClass); err != nil {
return nil, nil, errors.WithStack(err)
}
Expand Down
4 changes: 2 additions & 2 deletions internal/backup/volumesnapshotcontent_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ limitations under the License.
package backup

import (
snapshotv1api "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"

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

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

var snapCont snapshotv1beta1api.VolumeSnapshotContent
var snapCont snapshotv1api.VolumeSnapshotContent
if err := runtime.DefaultUnstructuredConverter.FromUnstructured(item.UnstructuredContent(), &snapCont); err != nil {
return nil, nil, errors.WithStack(err)
}
Expand Down
8 changes: 4 additions & 4 deletions internal/delete/volumesnapshot_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"

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

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

var vs snapshotv1beta1api.VolumeSnapshot
var vs snapshotv1api.VolumeSnapshot

if err := runtime.DefaultUnstructuredConverter.FromUnstructured(input.Item.UnstructuredContent(), &vs); err != nil {
return errors.Wrapf(err, "failed to convert input.Item from unstructured")
Expand All @@ -54,7 +54,7 @@ func (p *VolumeSnapshotDeleteItemAction) Execute(input *velero.DeleteItemActionE
if vs.Status != nil && vs.Status.BoundVolumeSnapshotContentName != nil {
// we patch the DeletionPolicy of the volumesnapshotcontent to set it to Delete.
// This ensures that the volume snapshot in the storage provider is also deleted.
err := util.SetVolumeSnapshotContentDeletionPolicy(*vs.Status.BoundVolumeSnapshotContentName, snapClient.SnapshotV1beta1())
err := util.SetVolumeSnapshotContentDeletionPolicy(*vs.Status.BoundVolumeSnapshotContentName, snapClient.SnapshotV1())
if err != nil && !apierrors.IsNotFound(err) {
return errors.Wrapf(err, fmt.Sprintf("failed to patch DeletionPolicy of volume snapshot %s/%s", vs.Namespace, vs.Name))
}
Expand All @@ -63,7 +63,7 @@ func (p *VolumeSnapshotDeleteItemAction) Execute(input *velero.DeleteItemActionE
return nil
}
}
err = snapClient.SnapshotV1beta1().VolumeSnapshots(vs.Namespace).Delete(context.TODO(), vs.Name, metav1.DeleteOptions{})
err = snapClient.SnapshotV1().VolumeSnapshots(vs.Namespace).Delete(context.TODO(), vs.Name, metav1.DeleteOptions{})
if err != nil && !apierrors.IsNotFound(err) {
return err
}
Expand Down
8 changes: 4 additions & 4 deletions internal/delete/volumesnapshotcontent_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"

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

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

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

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

err = snapClient.SnapshotV1beta1().VolumeSnapshotContents().Delete(context.TODO(), snapCont.Name, metav1.DeleteOptions{})
err = snapClient.SnapshotV1().VolumeSnapshotContents().Delete(context.TODO(), snapCont.Name, metav1.DeleteOptions{})
if err != nil && !apierrors.IsNotFound(err) {
p.Log.Infof("VolumeSnapshotContent %s not found", snapCont.Name)
return err
Expand Down
6 changes: 3 additions & 3 deletions internal/restore/pvc_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import (
"context"
"fmt"

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

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

vs, err := snapClient.SnapshotV1beta1().VolumeSnapshots(pvc.Namespace).Get(context.TODO(), volumeSnapshotName, metav1.GetOptions{})
vs, err := snapClient.SnapshotV1().VolumeSnapshots(pvc.Namespace).Get(context.TODO(), volumeSnapshotName, metav1.GetOptions{})
if err != nil {
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))
}
Expand Down
20 changes: 10 additions & 10 deletions internal/restore/volumesnapshot_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/pkg/errors"
"github.com/sirupsen/logrus"

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

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

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

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

// TODO: generated name will be like velero-velero-something. Fix that.
vsc := snapshotv1beta1api.VolumeSnapshotContent{
vsc := snapshotv1api.VolumeSnapshotContent{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "velero-" + vs.Name + "-",
Labels: map[string]string{
velerov1api.RestoreNameLabel: label.GetValidName(input.Restore.Name),
},
},
Spec: snapshotv1beta1api.VolumeSnapshotContentSpec{
DeletionPolicy: snapshotv1beta1api.DeletionPolicy(deletionPolicy),
Spec: snapshotv1api.VolumeSnapshotContentSpec{
DeletionPolicy: snapshotv1api.DeletionPolicy(deletionPolicy),
Driver: csiDriverName,
VolumeSnapshotRef: core_v1.ObjectReference{
Kind: "VolumeSnapshot",
Namespace: vs.Namespace,
Name: vs.Name,
},
Source: snapshotv1beta1api.VolumeSnapshotContentSource{
Source: snapshotv1api.VolumeSnapshotContentSource{
SnapshotHandle: &snapHandle,
},
},
Expand All @@ -121,7 +121,7 @@ func (p *VolumeSnapshotRestoreItemAction) Execute(input *velero.RestoreItemActio
// between the volumesnapshotcontent and volumesnapshot objects have to be setup.
// Further, it is disallowed to convert a dynamically created volumesnapshotcontent for static binding.
// See: https://github.com/kubernetes-csi/external-snapshotter/issues/274
vscupd, err := snapClient.SnapshotV1beta1().VolumeSnapshotContents().Create(context.TODO(), &vsc, metav1.CreateOptions{})
vscupd, err := snapClient.SnapshotV1().VolumeSnapshotContents().Create(context.TODO(), &vsc, metav1.CreateOptions{})
if err != nil {
return nil, errors.Wrapf(err, "failed to create volumesnapshotcontents %s", vsc.GenerateName)
}
Expand Down
Loading

0 comments on commit bec108a

Please sign in to comment.