fix(helm): Don't wait for service to be ready when external IP are set

Resolves #7513
As the externalIPs are not managed by k8s (according to the doc: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#servicespec-v1-core) helm should not wait for services  which set al least one externalIPs.

Signed-off-by: Federico Bevione <f.bevione@cognitio.it>
pull/7530/head
Federico Bevione 5 years ago
parent 5ec70ab27f
commit 438eaec971

@ -188,12 +188,24 @@ func (w *waiter) serviceReady(s *corev1.Service) bool {
} }
// Make sure the service is not explicitly set to "None" before checking the IP // Make sure the service is not explicitly set to "None" before checking the IP
if (s.Spec.ClusterIP != corev1.ClusterIPNone && s.Spec.ClusterIP == "") || if s.Spec.ClusterIP != corev1.ClusterIPNone && s.Spec.ClusterIP == "" {
// This checks if the service has a LoadBalancer and that balancer has an Ingress defined
(s.Spec.Type == corev1.ServiceTypeLoadBalancer && s.Status.LoadBalancer.Ingress == nil) {
w.log("Service does not have IP address: %s/%s", s.GetNamespace(), s.GetName())
return false return false
} }
// This checks if the service has a LoadBalancer and that balancer has an Ingress defined
if s.Spec.Type == corev1.ServiceTypeLoadBalancer {
// do not wait when at least 1 external IP is set
if len(s.Spec.ExternalIPs) > 0 {
w.log("Service has externaIPs addresses: %s/%s (%v)", s.GetNamespace(), s.GetName(), s.Spec.ExternalIPs)
return true
}
if s.Status.LoadBalancer.Ingress == nil {
w.log("Service does not have IP address: %s/%s", s.GetNamespace(), s.GetName())
return false
}
}
return true return true
} }

Loading…
Cancel
Save