mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 03:11:40 +00:00
Merge pull request #81943 from dims/update-import-aliases-for-1.16-test-e2e
Use preferred import packages for test/e2e
This commit is contained in:
commit
8f17e46e5c
@ -24,7 +24,7 @@ import (
|
|||||||
|
|
||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
|
|
||||||
corev1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/kubernetes/pkg/version"
|
"k8s.io/kubernetes/pkg/version"
|
||||||
e2elog "k8s.io/kubernetes/test/e2e/framework/log"
|
e2elog "k8s.io/kubernetes/test/e2e/framework/log"
|
||||||
@ -62,7 +62,7 @@ func SetupSuite() {
|
|||||||
metav1.NamespaceSystem,
|
metav1.NamespaceSystem,
|
||||||
metav1.NamespaceDefault,
|
metav1.NamespaceDefault,
|
||||||
metav1.NamespacePublic,
|
metav1.NamespacePublic,
|
||||||
corev1.NamespaceNodeLease,
|
v1.NamespaceNodeLease,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
e2elog.Failf("Error deleting orphaned namespaces: %v", err)
|
e2elog.Failf("Error deleting orphaned namespaces: %v", err)
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
"github.com/onsi/ginkgo"
|
"github.com/onsi/ginkgo"
|
||||||
"github.com/onsi/gomega"
|
"github.com/onsi/gomega"
|
||||||
|
|
||||||
apps "k8s.io/api/apps/v1"
|
appsv1 "k8s.io/api/apps/v1"
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
@ -136,7 +136,7 @@ var _ = SIGDescribe("[Feature:IPv6DualStackAlphaFeature] [LinuxOnly]", func() {
|
|||||||
map[string]string{"test": "dual-stack-server"},
|
map[string]string{"test": "dual-stack-server"},
|
||||||
"dualstack-test-server",
|
"dualstack-test-server",
|
||||||
imageutils.GetE2EImage(imageutils.TestWebserver),
|
imageutils.GetE2EImage(imageutils.TestWebserver),
|
||||||
apps.RollingUpdateDeploymentStrategyType)
|
appsv1.RollingUpdateDeploymentStrategyType)
|
||||||
|
|
||||||
// to ensure all the pods land on different nodes and we can thereby
|
// to ensure all the pods land on different nodes and we can thereby
|
||||||
// validate connectivity across all nodes.
|
// validate connectivity across all nodes.
|
||||||
@ -164,7 +164,7 @@ var _ = SIGDescribe("[Feature:IPv6DualStackAlphaFeature] [LinuxOnly]", func() {
|
|||||||
map[string]string{"test": "dual-stack-client"},
|
map[string]string{"test": "dual-stack-client"},
|
||||||
"dualstack-test-client",
|
"dualstack-test-client",
|
||||||
imageutils.GetE2EImage(imageutils.Agnhost),
|
imageutils.GetE2EImage(imageutils.Agnhost),
|
||||||
apps.RollingUpdateDeploymentStrategyType)
|
appsv1.RollingUpdateDeploymentStrategyType)
|
||||||
|
|
||||||
clientDeploymentSpec.Spec.Template.Spec.Containers[0].Command = []string{"sleep", "3600"}
|
clientDeploymentSpec.Spec.Template.Spec.Containers[0].Command = []string{"sleep", "3600"}
|
||||||
clientDeploymentSpec.Spec.Template.Spec.Affinity = &v1.Affinity{
|
clientDeploymentSpec.Spec.Template.Spec.Affinity = &v1.Affinity{
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
"github.com/onsi/gomega"
|
"github.com/onsi/gomega"
|
||||||
|
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
storage "k8s.io/api/storage/v1"
|
storagev1 "k8s.io/api/storage/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
volumeevents "k8s.io/kubernetes/pkg/controller/volume/events"
|
volumeevents "k8s.io/kubernetes/pkg/controller/volume/events"
|
||||||
@ -314,21 +314,21 @@ var _ = utils.SIGDescribe("Zone Support", func() {
|
|||||||
ginkgo.It("Verify a pod is created and attached to a dynamically created PV with storage policy specified in storage class in waitForFirstConsumer binding mode", func() {
|
ginkgo.It("Verify a pod is created and attached to a dynamically created PV with storage policy specified in storage class in waitForFirstConsumer binding mode", func() {
|
||||||
ginkgo.By(fmt.Sprintf("Creating storage class with waitForFirstConsumer mode and storage policy :%s", compatPolicy))
|
ginkgo.By(fmt.Sprintf("Creating storage class with waitForFirstConsumer mode and storage policy :%s", compatPolicy))
|
||||||
scParameters[SpbmStoragePolicy] = compatPolicy
|
scParameters[SpbmStoragePolicy] = compatPolicy
|
||||||
verifyPVCAndPodCreationSucceeds(client, namespace, scParameters, nil, storage.VolumeBindingWaitForFirstConsumer)
|
verifyPVCAndPodCreationSucceeds(client, namespace, scParameters, nil, storagev1.VolumeBindingWaitForFirstConsumer)
|
||||||
})
|
})
|
||||||
|
|
||||||
ginkgo.It("Verify a pod is created and attached to a dynamically created PV with storage policy specified in storage class in waitForFirstConsumer binding mode with allowedTopologies", func() {
|
ginkgo.It("Verify a pod is created and attached to a dynamically created PV with storage policy specified in storage class in waitForFirstConsumer binding mode with allowedTopologies", func() {
|
||||||
ginkgo.By(fmt.Sprintf("Creating storage class with waitForFirstConsumer mode, storage policy :%s and zone :%s", compatPolicy, zoneA))
|
ginkgo.By(fmt.Sprintf("Creating storage class with waitForFirstConsumer mode, storage policy :%s and zone :%s", compatPolicy, zoneA))
|
||||||
scParameters[SpbmStoragePolicy] = compatPolicy
|
scParameters[SpbmStoragePolicy] = compatPolicy
|
||||||
zones = append(zones, zoneA)
|
zones = append(zones, zoneA)
|
||||||
verifyPVCAndPodCreationSucceeds(client, namespace, scParameters, zones, storage.VolumeBindingWaitForFirstConsumer)
|
verifyPVCAndPodCreationSucceeds(client, namespace, scParameters, zones, storagev1.VolumeBindingWaitForFirstConsumer)
|
||||||
})
|
})
|
||||||
|
|
||||||
ginkgo.It("Verify a pod is created and attached to a dynamically created PV with storage policy specified in storage class in waitForFirstConsumer binding mode with multiple allowedTopologies", func() {
|
ginkgo.It("Verify a pod is created and attached to a dynamically created PV with storage policy specified in storage class in waitForFirstConsumer binding mode with multiple allowedTopologies", func() {
|
||||||
ginkgo.By(fmt.Sprintf("Creating storage class with waitForFirstConsumer mode and zones : %s, %s", zoneA, zoneB))
|
ginkgo.By(fmt.Sprintf("Creating storage class with waitForFirstConsumer mode and zones : %s, %s", zoneA, zoneB))
|
||||||
zones = append(zones, zoneA)
|
zones = append(zones, zoneA)
|
||||||
zones = append(zones, zoneB)
|
zones = append(zones, zoneB)
|
||||||
verifyPVCAndPodCreationSucceeds(client, namespace, nil, zones, storage.VolumeBindingWaitForFirstConsumer)
|
verifyPVCAndPodCreationSucceeds(client, namespace, nil, zones, storagev1.VolumeBindingWaitForFirstConsumer)
|
||||||
})
|
})
|
||||||
|
|
||||||
ginkgo.It("Verify a PVC creation fails when multiple zones are specified in the storage class without shared datastores among the zones in waitForFirstConsumer binding mode", func() {
|
ginkgo.It("Verify a PVC creation fails when multiple zones are specified in the storage class without shared datastores among the zones in waitForFirstConsumer binding mode", func() {
|
||||||
@ -352,11 +352,11 @@ var _ = utils.SIGDescribe("Zone Support", func() {
|
|||||||
// nodeSelector set as zoneB
|
// nodeSelector set as zoneB
|
||||||
v1.LabelZoneFailureDomain: zoneB,
|
v1.LabelZoneFailureDomain: zoneB,
|
||||||
}
|
}
|
||||||
verifyPodSchedulingFails(client, namespace, nodeSelectorMap, scParameters, zones, storage.VolumeBindingWaitForFirstConsumer)
|
verifyPodSchedulingFails(client, namespace, nodeSelectorMap, scParameters, zones, storagev1.VolumeBindingWaitForFirstConsumer)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
func verifyPVCAndPodCreationSucceeds(client clientset.Interface, namespace string, scParameters map[string]string, zones []string, volumeBindingMode storage.VolumeBindingMode) {
|
func verifyPVCAndPodCreationSucceeds(client clientset.Interface, namespace string, scParameters map[string]string, zones []string, volumeBindingMode storagev1.VolumeBindingMode) {
|
||||||
storageclass, err := client.StorageV1().StorageClasses().Create(getVSphereStorageClassSpec("zone-sc", scParameters, zones, volumeBindingMode))
|
storageclass, err := client.StorageV1().StorageClasses().Create(getVSphereStorageClassSpec("zone-sc", scParameters, zones, volumeBindingMode))
|
||||||
framework.ExpectNoError(err, fmt.Sprintf("Failed to create storage class with err: %v", err))
|
framework.ExpectNoError(err, fmt.Sprintf("Failed to create storage class with err: %v", err))
|
||||||
defer client.StorageV1().StorageClasses().Delete(storageclass.Name, nil)
|
defer client.StorageV1().StorageClasses().Delete(storageclass.Name, nil)
|
||||||
@ -371,7 +371,7 @@ func verifyPVCAndPodCreationSucceeds(client clientset.Interface, namespace strin
|
|||||||
|
|
||||||
var persistentvolumes []*v1.PersistentVolume
|
var persistentvolumes []*v1.PersistentVolume
|
||||||
// If WaitForFirstConsumer mode, verify pvc binding status after pod creation. For immediate mode, do now.
|
// If WaitForFirstConsumer mode, verify pvc binding status after pod creation. For immediate mode, do now.
|
||||||
if volumeBindingMode != storage.VolumeBindingWaitForFirstConsumer {
|
if volumeBindingMode != storagev1.VolumeBindingWaitForFirstConsumer {
|
||||||
persistentvolumes = waitForPVClaimBoundPhase(client, pvclaims, framework.ClaimProvisionTimeout)
|
persistentvolumes = waitForPVClaimBoundPhase(client, pvclaims, framework.ClaimProvisionTimeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,7 +379,7 @@ func verifyPVCAndPodCreationSucceeds(client clientset.Interface, namespace strin
|
|||||||
pod, err := e2epod.CreatePod(client, namespace, nil, pvclaims, false, "")
|
pod, err := e2epod.CreatePod(client, namespace, nil, pvclaims, false, "")
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
|
|
||||||
if volumeBindingMode == storage.VolumeBindingWaitForFirstConsumer {
|
if volumeBindingMode == storagev1.VolumeBindingWaitForFirstConsumer {
|
||||||
persistentvolumes = waitForPVClaimBoundPhase(client, pvclaims, framework.ClaimProvisionTimeout)
|
persistentvolumes = waitForPVClaimBoundPhase(client, pvclaims, framework.ClaimProvisionTimeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,7 +399,7 @@ func verifyPVCAndPodCreationSucceeds(client clientset.Interface, namespace strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
func verifyPodAndPvcCreationFailureOnWaitForFirstConsumerMode(client clientset.Interface, namespace string, scParameters map[string]string, zones []string) error {
|
func verifyPodAndPvcCreationFailureOnWaitForFirstConsumerMode(client clientset.Interface, namespace string, scParameters map[string]string, zones []string) error {
|
||||||
storageclass, err := client.StorageV1().StorageClasses().Create(getVSphereStorageClassSpec("zone-sc", scParameters, zones, storage.VolumeBindingWaitForFirstConsumer))
|
storageclass, err := client.StorageV1().StorageClasses().Create(getVSphereStorageClassSpec("zone-sc", scParameters, zones, storagev1.VolumeBindingWaitForFirstConsumer))
|
||||||
framework.ExpectNoError(err, fmt.Sprintf("Failed to create storage class with err: %v", err))
|
framework.ExpectNoError(err, fmt.Sprintf("Failed to create storage class with err: %v", err))
|
||||||
defer client.StorageV1().StorageClasses().Delete(storageclass.Name, nil)
|
defer client.StorageV1().StorageClasses().Delete(storageclass.Name, nil)
|
||||||
|
|
||||||
@ -438,7 +438,7 @@ func waitForPVClaimBoundPhase(client clientset.Interface, pvclaims []*v1.Persist
|
|||||||
return persistentvolumes
|
return persistentvolumes
|
||||||
}
|
}
|
||||||
|
|
||||||
func verifyPodSchedulingFails(client clientset.Interface, namespace string, nodeSelector map[string]string, scParameters map[string]string, zones []string, volumeBindingMode storage.VolumeBindingMode) {
|
func verifyPodSchedulingFails(client clientset.Interface, namespace string, nodeSelector map[string]string, scParameters map[string]string, zones []string, volumeBindingMode storagev1.VolumeBindingMode) {
|
||||||
storageclass, err := client.StorageV1().StorageClasses().Create(getVSphereStorageClassSpec("zone-sc", scParameters, zones, volumeBindingMode))
|
storageclass, err := client.StorageV1().StorageClasses().Create(getVSphereStorageClassSpec("zone-sc", scParameters, zones, volumeBindingMode))
|
||||||
framework.ExpectNoError(err, fmt.Sprintf("Failed to create storage class with err: %v", err))
|
framework.ExpectNoError(err, fmt.Sprintf("Failed to create storage class with err: %v", err))
|
||||||
defer client.StorageV1().StorageClasses().Delete(storageclass.Name, nil)
|
defer client.StorageV1().StorageClasses().Delete(storageclass.Name, nil)
|
||||||
@ -457,7 +457,7 @@ func verifyPodSchedulingFails(client clientset.Interface, namespace string, node
|
|||||||
defer e2epod.DeletePodWithWait(client, pod)
|
defer e2epod.DeletePodWithWait(client, pod)
|
||||||
}
|
}
|
||||||
|
|
||||||
func verifyPVCCreationFails(client clientset.Interface, namespace string, scParameters map[string]string, zones []string, volumeBindingMode storage.VolumeBindingMode) error {
|
func verifyPVCCreationFails(client clientset.Interface, namespace string, scParameters map[string]string, zones []string, volumeBindingMode storagev1.VolumeBindingMode) error {
|
||||||
storageclass, err := client.StorageV1().StorageClasses().Create(getVSphereStorageClassSpec("zone-sc", scParameters, zones, volumeBindingMode))
|
storageclass, err := client.StorageV1().StorageClasses().Create(getVSphereStorageClassSpec("zone-sc", scParameters, zones, volumeBindingMode))
|
||||||
framework.ExpectNoError(err, fmt.Sprintf("Failed to create storage class with err: %v", err))
|
framework.ExpectNoError(err, fmt.Sprintf("Failed to create storage class with err: %v", err))
|
||||||
defer client.StorageV1().StorageClasses().Delete(storageclass.Name, nil)
|
defer client.StorageV1().StorageClasses().Delete(storageclass.Name, nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user