Skip to content

Commit

Permalink
Move default storage class annotation.
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Arnold <[email protected]>
  • Loading branch information
mrnold committed Aug 16, 2024
1 parent 2a81385 commit 3ac6b1f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions tests/e2e/lib/virt_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const (
emulationAnnotation = "kubevirt.kubevirt.io/jsonpatch"
useEmulation = `[{"op": "add", "path": "/spec/configuration/developerConfiguration", "value": {"useEmulation": true}}]`
stopVmPath = "/apis/subresources.kubevirt.io/v1/namespaces/%s/virtualmachines/%s/stop"
isDefaultClass = "storageclass.kubernetes.io/is-default-class"
)

var packageManifestsGvr = schema.GroupVersionResource{
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/lib/virt_storage_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func (v *VirtOperator) CreateImmediateModeStorageClass(name string) error {
}
var defaultStorageClass *storagev1.StorageClass
for _, storageClass := range storageClasses.Items {
if storageClass.Annotations["storageclass.kubernetes.io/is-default-class"] == "true" {
if storageClass.Annotations[isDefaultClass] == "true" {
log.Printf("Found default storage class: %s", storageClass.Name)
defaultStorageClass = storageClass.DeepCopy()
if storageClass.VolumeBindingMode != nil && *storageClass.VolumeBindingMode == storagev1.VolumeBindingImmediate {
Expand All @@ -235,7 +235,7 @@ func (v *VirtOperator) CreateImmediateModeStorageClass(name string) error {
immediateStorageClass.VolumeBindingMode = ptr.To[storagev1.VolumeBindingMode](storagev1.VolumeBindingImmediate)
immediateStorageClass.Name = name
immediateStorageClass.ResourceVersion = ""
immediateStorageClass.Annotations["storageclass.kubernetes.io/is-default-class"] = "false"
immediateStorageClass.Annotations[isDefaultClass] = "false"

_, err = v.Clientset.StorageV1().StorageClasses().Create(context.Background(), immediateStorageClass, metav1.CreateOptions{})
return err
Expand Down

0 comments on commit 3ac6b1f

Please sign in to comment.