SyncUnreadyGroupSnapshot and related functions
This commit is contained in:
@@ -3,6 +3,7 @@ package utils
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
crdv1alpha1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumegroupsnapshot/v1alpha1"
|
||||
|
||||
crdv1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1"
|
||||
clientset "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned"
|
||||
@@ -56,3 +57,23 @@ func PatchVolumeSnapshot(
|
||||
|
||||
return newSnapshot, nil
|
||||
}
|
||||
|
||||
// PatchVolumeGroupSnapshotContent patches a volume group snapshot content object
|
||||
func PatchVolumeGroupSnapshotContent(
|
||||
existingGroupSnapshotContent *crdv1alpha1.VolumeGroupSnapshotContent,
|
||||
patch []PatchOp,
|
||||
client clientset.Interface,
|
||||
subresources ...string,
|
||||
) (*crdv1alpha1.VolumeGroupSnapshotContent, error) {
|
||||
data, err := json.Marshal(patch)
|
||||
if nil != err {
|
||||
return existingGroupSnapshotContent, err
|
||||
}
|
||||
|
||||
newGroupSnapshotContent, err := client.GroupsnapshotV1alpha1().VolumeGroupSnapshotContents().Patch(context.TODO(), existingGroupSnapshotContent.Name, types.JSONPatchType, data, metav1.PatchOptions{}, subresources...)
|
||||
if err != nil {
|
||||
return existingGroupSnapshotContent, err
|
||||
}
|
||||
|
||||
return newGroupSnapshotContent, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user