From 4d654e106c0f995a2a51a4580bece47743698efa Mon Sep 17 00:00:00 2001 From: benbierens Date: Thu, 1 Jun 2023 12:31:14 +0200 Subject: [PATCH] Remaps running container internal address to service endpoint --- KubernetesWorkflow/StartupWorkflow.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/KubernetesWorkflow/StartupWorkflow.cs b/KubernetesWorkflow/StartupWorkflow.cs index be86a7f4..96706a9d 100644 --- a/KubernetesWorkflow/StartupWorkflow.cs +++ b/KubernetesWorkflow/StartupWorkflow.cs @@ -82,7 +82,7 @@ namespace KubernetesWorkflow return new RunningContainer(runningPod, r, servicePorts, startupConfig, GetContainerExternalAddress(runningPod, servicePorts), - GetContainerInternalAddress(runningPod, r, servicePorts)); + GetContainerInternalAddress(r)); }).ToArray(); } @@ -94,16 +94,14 @@ namespace KubernetesWorkflow GetServicePort(servicePorts)); } - private RunningContainerAddress GetContainerInternalAddress(RunningPod pod, ContainerRecipe recipe, Port[] servicePorts) + private RunningContainerAddress GetContainerInternalAddress(ContainerRecipe recipe) { - var ip = pod.Ip; + var serviceName = "service-" + numberSource.WorkflowNumber; + var namespaceName = cluster.Configuration.K8sNamespacePrefix + testNamespace; var port = recipe.ExposedPorts.First().Number; - //var serviceName = "service-" + numberSource.WorkflowNumber; - //var namespaceName = cluster.Configuration.K8sNamespacePrefix + testNamespace; return new RunningContainerAddress( - //$"http://{serviceName}.{namespaceName}.svc.cluster.local", - $"http://{ip}", + $"http://{serviceName}.{namespaceName}.svc.cluster.local", port); }