Unverified Commit feac98a1 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

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
parents 5d672225 fe76c9f7
...@@ -708,6 +708,14 @@ func createPD(zone string) (string, error) { ...@@ -708,6 +708,14 @@ func createPD(zone string) (string, error) {
return "", err return "", err
} }
if zone == "" && TestContext.CloudConfig.MultiZone {
zones, err := gceCloud.GetAllZonesFromCloudProvider()
if err != nil {
return "", err
}
zone, _ = zones.PopAny()
}
tags := map[string]string{} tags := map[string]string{}
err = gceCloud.CreateDisk(pdName, gcecloud.DiskTypeSSD, zone, 10 /* sizeGb */, tags) err = gceCloud.CreateDisk(pdName, gcecloud.DiskTypeSSD, zone, 10 /* sizeGb */, tags)
if err != nil { if err != nil {
......
...@@ -348,6 +348,16 @@ func SkipUnlessMultizone(c clientset.Interface) { ...@@ -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) { func SkipUnlessClusterMonitoringModeIs(supportedMonitoring ...string) {
if !ClusterMonitoringModeIs(supportedMonitoring...) { if !ClusterMonitoringModeIs(supportedMonitoring...) {
Skipf("Only next monitoring modes are supported %v (not %s)", supportedMonitoring, TestContext.ClusterMonitoringMode) Skipf("Only next monitoring modes are supported %v (not %s)", supportedMonitoring, TestContext.ClusterMonitoringMode)
......
...@@ -70,6 +70,8 @@ var _ = utils.SIGDescribe("Pod Disks", func() { ...@@ -70,6 +70,8 @@ var _ = utils.SIGDescribe("Pod Disks", func() {
cs = f.ClientSet cs = f.ClientSet
ns = f.Namespace.Name ns = f.Namespace.Name
framework.SkipIfMultizone(cs)
podClient = cs.CoreV1().Pods(ns) podClient = cs.CoreV1().Pods(ns)
nodeClient = cs.CoreV1().Nodes() nodeClient = cs.CoreV1().Nodes()
nodes = framework.GetReadySchedulableNodesOrDie(cs) nodes = framework.GetReadySchedulableNodesOrDie(cs)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment