Update gce NodeCondition parameter
This commit is contained in:
parent
a736fba0e1
commit
a34124be9d
2 changed files with 11 additions and 9 deletions
|
@ -439,7 +439,8 @@ func (lbc *LoadBalancerController) syncNodes(key string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func nodeReady(node api.Node) bool {
|
||||
func getNodeReadyPredicate() cache.NodeConditionPredicate {
|
||||
return func(node *api.Node) bool {
|
||||
for ix := range node.Status.Conditions {
|
||||
condition := &node.Status.Conditions[ix]
|
||||
if condition.Type == api.NodeReady {
|
||||
|
@ -448,11 +449,12 @@ func nodeReady(node api.Node) bool {
|
|||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// getReadyNodeNames returns names of schedulable, ready nodes from the node lister.
|
||||
func (lbc *LoadBalancerController) getReadyNodeNames() ([]string, error) {
|
||||
nodeNames := []string{}
|
||||
nodes, err := lbc.nodeLister.NodeCondition(nodeReady).List()
|
||||
nodes, err := lbc.nodeLister.NodeCondition(getNodeReadyPredicate()).List()
|
||||
if err != nil {
|
||||
return nodeNames, err
|
||||
}
|
||||
|
|
|
@ -365,7 +365,7 @@ func getZone(n api.Node) string {
|
|||
|
||||
// GetZoneForNode returns the zone for a given node by looking up its zone label.
|
||||
func (t *GCETranslator) GetZoneForNode(name string) (string, error) {
|
||||
nodes, err := t.nodeLister.NodeCondition(nodeReady).List()
|
||||
nodes, err := t.nodeLister.NodeCondition(getNodeReadyPredicate()).List()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
@ -382,7 +382,7 @@ func (t *GCETranslator) GetZoneForNode(name string) (string, error) {
|
|||
// ListZones returns a list of zones this Kubernetes cluster spans.
|
||||
func (t *GCETranslator) ListZones() ([]string, error) {
|
||||
zones := sets.String{}
|
||||
readyNodes, err := t.nodeLister.NodeCondition(nodeReady).List()
|
||||
readyNodes, err := t.nodeLister.NodeCondition(getNodeReadyPredicate()).List()
|
||||
if err != nil {
|
||||
return zones.List(), err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue