diff --git a/Framework/KubernetesWorkflow/RunnerLocationUtils.cs b/Framework/KubernetesWorkflow/RunnerLocationUtils.cs index 75676ab..9caa1ea 100644 --- a/Framework/KubernetesWorkflow/RunnerLocationUtils.cs +++ b/Framework/KubernetesWorkflow/RunnerLocationUtils.cs @@ -1,7 +1,4 @@ -using Logging; -using System.Net.NetworkInformation; - -namespace KubernetesWorkflow +namespace KubernetesWorkflow { internal enum RunnerLocation { @@ -21,7 +18,7 @@ namespace KubernetesWorkflow return location; } - private static void DetermineRunnerLocation()//ILog log, PodInfo info, K8sCluster cluster) + private static void DetermineRunnerLocation() { if (location != RunnerLocation.Unknown) return; @@ -37,42 +34,5 @@ namespace KubernetesWorkflow location = RunnerLocation.InternalToCluster; } } - - private static RunnerLocation PingForLocation(PodInfo podInfo, K8sCluster cluster) - { - if (PingHost(podInfo.Ip)) - { - return RunnerLocation.InternalToCluster; - } - - if (PingHost(Format(cluster.HostAddress))) - { - return RunnerLocation.ExternalToCluster; - } - - throw new Exception("Unable to determine location relative to kubernetes cluster."); - } - - private static string Format(string host) - { - return host - .Replace("http://", "") - .Replace("https://", ""); - } - - private static bool PingHost(string host) - { - try - { - using var pinger = new Ping(); - PingReply reply = pinger.Send(host); - return reply.Status == IPStatus.Success; - } - catch (PingException) - { - } - - return false; - } } }