diff --git a/test/e2e/autoscaling/cluster_size_autoscaling.go b/test/e2e/autoscaling/cluster_size_autoscaling.go index 5ca3e9ae58b..ae9af114883 100644 --- a/test/e2e/autoscaling/cluster_size_autoscaling.go +++ b/test/e2e/autoscaling/cluster_size_autoscaling.go @@ -360,11 +360,10 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() { }, Prebind: nil, } + emptyStorageClass := "" pvcConfig := framework.PersistentVolumeClaimConfig{ - Annotations: map[string]string{ - v1.BetaStorageClassAnnotation: "", - }, - Selector: selector, + Selector: selector, + StorageClassName: &emptyStorageClass, } pv, pvc, err := framework.CreatePVPVC(c, pvConfig, pvcConfig, f.Namespace.Name, false) diff --git a/test/e2e/storage/nfs_persistent_volume-disruptive.go b/test/e2e/storage/nfs_persistent_volume-disruptive.go index 55b77b48f6e..093924a3b16 100644 --- a/test/e2e/storage/nfs_persistent_volume-disruptive.go +++ b/test/e2e/storage/nfs_persistent_volume-disruptive.go @@ -78,11 +78,10 @@ var _ = utils.SIGDescribe("NFSPersistentVolumes[Disruptive][Flaky]", func() { }, }, } + emptyStorageClass := "" pvcConfig = framework.PersistentVolumeClaimConfig{ - Annotations: map[string]string{ - v1.BetaStorageClassAnnotation: "", - }, - Selector: selector, + Selector: selector, + StorageClassName: &emptyStorageClass, } // Get the first ready node IP that is not hosting the NFS pod. if clientNodeIP == "" { diff --git a/test/e2e/storage/persistent_volumes-gce.go b/test/e2e/storage/persistent_volumes-gce.go index 08a2c4afa4a..d860ce009e3 100644 --- a/test/e2e/storage/persistent_volumes-gce.go +++ b/test/e2e/storage/persistent_volumes-gce.go @@ -93,11 +93,10 @@ var _ = utils.SIGDescribe("PersistentVolumes GCEPD", func() { }, Prebind: nil, } + emptyStorageClass := "" pvcConfig = framework.PersistentVolumeClaimConfig{ - Annotations: map[string]string{ - v1.BetaStorageClassAnnotation: "", - }, - Selector: selector, + Selector: selector, + StorageClassName: &emptyStorageClass, } clientPod, pv, pvc = initializeGCETestSpec(c, ns, pvConfig, pvcConfig, false) node = types.NodeName(clientPod.Spec.NodeName) diff --git a/test/e2e/storage/persistent_volumes.go b/test/e2e/storage/persistent_volumes.go index 53d28b39bcf..36e166d6c26 100644 --- a/test/e2e/storage/persistent_volumes.go +++ b/test/e2e/storage/persistent_volumes.go @@ -132,11 +132,10 @@ var _ = utils.SIGDescribe("PersistentVolumes", func() { }, }, } + emptyStorageClass := "" pvcConfig = framework.PersistentVolumeClaimConfig{ - Annotations: map[string]string{ - v1.BetaStorageClassAnnotation: "", - }, - Selector: selector, + Selector: selector, + StorageClassName: &emptyStorageClass, } }) diff --git a/test/e2e/storage/pv_protection.go b/test/e2e/storage/pv_protection.go index 4c698f3f0bb..363e212fb52 100644 --- a/test/e2e/storage/pv_protection.go +++ b/test/e2e/storage/pv_protection.go @@ -64,11 +64,10 @@ var _ = utils.SIGDescribe("PV Protection", func() { }, } + emptyStorageClass := "" pvcConfig = framework.PersistentVolumeClaimConfig{ - Annotations: map[string]string{ - v1.BetaStorageClassAnnotation: "", - }, - Selector: selector, + Selector: selector, + StorageClassName: &emptyStorageClass, } By("Creating a PV") diff --git a/test/e2e/storage/volume_provisioning.go b/test/e2e/storage/volume_provisioning.go index 97cbaa72c7a..17111d696e2 100644 --- a/test/e2e/storage/volume_provisioning.go +++ b/test/e2e/storage/volume_provisioning.go @@ -42,7 +42,6 @@ import ( "k8s.io/apimachinery/pkg/util/wait" "k8s.io/apiserver/pkg/authentication/serviceaccount" clientset "k8s.io/client-go/kubernetes" - v1helper "k8s.io/kubernetes/pkg/apis/core/v1/helper" storageutil "k8s.io/kubernetes/pkg/apis/storage/v1/util" "k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/storage/utils" @@ -250,6 +249,7 @@ var _ = utils.SIGDescribe("Dynamic Provisioning", func() { // This test checks that dynamic provisioning can provision a volume // that can be used to persist data among pods. tests := []storageClassTest{ + // GCE/GKE { name: "SSD PD on GCE/GKE", cloudProviders: []string{"gce", "gke"}, @@ -377,6 +377,7 @@ var _ = utils.SIGDescribe("Dynamic Provisioning", func() { expectedSize: "1.5Gi", pvCheck: nil, }, + // Azure { name: "Azure disk volume with empty sku and location", cloudProviders: []string{"azure"}, @@ -410,7 +411,7 @@ var _ = utils.SIGDescribe("Dynamic Provisioning", func() { testDynamicProvisioning(test, c, claim, class) } - // Run the last test with storage.k8s.io/v1beta1 and beta annotation on pvc + // Run the last test with storage.k8s.io/v1beta1 on pvc if betaTest != nil { By("Testing " + betaTest.name + " with beta volume provisioning") class := newBetaStorageClass(*betaTest, "beta") @@ -420,9 +421,7 @@ var _ = utils.SIGDescribe("Dynamic Provisioning", func() { defer deleteStorageClass(c, class.Name) claim := newClaim(*betaTest, ns, "beta") - claim.Annotations = map[string]string{ - v1.BetaStorageClassAnnotation: class.Name, - } + claim.Spec.StorageClassName = &(class.Name) testDynamicProvisioning(*betaTest, c, claim, nil) } }) @@ -692,14 +691,8 @@ var _ = utils.SIGDescribe("Dynamic Provisioning", func() { expectedSize: "1500Mi", } class := newStorageClass(test, ns, "external") - className := class.Name claim := newClaim(test, ns, "external") - // the external provisioner understands Beta only right now, see - // https://github.com/kubernetes-incubator/external-storage/issues/37 - // claim.Spec.StorageClassName = &className - claim.Annotations = map[string]string{ - v1.BetaStorageClassAnnotation: className, - } + claim.Spec.StorageClassName = &(class.Name) By("creating a claim with a external provisioning annotation") testDynamicProvisioning(test, c, claim, class) @@ -953,8 +946,7 @@ func newStorageClass(t storageClassTest, ns string, suffix string) *storage.Stor } } -// TODO: remove when storage.k8s.io/v1beta1 and beta storage class annotations -// are removed. +// TODO: remove when storage.k8s.io/v1beta1 is removed. func newBetaStorageClass(t storageClassTest, suffix string) *storagebeta.StorageClass { pluginName := t.provisioner @@ -1063,7 +1055,7 @@ func waitForProvisionedVolumesDeleted(c clientset.Interface, scName string) ([]* return true, err } for _, pv := range allPVs.Items { - if v1helper.GetPersistentVolumeClass(&pv) == scName { + if pv.Spec.StorageClassName == scName { remainingPVs = append(remainingPVs, &pv) } } diff --git a/test/e2e/storage/vsphere/persistent_volumes-vsphere.go b/test/e2e/storage/vsphere/persistent_volumes-vsphere.go index 7fc55628ac4..49e2e1db5b7 100644 --- a/test/e2e/storage/vsphere/persistent_volumes-vsphere.go +++ b/test/e2e/storage/vsphere/persistent_volumes-vsphere.go @@ -87,11 +87,10 @@ var _ = utils.SIGDescribe("PersistentVolumes:vsphere", func() { }, Prebind: nil, } + emptyStorageClass := "" pvcConfig = framework.PersistentVolumeClaimConfig{ - Annotations: map[string]string{ - v1.BetaStorageClassAnnotation: "", - }, - Selector: selector, + Selector: selector, + StorageClassName: &emptyStorageClass, } } By("Creating the PV and PVC") diff --git a/test/e2e/storage/vsphere/vsphere_scale.go b/test/e2e/storage/vsphere/vsphere_scale.go index 573236ab35a..f09249991f8 100644 --- a/test/e2e/storage/vsphere/vsphere_scale.go +++ b/test/e2e/storage/vsphere/vsphere_scale.go @@ -192,7 +192,7 @@ func VolumeCreateAndAttach(client clientset.Interface, namespace string, sc []*s pvclaims := make([]*v1.PersistentVolumeClaim, volumesPerPod) for i := 0; i < volumesPerPod; i++ { By("Creating PVC using the Storage Class") - pvclaim, err := framework.CreatePVC(client, namespace, getVSphereClaimSpecWithStorageClassAnnotation(namespace, "2Gi", sc[index%len(sc)])) + pvclaim, err := framework.CreatePVC(client, namespace, getVSphereClaimSpecWithStorageClass(namespace, "2Gi", sc[index%len(sc)])) Expect(err).NotTo(HaveOccurred()) pvclaims[i] = pvclaim } diff --git a/test/e2e/storage/vsphere/vsphere_stress.go b/test/e2e/storage/vsphere/vsphere_stress.go index 59441a77138..260fe84039f 100644 --- a/test/e2e/storage/vsphere/vsphere_stress.go +++ b/test/e2e/storage/vsphere/vsphere_stress.go @@ -128,7 +128,7 @@ func PerformVolumeLifeCycleInParallel(f *framework.Framework, client clientset.I for iterationCount := 0; iterationCount < iterations; iterationCount++ { logPrefix := fmt.Sprintf("Instance: [%v], Iteration: [%v] :", instanceId, iterationCount+1) By(fmt.Sprintf("%v Creating PVC using the Storage Class: %v", logPrefix, sc.Name)) - pvclaim, err := framework.CreatePVC(client, namespace, getVSphereClaimSpecWithStorageClassAnnotation(namespace, "1Gi", sc)) + pvclaim, err := framework.CreatePVC(client, namespace, getVSphereClaimSpecWithStorageClass(namespace, "1Gi", sc)) Expect(err).NotTo(HaveOccurred()) defer framework.DeletePersistentVolumeClaim(client, pvclaim.Name, namespace) diff --git a/test/e2e/storage/vsphere/vsphere_utils.go b/test/e2e/storage/vsphere/vsphere_utils.go index f4fb2a817b1..904f02ebe72 100644 --- a/test/e2e/storage/vsphere/vsphere_utils.go +++ b/test/e2e/storage/vsphere/vsphere_utils.go @@ -252,15 +252,11 @@ func getVSphereStorageClassSpec(name string, scParameters map[string]string) *st return sc } -func getVSphereClaimSpecWithStorageClassAnnotation(ns string, diskSize string, storageclass *storage.StorageClass) *v1.PersistentVolumeClaim { - scAnnotation := make(map[string]string) - scAnnotation[v1.BetaStorageClassAnnotation] = storageclass.Name - +func getVSphereClaimSpecWithStorageClass(ns string, diskSize string, storageclass *storage.StorageClass) *v1.PersistentVolumeClaim { claim := &v1.PersistentVolumeClaim{ ObjectMeta: metav1.ObjectMeta{ GenerateName: "pvc-", Namespace: ns, - Annotations: scAnnotation, }, Spec: v1.PersistentVolumeClaimSpec{ AccessModes: []v1.PersistentVolumeAccessMode{ @@ -271,6 +267,7 @@ func getVSphereClaimSpecWithStorageClassAnnotation(ns string, diskSize string, s v1.ResourceName(v1.ResourceStorage): resource.MustParse(diskSize), }, }, + StorageClassName: &(storageclass.Name), }, } return claim diff --git a/test/e2e/storage/vsphere/vsphere_volume_datastore.go b/test/e2e/storage/vsphere/vsphere_volume_datastore.go index 8ac75de2983..fcb964b7c17 100644 --- a/test/e2e/storage/vsphere/vsphere_volume_datastore.go +++ b/test/e2e/storage/vsphere/vsphere_volume_datastore.go @@ -84,7 +84,7 @@ func invokeInvalidDatastoreTestNeg(client clientset.Interface, namespace string, defer client.StorageV1().StorageClasses().Delete(storageclass.Name, nil) By("Creating PVC using the Storage Class") - pvclaim, err := framework.CreatePVC(client, namespace, getVSphereClaimSpecWithStorageClassAnnotation(namespace, "2Gi", storageclass)) + pvclaim, err := framework.CreatePVC(client, namespace, getVSphereClaimSpecWithStorageClass(namespace, "2Gi", storageclass)) Expect(err).NotTo(HaveOccurred()) defer framework.DeletePersistentVolumeClaim(client, pvclaim.Name, namespace) diff --git a/test/e2e/storage/vsphere/vsphere_volume_diskformat.go b/test/e2e/storage/vsphere/vsphere_volume_diskformat.go index 9a94a5439f9..ca90fdf09ac 100644 --- a/test/e2e/storage/vsphere/vsphere_volume_diskformat.go +++ b/test/e2e/storage/vsphere/vsphere_volume_diskformat.go @@ -113,7 +113,7 @@ func invokeTest(f *framework.Framework, client clientset.Interface, namespace st defer client.StorageV1().StorageClasses().Delete(storageclass.Name, nil) By("Creating PVC using the Storage Class") - pvclaimSpec := getVSphereClaimSpecWithStorageClassAnnotation(namespace, "2Gi", storageclass) + pvclaimSpec := getVSphereClaimSpecWithStorageClass(namespace, "2Gi", storageclass) pvclaim, err := client.CoreV1().PersistentVolumeClaims(namespace).Create(pvclaimSpec) Expect(err).NotTo(HaveOccurred()) diff --git a/test/e2e/storage/vsphere/vsphere_volume_disksize.go b/test/e2e/storage/vsphere/vsphere_volume_disksize.go index 8144f38a186..5e58a81bfc3 100644 --- a/test/e2e/storage/vsphere/vsphere_volume_disksize.go +++ b/test/e2e/storage/vsphere/vsphere_volume_disksize.go @@ -82,7 +82,7 @@ func invokeInvalidDiskSizeTestNeg(client clientset.Interface, namespace string, defer client.StorageV1().StorageClasses().Delete(storageclass.Name, nil) By("Creating PVC using the Storage Class") - pvclaim, err := framework.CreatePVC(client, namespace, getVSphereClaimSpecWithStorageClassAnnotation(namespace, diskSize, storageclass)) + pvclaim, err := framework.CreatePVC(client, namespace, getVSphereClaimSpecWithStorageClass(namespace, diskSize, storageclass)) Expect(err).NotTo(HaveOccurred()) defer framework.DeletePersistentVolumeClaim(client, pvclaim.Name, namespace) diff --git a/test/e2e/storage/vsphere/vsphere_volume_fstype.go b/test/e2e/storage/vsphere/vsphere_volume_fstype.go index b631c3b0ba9..74ae2a34fe0 100644 --- a/test/e2e/storage/vsphere/vsphere_volume_fstype.go +++ b/test/e2e/storage/vsphere/vsphere_volume_fstype.go @@ -151,7 +151,7 @@ func createVolume(client clientset.Interface, namespace string, scParameters map defer client.StorageV1().StorageClasses().Delete(storageclass.Name, nil) By("Creating PVC using the Storage Class") - pvclaim, err := client.CoreV1().PersistentVolumeClaims(namespace).Create(getVSphereClaimSpecWithStorageClassAnnotation(namespace, "2Gi", storageclass)) + pvclaim, err := client.CoreV1().PersistentVolumeClaims(namespace).Create(getVSphereClaimSpecWithStorageClass(namespace, "2Gi", storageclass)) Expect(err).NotTo(HaveOccurred()) var pvclaims []*v1.PersistentVolumeClaim diff --git a/test/e2e/storage/vsphere/vsphere_volume_node_poweroff.go b/test/e2e/storage/vsphere/vsphere_volume_node_poweroff.go index adf3fc7212a..e9788b3ab2a 100644 --- a/test/e2e/storage/vsphere/vsphere_volume_node_poweroff.go +++ b/test/e2e/storage/vsphere/vsphere_volume_node_poweroff.go @@ -81,7 +81,7 @@ var _ = utils.SIGDescribe("Node Poweroff [Feature:vsphere] [Slow] [Disruptive]", defer client.StorageV1().StorageClasses().Delete(storageclass.Name, nil) By("Creating PVC using the Storage Class") - pvclaimSpec := getVSphereClaimSpecWithStorageClassAnnotation(namespace, "1Gi", storageclass) + pvclaimSpec := getVSphereClaimSpecWithStorageClass(namespace, "1Gi", storageclass) pvclaim, err := framework.CreatePVC(client, namespace, pvclaimSpec) Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("Failed to create PVC with err: %v", err)) defer framework.DeletePersistentVolumeClaim(client, pvclaim.Name, namespace) diff --git a/test/e2e/storage/vsphere/vsphere_volume_ops_storm.go b/test/e2e/storage/vsphere/vsphere_volume_ops_storm.go index e6d66463d37..b4d9d8c4a3d 100644 --- a/test/e2e/storage/vsphere/vsphere_volume_ops_storm.go +++ b/test/e2e/storage/vsphere/vsphere_volume_ops_storm.go @@ -93,7 +93,7 @@ var _ = utils.SIGDescribe("Volume Operations Storm [Feature:vsphere]", func() { By("Creating PVCs using the Storage Class") count := 0 for count < volume_ops_scale { - pvclaims[count], err = framework.CreatePVC(client, namespace, getVSphereClaimSpecWithStorageClassAnnotation(namespace, "2Gi", storageclass)) + pvclaims[count], err = framework.CreatePVC(client, namespace, getVSphereClaimSpecWithStorageClass(namespace, "2Gi", storageclass)) Expect(err).NotTo(HaveOccurred()) count++ } diff --git a/test/e2e/storage/vsphere/vsphere_volume_perf.go b/test/e2e/storage/vsphere/vsphere_volume_perf.go index 9c54a738278..b4fe50ba936 100644 --- a/test/e2e/storage/vsphere/vsphere_volume_perf.go +++ b/test/e2e/storage/vsphere/vsphere_volume_perf.go @@ -170,7 +170,7 @@ func invokeVolumeLifeCyclePerformance(f *framework.Framework, client clientset.I var pvclaims []*v1.PersistentVolumeClaim for j := 0; j < volumesPerPod; j++ { currsc := sc[((i*numPods)+j)%len(sc)] - pvclaim, err := framework.CreatePVC(client, namespace, getVSphereClaimSpecWithStorageClassAnnotation(namespace, "2Gi", currsc)) + pvclaim, err := framework.CreatePVC(client, namespace, getVSphereClaimSpecWithStorageClass(namespace, "2Gi", currsc)) Expect(err).NotTo(HaveOccurred()) pvclaims = append(pvclaims, pvclaim) } diff --git a/test/e2e/storage/vsphere/vsphere_volume_vsan_policy.go b/test/e2e/storage/vsphere/vsphere_volume_vsan_policy.go index 74171fc39b4..1f74978fc16 100644 --- a/test/e2e/storage/vsphere/vsphere_volume_vsan_policy.go +++ b/test/e2e/storage/vsphere/vsphere_volume_vsan_policy.go @@ -278,7 +278,7 @@ func invokeValidPolicyTest(f *framework.Framework, client clientset.Interface, n defer client.StorageV1().StorageClasses().Delete(storageclass.Name, nil) By("Creating PVC using the Storage Class") - pvclaim, err := framework.CreatePVC(client, namespace, getVSphereClaimSpecWithStorageClassAnnotation(namespace, "2Gi", storageclass)) + pvclaim, err := framework.CreatePVC(client, namespace, getVSphereClaimSpecWithStorageClass(namespace, "2Gi", storageclass)) Expect(err).NotTo(HaveOccurred()) defer framework.DeletePersistentVolumeClaim(client, pvclaim.Name, namespace) @@ -310,7 +310,7 @@ func invokeInvalidPolicyTestNeg(client clientset.Interface, namespace string, sc defer client.StorageV1().StorageClasses().Delete(storageclass.Name, nil) By("Creating PVC using the Storage Class") - pvclaim, err := framework.CreatePVC(client, namespace, getVSphereClaimSpecWithStorageClassAnnotation(namespace, "2Gi", storageclass)) + pvclaim, err := framework.CreatePVC(client, namespace, getVSphereClaimSpecWithStorageClass(namespace, "2Gi", storageclass)) Expect(err).NotTo(HaveOccurred()) defer framework.DeletePersistentVolumeClaim(client, pvclaim.Name, namespace) @@ -329,7 +329,7 @@ func invokeStaleDummyVMTestWithStoragePolicy(client clientset.Interface, masterN defer client.StorageV1().StorageClasses().Delete(storageclass.Name, nil) By("Creating PVC using the Storage Class") - pvclaim, err := framework.CreatePVC(client, namespace, getVSphereClaimSpecWithStorageClassAnnotation(namespace, "2Gi", storageclass)) + pvclaim, err := framework.CreatePVC(client, namespace, getVSphereClaimSpecWithStorageClass(namespace, "2Gi", storageclass)) Expect(err).NotTo(HaveOccurred()) var pvclaims []*v1.PersistentVolumeClaim diff --git a/test/e2e/upgrades/storage/persistent_volumes.go b/test/e2e/upgrades/storage/persistent_volumes.go index 0c00bc6d5bc..8bfc24de0a1 100644 --- a/test/e2e/upgrades/storage/persistent_volumes.go +++ b/test/e2e/upgrades/storage/persistent_volumes.go @@ -62,11 +62,8 @@ func (t *PersistentVolumeUpgradeTest) Setup(f *framework.Framework) { PVSource: *t.pvSource, Prebind: nil, } - pvcConfig := framework.PersistentVolumeClaimConfig{ - Annotations: map[string]string{ - v1.BetaStorageClassAnnotation: "", - }, - } + emptyStorageClass := "" + pvcConfig := framework.PersistentVolumeClaimConfig{StorageClassName: &emptyStorageClass} By("Creating the PV and PVC") t.pv, t.pvc, err = framework.CreatePVPVC(f.ClientSet, pvConfig, pvcConfig, ns, true)