Skip to content

Commit

Permalink
Add retry logic internal to the Job to work around knative/test-infra…
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmoor committed Jan 7, 2020
1 parent 9175488 commit 847033a
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions cmd/default-domain/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,20 @@ func findGatewayAddress(kubeclient *kubernetes.Clientset, client *versioned.Clie
}
name, namespace := parts[0], parts[1]

svc, err := kubeclient.CoreV1().Services(namespace).Get(name, metav1.GetOptions{})
if err != nil {
// Wait for the Ingress Service to have an external IP.
var svc *corev1.Service
if err := wait.PollImmediate(pollInterval, waitTimeout, func() (done bool, err error) {
svc, err = kubeclient.CoreV1().Services(namespace).Get(name, metav1.GetOptions{})
if err != nil {
return true, err
}
if len(svc.Status.LoadBalancer.Ingress) == 0 {
return false, nil
}
return true, nil
}); err != nil {
return nil, err
}
if len(svc.Status.LoadBalancer.Ingress) == 0 {
return nil, errors.New("Public load balancer does not have an ingress IP.")
}
return &svc.Status.LoadBalancer.Ingress[0], nil
}

Expand Down

0 comments on commit 847033a

Please sign in to comment.