Unverified Commit 3bc2b5b1 authored by Matthew Fisher's avatar Matthew Fisher Committed by GitHub

Merge pull request #5264 from ds-ms/waitIngress

Wait for ingress host to be ready
parents 94c3192f 91454585
...@@ -52,6 +52,7 @@ func (c *Client) waitForResources(timeout time.Duration, created Result) error { ...@@ -52,6 +52,7 @@ func (c *Client) waitForResources(timeout time.Duration, created Result) error {
services := []v1.Service{} services := []v1.Service{}
pvc := []v1.PersistentVolumeClaim{} pvc := []v1.PersistentVolumeClaim{}
deployments := []deployment{} deployments := []deployment{}
ingresses := []extensions.Ingress{}
for _, v := range created { for _, v := range created {
switch value := asVersionedOrUnstructured(v).(type) { switch value := asVersionedOrUnstructured(v).(type) {
case *v1.ReplicationController: case *v1.ReplicationController:
...@@ -208,9 +209,15 @@ func (c *Client) waitForResources(timeout time.Duration, created Result) error { ...@@ -208,9 +209,15 @@ func (c *Client) waitForResources(timeout time.Duration, created Result) error {
return false, err return false, err
} }
services = append(services, *svc) services = append(services, *svc)
case *extensions.Ingress:
ingress, err := kcs.ExtensionsV1beta1().Ingresses(value.Namespace).Get(value.Name, metav1.GetOptions{})
if err != nil {
return false, err
}
ingresses = append(ingresses, *ingress)
} }
} }
isReady := c.podsReady(pods) && c.servicesReady(services) && c.volumesReady(pvc) && c.deploymentsReady(deployments) isReady := c.podsReady(pods) && c.servicesReady(services) && c.volumesReady(pvc) && c.deploymentsReady(deployments) && c.ingressesReady(ingresses)
return isReady, nil return isReady, nil
}) })
} }
...@@ -285,3 +292,13 @@ func isPodReady(pod *v1.Pod) bool { ...@@ -285,3 +292,13 @@ func isPodReady(pod *v1.Pod) bool {
} }
return false return false
} }
func (c *Client) ingressesReady(ingresses []extensions.Ingress) bool {
for _, ingress := range ingresses {
if &ingress.Status == nil || len(ingress.Status.LoadBalancer.Ingress) == 0 {
c.Log("Ingress is not ready: %s/%s", ingress.GetNamespace(), ingress.GetName())
return false
}
}
return true
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment