Don't index ingress.status.ip if empty.

This commit is contained in:
bprashanth 2016-09-30 18:45:42 -07:00
parent 541928e27d
commit 98af96514e

View file

@ -379,17 +379,18 @@ func (lbc *LoadBalancerController) updateIngressStatus(l7 *loadbalancers.L7, ing
}, },
}, },
} }
lbIPs := ing.Status.LoadBalancer.Ingress if ip != "" {
if len(lbIPs) == 0 && ip != "" || lbIPs[0].IP != ip { lbIPs := ing.Status.LoadBalancer.Ingress
// TODO: If this update fails it's probably resource version related, if len(lbIPs) == 0 || lbIPs[0].IP != ip {
// which means it's advantageous to retry right away vs requeuing. // TODO: If this update fails it's probably resource version related,
glog.Infof("Updating loadbalancer %v/%v with IP %v", ing.Namespace, ing.Name, ip) // which means it's advantageous to retry right away vs requeuing.
if _, err := ingClient.UpdateStatus(currIng); err != nil { glog.Infof("Updating loadbalancer %v/%v with IP %v", ing.Namespace, ing.Name, ip)
return err if _, err := ingClient.UpdateStatus(currIng); err != nil {
return err
}
lbc.recorder.Eventf(currIng, api.EventTypeNormal, "CREATE", "ip: %v", ip)
} }
lbc.recorder.Eventf(currIng, api.EventTypeNormal, "CREATE", "ip: %v", ip)
} }
// Update annotations through /update endpoint // Update annotations through /update endpoint
currIng, err = ingClient.Get(ing.Name) currIng, err = ingClient.Get(ing.Name)
if err != nil { if err != nil {