From 73883c71574c863108dec1b8e046b16da96be2f8 Mon Sep 17 00:00:00 2001 From: Ole Markus With Date: Sat, 6 Aug 2022 13:48:51 +0200 Subject: [PATCH] Remove default annotations from copied storage class --- test/e2e/storage/framework/driver_operations.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/e2e/storage/framework/driver_operations.go b/test/e2e/storage/framework/driver_operations.go index b3326a7fd44..7338c392ee0 100644 --- a/test/e2e/storage/framework/driver_operations.go +++ b/test/e2e/storage/framework/driver_operations.go @@ -22,6 +22,7 @@ import ( storagev1 "k8s.io/api/storage/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apiserver/pkg/storage/names" + "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/test/e2e/framework" ) @@ -57,6 +58,11 @@ func CopyStorageClass(sc *storagev1.StorageClass, ns string, suffix string) *sto copy := sc.DeepCopy() copy.ObjectMeta.Name = names.SimpleNameGenerator.GenerateName(ns + "-" + suffix) copy.ResourceVersion = "" + + // Remove the default annotation from the storage class if they exists. + // Multiple storage classes with this annotation will result in failure. + delete(copy.Annotations, util.BetaIsDefaultStorageClassAnnotation) + delete(copy.Annotations, util.IsDefaultStorageClassAnnotation) return copy }