Update gce NodeCondition parameter

This commit is contained in:
Manuel de Brito Fontes 2016-07-11 23:43:36 -04:00
parent a736fba0e1
commit a34124be9d
2 changed files with 11 additions and 9 deletions

View file

@ -439,20 +439,22 @@ func (lbc *LoadBalancerController) syncNodes(key string) error {
return nil
}
func nodeReady(node api.Node) bool {
for ix := range node.Status.Conditions {
condition := &node.Status.Conditions[ix]
if condition.Type == api.NodeReady {
return condition.Status == api.ConditionTrue
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 {
return condition.Status == api.ConditionTrue
}
}
return false
}
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
}

View file

@ -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
}