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

View File

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