Merge pull request #61243 from verult/pd-multizone-cluster

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fixes 'Zone is empty' errors in PD upgrade tests; skips pd tests with inline volume in multizone clusters

**What this PR does / why we need it**: Fixes regional cluster upgrade test failures.

PV upgrade tests were failing because a "" zone is passed to the GCE PD create disk call. In a multizone setting the test must select from a managed zone.

PD tests were failing because it uses inline GCE PD volumes, which should not be used in multizone clusters.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #61242 

/release-note-none
/assign @saad-ali 
/cc @wojtek-t 
/sig storage
/sig gcp
This commit is contained in:
Kubernetes Submit Queue 2018-03-16 02:10:22 -07:00 committed by GitHub
commit feac98a1b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 0 deletions

View File

@ -708,6 +708,14 @@ func createPD(zone string) (string, error) {
return "", err
}
if zone == "" && TestContext.CloudConfig.MultiZone {
zones, err := gceCloud.GetAllZonesFromCloudProvider()
if err != nil {
return "", err
}
zone, _ = zones.PopAny()
}
tags := map[string]string{}
err = gceCloud.CreateDisk(pdName, gcecloud.DiskTypeSSD, zone, 10 /* sizeGb */, tags)
if err != nil {

View File

@ -348,6 +348,16 @@ func SkipUnlessMultizone(c clientset.Interface) {
}
}
func SkipIfMultizone(c clientset.Interface) {
zones, err := GetClusterZones(c)
if err != nil {
Skipf("Error listing cluster zones")
}
if zones.Len() > 1 {
Skipf("Requires more than one zone")
}
}
func SkipUnlessClusterMonitoringModeIs(supportedMonitoring ...string) {
if !ClusterMonitoringModeIs(supportedMonitoring...) {
Skipf("Only next monitoring modes are supported %v (not %s)", supportedMonitoring, TestContext.ClusterMonitoringMode)

View File

@ -70,6 +70,8 @@ var _ = utils.SIGDescribe("Pod Disks", func() {
cs = f.ClientSet
ns = f.Namespace.Name
framework.SkipIfMultizone(cs)
podClient = cs.CoreV1().Pods(ns)
nodeClient = cs.CoreV1().Nodes()
nodes = framework.GetReadySchedulableNodesOrDie(cs)