private static async Task <string> WaitForServicePublicIpAddressAsync(string name, Action waitingCallback, KubectlContext kubectlContext) { DateTime start = DateTime.Now; TimeSpan actualTime = DateTime.Now - start; while (actualTime < s_newServiceIpTimeout) { waitingCallback(); var service = await KubectlWrapper.GetServiceAsync(name, kubectlContext); var ingress = service?.Status?.LoadBalancer?.Ingress?.FirstOrDefault(); if (ingress != null) { string ipAddress = null; if (ingress.TryGetValue("ip", out ipAddress)) { Debug.WriteLine($"Found service IP address: {ipAddress}"); return(ipAddress); } } Debug.WriteLine("Waiting for service to be public."); await Task.Delay(s_pollingDelay); actualTime = DateTime.Now - start; } Debug.WriteLine("Timeout while waiting for the ip address."); return(null); }
private static async Task <string> WaitForServiceClusterIpAddressAsync(string name, KubectlContext context) { var service = await KubectlWrapper.GetServiceAsync(name, context); return(service?.Spec?.ClusterIp); }