Add Happy Path VolumeAttributesClass CSI E2E Tests

Signed-off-by: Connor Catlett <conncatl@amazon.com>
This commit is contained in:
Connor Catlett
2024-04-03 19:25:45 +00:00
parent a2911e06a7
commit ea58abfd99
13 changed files with 483 additions and 21 deletions

View File

@@ -21,6 +21,7 @@ import (
"fmt"
storagev1 "k8s.io/api/storage/v1"
storagev1alpha1 "k8s.io/api/storage/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apiserver/pkg/storage/names"
"k8s.io/kubernetes/pkg/volume/util"
@@ -92,3 +93,13 @@ func GetStorageClass(
VolumeBindingMode: bindingMode,
}
}
// CopyVolumeAttributesClass constructs a new VolumeAttributesClass instance
// with a unique name that is based on namespace + suffix
// using the VolumeAttributesClass passed in as a parameter
func CopyVolumeAttributesClass(vac *storagev1alpha1.VolumeAttributesClass, ns string, suffix string) *storagev1alpha1.VolumeAttributesClass {
copy := vac.DeepCopy()
copy.ObjectMeta.Name = names.SimpleNameGenerator.GenerateName(ns + "-" + suffix)
copy.ResourceVersion = ""
return copy
}