Remaps running container internal address to service endpoint

This commit is contained in:
benbierens 2023-06-01 12:31:14 +02:00
parent 9747846787
commit 4d654e106c
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
1 changed files with 5 additions and 7 deletions

View File

@ -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);
}