mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 09:52:49 +00:00
Remove the use of storage class beta annotations in e2e tests.
This commit is contained in:
parent
a5c3c8d16c
commit
1f80008f41
@ -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)
|
||||
|
@ -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 == "" {
|
||||
|
@ -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)
|
||||
|
@ -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,
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -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")
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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")
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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())
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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++
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user