mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +00:00
Fix zone calculation - consider only untainted nodes
Tests "Multi-AZ Cluster Volumes" should consider only nodes that are schedulable and *untainted* when computing AZ where to run the tests. GetReadySchedulableNodes() already filters schedulable + untainted nodes, no need to do it again in GetSchedulableClusterZones().
This commit is contained in:
parent
fffaadc013
commit
4efc9a9569
@ -563,18 +563,15 @@ func GetClusterZones(c clientset.Interface) (sets.String, error) {
|
|||||||
|
|
||||||
// GetSchedulableClusterZones returns the values of zone label collected from all nodes which are schedulable.
|
// GetSchedulableClusterZones returns the values of zone label collected from all nodes which are schedulable.
|
||||||
func GetSchedulableClusterZones(c clientset.Interface) (sets.String, error) {
|
func GetSchedulableClusterZones(c clientset.Interface) (sets.String, error) {
|
||||||
nodes, err := c.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{})
|
// GetReadySchedulableNodes already filters our tainted and unschedulable nodes.
|
||||||
|
nodes, err := GetReadySchedulableNodes(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("Error getting nodes while attempting to list cluster zones: %v", err)
|
return nil, fmt.Errorf("error getting nodes while attempting to list cluster zones: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// collect values of zone label from all nodes
|
// collect values of zone label from all nodes
|
||||||
zones := sets.NewString()
|
zones := sets.NewString()
|
||||||
for _, node := range nodes.Items {
|
for _, node := range nodes.Items {
|
||||||
// We should have at least 1 node in the zone which is schedulable.
|
|
||||||
if !IsNodeSchedulable(&node) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if zone, found := node.Labels[v1.LabelFailureDomainBetaZone]; found {
|
if zone, found := node.Labels[v1.LabelFailureDomainBetaZone]; found {
|
||||||
zones.Insert(zone)
|
zones.Insert(zone)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user