diff --git a/controllers/gce/controller/controller.go b/controllers/gce/controller/controller.go index cf04c7eb2..c5f72f5d7 100644 --- a/controllers/gce/controller/controller.go +++ b/controllers/gce/controller/controller.go @@ -379,17 +379,18 @@ func (lbc *LoadBalancerController) updateIngressStatus(l7 *loadbalancers.L7, ing }, }, } - lbIPs := ing.Status.LoadBalancer.Ingress - if len(lbIPs) == 0 && ip != "" || lbIPs[0].IP != ip { - // TODO: If this update fails it's probably resource version related, - // which means it's advantageous to retry right away vs requeuing. - glog.Infof("Updating loadbalancer %v/%v with IP %v", ing.Namespace, ing.Name, ip) - if _, err := ingClient.UpdateStatus(currIng); err != nil { - return err + if ip != "" { + lbIPs := ing.Status.LoadBalancer.Ingress + if len(lbIPs) == 0 || lbIPs[0].IP != ip { + // TODO: If this update fails it's probably resource version related, + // which means it's advantageous to retry right away vs requeuing. + glog.Infof("Updating loadbalancer %v/%v with IP %v", ing.Namespace, ing.Name, ip) + 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 currIng, err = ingClient.Get(ing.Name) if err != nil {