Attempt internal connection using pod IP and exposed port.

This commit is contained in:
benbierens 2023-06-01 10:14:32 +02:00
parent b92c1b970d
commit 61d2185bb6
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
2 changed files with 9 additions and 7 deletions

View File

@ -82,7 +82,7 @@ namespace KubernetesWorkflow
return new RunningContainer(runningPod, r, servicePorts, startupConfig, return new RunningContainer(runningPod, r, servicePorts, startupConfig,
GetContainerExternalAddress(runningPod, servicePorts), GetContainerExternalAddress(runningPod, servicePorts),
GetContainerInternalAddress(servicePorts)); GetContainerInternalAddress(runningPod, r, servicePorts));
}).ToArray(); }).ToArray();
} }
@ -94,14 +94,17 @@ namespace KubernetesWorkflow
GetServicePort(servicePorts)); GetServicePort(servicePorts));
} }
private RunningContainerAddress GetContainerInternalAddress(Port[] servicePorts) private RunningContainerAddress GetContainerInternalAddress(RunningPod pod, ContainerRecipe recipe, Port[] servicePorts)
{ {
var serviceName = "service-" + numberSource.WorkflowNumber; var ip = pod.Ip;
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( return new RunningContainerAddress(
$"http://{serviceName}.{namespaceName}.svc.cluster.local", //$"http://{serviceName}.{namespaceName}.svc.cluster.local",
GetServicePort(servicePorts)); $"http://{ip}",
port);
} }
private static int GetServicePort(Port[] servicePorts) private static int GetServicePort(Port[] servicePorts)

View File

@ -1,5 +1,4 @@
using DistTestCore; using DistTestCore;
using DistTestCore.Codex;
using DistTestCore.Helpers; using DistTestCore.Helpers;
using NUnit.Framework; using NUnit.Framework;
using Utils; using Utils;