Created
January 20, 2020 07:56
-
-
Save TsuyoshiUshio/7ca1278a7515be1f10370a04c461b51d to your computer and use it in GitHub Desktop.
Helper method for IPAddress creation for service.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func WaitUntilServiceExternalIPsAvailable(t *testing.T, options *k8s.KubectlOptions, serviceName string, retries int, sleepBetweenRetries time.Duration) { | |
statusMsg := fmt.Sprintf("Wait for service %s to be provisioned.", serviceName) | |
message := retry.DoWithRetry( | |
t, | |
statusMsg, | |
retries, | |
sleepBetweenRetries, | |
func() (string, error) { | |
service, err := k8s.GetServiceE(t, options, serviceName) | |
if err != nil { | |
return "", err | |
} | |
if len(service.Status.LoadBalancer.Ingress) == 0 { | |
return "", k8s.NewServiceNotAvailableError(service) | |
} | |
return "Service ExternalIP is now available", nil | |
}, | |
) | |
logger.Logf(t, message) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment