@@ -24,7 +24,7 @@ import (
2424
2525 "k8s.io/client-go/util/retry"
2626
27- volumegroupsnapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumegroupsnapshot/v1beta1 "
27+ volumegroupsnapshotv1beta2 "github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumegroupsnapshot/v1beta2 "
2828 snapshotv1api "github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1"
2929 "github.com/pkg/errors"
3030 "github.com/sirupsen/logrus"
@@ -765,7 +765,7 @@ func (p *pvcBackupItemAction) getVolumeSnapshotReference(
765765 }
766766
767767 // Re-fetch latest VGS to ensure status is populated after VGSC binding
768- latestVGS := & volumegroupsnapshotv1beta1 .VolumeGroupSnapshot {}
768+ latestVGS := & volumegroupsnapshotv1beta2 .VolumeGroupSnapshot {}
769769 if err := p .crClient .Get (ctx , crclient .ObjectKeyFromObject (newVGS ), latestVGS ); err != nil {
770770 return nil , errors .Wrapf (err , "failed to re-fetch VolumeGroupSnapshot %s after VGSC binding wait" , newVGS .Name )
771771 }
@@ -913,7 +913,7 @@ func (p *pvcBackupItemAction) determineVGSClass(
913913 }
914914
915915 // 3. Fallback to label-based default
916- vgsClassList := & volumegroupsnapshotv1beta1 .VolumeGroupSnapshotClassList {}
916+ vgsClassList := & volumegroupsnapshotv1beta2 .VolumeGroupSnapshotClassList {}
917917 if err := p .crClient .List (ctx , vgsClassList ); err != nil {
918918 return "" , errors .Wrap (err , "failed to list VolumeGroupSnapshotClasses" )
919919 }
@@ -942,22 +942,22 @@ func (p *pvcBackupItemAction) createVolumeGroupSnapshot(
942942 backup * velerov1api.Backup ,
943943 pvc corev1api.PersistentVolumeClaim ,
944944 vgsLabelKey , vgsLabelValue , vgsClassName string ,
945- ) (* volumegroupsnapshotv1beta1 .VolumeGroupSnapshot , error ) {
945+ ) (* volumegroupsnapshotv1beta2 .VolumeGroupSnapshot , error ) {
946946 vgsLabels := map [string ]string {
947947 velerov1api .BackupNameLabel : label .GetValidName (backup .Name ),
948948 velerov1api .BackupUIDLabel : string (backup .UID ),
949949 vgsLabelKey : vgsLabelValue ,
950950 }
951951
952- vgs := & volumegroupsnapshotv1beta1 .VolumeGroupSnapshot {
952+ vgs := & volumegroupsnapshotv1beta2 .VolumeGroupSnapshot {
953953 ObjectMeta : metav1.ObjectMeta {
954954 GenerateName : fmt .Sprintf ("velero-%s-" , vgsLabelValue ),
955955 Namespace : pvc .Namespace ,
956956 Labels : vgsLabels ,
957957 },
958- Spec : volumegroupsnapshotv1beta1 .VolumeGroupSnapshotSpec {
958+ Spec : volumegroupsnapshotv1beta2 .VolumeGroupSnapshotSpec {
959959 VolumeGroupSnapshotClassName : & vgsClassName ,
960- Source : volumegroupsnapshotv1beta1 .VolumeGroupSnapshotSource {
960+ Source : volumegroupsnapshotv1beta2 .VolumeGroupSnapshotSource {
961961 Selector : & metav1.LabelSelector {
962962 MatchLabels : map [string ]string {
963963 vgsLabelKey : vgsLabelValue ,
@@ -985,7 +985,7 @@ func (p *pvcBackupItemAction) createVolumeGroupSnapshot(
985985func (p * pvcBackupItemAction ) waitForVGSAssociatedVS (
986986 ctx context.Context ,
987987 groupedPVCs []corev1api.PersistentVolumeClaim ,
988- vgs * volumegroupsnapshotv1beta1 .VolumeGroupSnapshot ,
988+ vgs * volumegroupsnapshotv1beta2 .VolumeGroupSnapshot ,
989989 timeout time.Duration ,
990990) (map [string ]* snapshotv1api.VolumeSnapshot , error ) {
991991 expected := len (groupedPVCs )
@@ -1028,10 +1028,10 @@ func (p *pvcBackupItemAction) waitForVGSAssociatedVS(
10281028 return vsMap , nil
10291029}
10301030
1031- func hasOwnerReference (obj metav1.Object , vgs * volumegroupsnapshotv1beta1 .VolumeGroupSnapshot ) bool {
1031+ func hasOwnerReference (obj metav1.Object , vgs * volumegroupsnapshotv1beta2 .VolumeGroupSnapshot ) bool {
10321032 for _ , ref := range obj .GetOwnerReferences () {
10331033 if ref .Kind == kuberesource .VGSKind &&
1034- ref .APIVersion == volumegroupsnapshotv1beta1 .GroupName + "/" + volumegroupsnapshotv1beta1 .SchemeGroupVersion .Version &&
1034+ ref .APIVersion == volumegroupsnapshotv1beta2 .GroupName + "/" + volumegroupsnapshotv1beta2 .SchemeGroupVersion .Version &&
10351035 ref .UID == vgs .UID {
10361036 return true
10371037 }
@@ -1042,7 +1042,7 @@ func hasOwnerReference(obj metav1.Object, vgs *volumegroupsnapshotv1beta1.Volume
10421042func (p * pvcBackupItemAction ) updateVGSCreatedVS (
10431043 ctx context.Context ,
10441044 vsMap map [string ]* snapshotv1api.VolumeSnapshot ,
1045- vgs * volumegroupsnapshotv1beta1 .VolumeGroupSnapshot ,
1045+ vgs * volumegroupsnapshotv1beta2 .VolumeGroupSnapshot ,
10461046 backup * velerov1api.Backup ,
10471047) error {
10481048 for pvcName , vs := range vsMap {
@@ -1085,15 +1085,15 @@ func (p *pvcBackupItemAction) updateVGSCreatedVS(
10851085 return nil
10861086}
10871087
1088- func (p * pvcBackupItemAction ) patchVGSCDeletionPolicy (ctx context.Context , vgs * volumegroupsnapshotv1beta1 .VolumeGroupSnapshot ) error {
1088+ func (p * pvcBackupItemAction ) patchVGSCDeletionPolicy (ctx context.Context , vgs * volumegroupsnapshotv1beta2 .VolumeGroupSnapshot ) error {
10891089 if vgs == nil || vgs .Status == nil || vgs .Status .BoundVolumeGroupSnapshotContentName == nil {
10901090 return errors .New ("VolumeGroupSnapshotContent name not found in VGS status" )
10911091 }
10921092
10931093 vgscName := vgs .Status .BoundVolumeGroupSnapshotContentName
10941094
10951095 return retry .RetryOnConflict (retry .DefaultBackoff , func () error {
1096- vgsc := & volumegroupsnapshotv1beta1 .VolumeGroupSnapshotContent {}
1096+ vgsc := & volumegroupsnapshotv1beta2 .VolumeGroupSnapshotContent {}
10971097 if err := p .crClient .Get (ctx , crclient.ObjectKey {Name : * vgscName }, vgsc ); err != nil {
10981098 return errors .Wrapf (err , "failed to get VolumeGroupSnapshotContent %s for VolumeGroupSnapshot %s/%s" , * vgscName , vgs .Namespace , vgs .Name )
10991099 }
@@ -1112,9 +1112,9 @@ func (p *pvcBackupItemAction) patchVGSCDeletionPolicy(ctx context.Context, vgs *
11121112 })
11131113}
11141114
1115- func (p * pvcBackupItemAction ) deleteVGSAndVGSC (ctx context.Context , vgs * volumegroupsnapshotv1beta1 .VolumeGroupSnapshot ) error {
1115+ func (p * pvcBackupItemAction ) deleteVGSAndVGSC (ctx context.Context , vgs * volumegroupsnapshotv1beta2 .VolumeGroupSnapshot ) error {
11161116 if vgs .Status != nil && vgs .Status .BoundVolumeGroupSnapshotContentName != nil {
1117- vgsc := & volumegroupsnapshotv1beta1 .VolumeGroupSnapshotContent {
1117+ vgsc := & volumegroupsnapshotv1beta2 .VolumeGroupSnapshotContent {
11181118 ObjectMeta : metav1.ObjectMeta {
11191119 Name : * vgs .Status .BoundVolumeGroupSnapshotContentName ,
11201120 },
@@ -1139,11 +1139,11 @@ func (p *pvcBackupItemAction) deleteVGSAndVGSC(ctx context.Context, vgs *volumeg
11391139
11401140func (p * pvcBackupItemAction ) waitForVGSCBinding (
11411141 ctx context.Context ,
1142- vgs * volumegroupsnapshotv1beta1 .VolumeGroupSnapshot ,
1142+ vgs * volumegroupsnapshotv1beta2 .VolumeGroupSnapshot ,
11431143 timeout time.Duration ,
11441144) error {
11451145 return wait .PollUntilContextTimeout (ctx , time .Second , timeout , true , func (ctx context.Context ) (bool , error ) {
1146- vgsRef := & volumegroupsnapshotv1beta1 .VolumeGroupSnapshot {}
1146+ vgsRef := & volumegroupsnapshotv1beta2 .VolumeGroupSnapshot {}
11471147 if err := p .crClient .Get (ctx , crclient .ObjectKeyFromObject (vgs ), vgsRef ); err != nil {
11481148 return false , err
11491149 }
@@ -1156,8 +1156,8 @@ func (p *pvcBackupItemAction) waitForVGSCBinding(
11561156 })
11571157}
11581158
1159- func (p * pvcBackupItemAction ) getVGSByLabels (ctx context.Context , namespace string , labels map [string ]string ) (* volumegroupsnapshotv1beta1 .VolumeGroupSnapshot , error ) {
1160- vgsList := & volumegroupsnapshotv1beta1 .VolumeGroupSnapshotList {}
1159+ func (p * pvcBackupItemAction ) getVGSByLabels (ctx context.Context , namespace string , labels map [string ]string ) (* volumegroupsnapshotv1beta2 .VolumeGroupSnapshot , error ) {
1160+ vgsList := & volumegroupsnapshotv1beta2 .VolumeGroupSnapshotList {}
11611161 if err := p .crClient .List (ctx , vgsList ,
11621162 crclient .InNamespace (namespace ),
11631163 crclient .MatchingLabels (labels ),
0 commit comments