Skip to content

Commit

Permalink
add groupversion field in the args
Browse files Browse the repository at this point in the history
Signed-off-by: Amruta Kale <[email protected]>
  • Loading branch information
kale-amruta committed Aug 30, 2023
1 parent 0af2e9d commit 30aa78c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/kube/volume/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/kubernetes"

Expand Down Expand Up @@ -116,6 +117,7 @@ type CreatePVCFromSnapshotArgs struct {
Annotations map[string]string
VolumeMode *v1.PersistentVolumeMode
AccessModes []v1.PersistentVolumeAccessMode
GroupVersion *schema.GroupVersion
}

// CreatePVCFromSnapshot will restore a volume and returns the resulting
Expand All @@ -131,6 +133,10 @@ func CreatePVCFromSnapshot(ctx context.Context, args *CreatePVCFromSnapshotArgs)
}
snapshotKind := "VolumeSnapshot"
snapshotAPIGroup := "snapshot.storage.k8s.io"
if args.GroupVersion != nil {
snapshotAPIGroup = args.GroupVersion.String()
}

pvc := &v1.PersistentVolumeClaim{
ObjectMeta: metav1.ObjectMeta{
Labels: args.Labels,
Expand Down

0 comments on commit 30aa78c

Please sign in to comment.