mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
Make tests deal with old and new topology labels
This commit is contained in:
parent
f63ca48a1f
commit
3bd337baf4
@ -15,6 +15,8 @@ metadata:
|
||||
cloud.google.com/gke-os-distribution: cos
|
||||
failure-domain.beta.kubernetes.io/region: us-central1
|
||||
failure-domain.beta.kubernetes.io/zone: us-central1-b
|
||||
topology.kubernetes.io/region: us-central1
|
||||
topology.kubernetes.io/zone: us-central1-b
|
||||
kubernetes.io/hostname: node-default-pool-something
|
||||
name: node-default-pool-something
|
||||
resourceVersion: "211582541"
|
||||
|
@ -163,6 +163,8 @@ func RestartNodes(c clientset.Interface, nodes []v1.Node) error {
|
||||
zone := framework.TestContext.CloudConfig.Zone
|
||||
if z, ok := node.Labels[v1.LabelFailureDomainBetaZone]; ok {
|
||||
zone = z
|
||||
} else if z, ok := node.Labels[v1.LabelTopologyZone]; ok {
|
||||
zone = z
|
||||
}
|
||||
nodeNamesByZone[zone] = append(nodeNamesByZone[zone], node.Name)
|
||||
}
|
||||
|
@ -182,6 +182,8 @@ var _ = SIGDescribe("Firewall rule", func() {
|
||||
zone := cloudConfig.Zone
|
||||
if zoneInLabel, ok := nodeList.Items[0].Labels[v1.LabelFailureDomainBetaZone]; ok {
|
||||
zone = zoneInLabel
|
||||
} else if zoneInLabel, ok := nodeList.Items[0].Labels[v1.LabelTopologyZone]; ok {
|
||||
zone = zoneInLabel
|
||||
}
|
||||
removedTags := gce.SetInstanceTags(cloudConfig, nodesNames[0], zone, []string{})
|
||||
defer func() {
|
||||
|
@ -23,7 +23,7 @@ import (
|
||||
|
||||
"github.com/onsi/ginkgo"
|
||||
"github.com/onsi/gomega"
|
||||
"k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
@ -120,13 +120,13 @@ func SpreadServiceOrFail(f *framework.Framework, replicaCount int, image string)
|
||||
|
||||
// Find the name of the zone in which a Node is running
|
||||
func getZoneNameForNode(node v1.Node) (string, error) {
|
||||
for key, value := range node.Labels {
|
||||
if key == v1.LabelFailureDomainBetaZone {
|
||||
return value, nil
|
||||
}
|
||||
if z, ok := node.Labels[v1.LabelFailureDomainBetaZone]; ok {
|
||||
return z, nil
|
||||
} else if z, ok := node.Labels[v1.LabelTopologyZone]; ok {
|
||||
return z, nil
|
||||
}
|
||||
return "", fmt.Errorf("node %s doesn't have zone label %s",
|
||||
node.Name, v1.LabelFailureDomainBetaZone)
|
||||
return "", fmt.Errorf("node %s doesn't have zone label %s or %s",
|
||||
node.Name, v1.LabelFailureDomainBetaZone, v1.LabelTopologyZone)
|
||||
}
|
||||
|
||||
// Return the number of zones in which we have nodes in this cluster.
|
||||
|
Loading…
Reference in New Issue
Block a user