trying with podIP for internal addresses.

This commit is contained in:
benbierens 2023-10-23 16:12:45 +02:00
parent b3ba39b2e5
commit eb70fe612b
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
2 changed files with 10 additions and 10 deletions

View File

@ -145,7 +145,7 @@ namespace KubernetesWorkflow
result.Add(new ContainerPort(
exposedPort,
GetContainerExternalAddress(pod, servicePorts, exposedPort),
GetContainerInternalAddress(exposedPort)));
GetContainerInternalAddress(pod, exposedPort)));
}
foreach (var internalPort in recipe.InternalPorts)
{
@ -154,7 +154,7 @@ namespace KubernetesWorkflow
result.Add(new ContainerPort(
internalPort,
new Address(string.Empty, 0),
GetContainerInternalAddress(internalPort)));
GetContainerInternalAddress(pod, internalPort)));
}
}
@ -170,12 +170,15 @@ namespace KubernetesWorkflow
servicePort.Number);
}
private Address GetContainerInternalAddress(Port port)
private Address GetContainerInternalAddress(RunningPod pod, Port port)
{
var serviceName = "service-" + numberSource.WorkflowNumber;
//var serviceName = "service-" + numberSource.WorkflowNumber;
//return new Address(
// $"http://{serviceName}.{k8sNamespace}.svc.cluster.local",
// port.Number);
return new Address(
$"http://{serviceName}.{k8sNamespace}.svc.cluster.local",
$"http://{pod.PodInfo.Ip}",
port.Number);
}

View File

@ -17,12 +17,9 @@ namespace CodexContractsPlugin
{
var config = startupConfig.Get<CodexContractsContainerConfig>();
var containerPort = config.GethNode.StartResult.Container.GetContainerPort(GethContainerRecipe.HttpPortTag);
var address = config.GethNode.StartResult.Container.GetAddress(GethContainerRecipe.HttpPortTag);
var ip = config.GethNode.StartResult.Container.Pod.PodInfo.Ip;
var port = containerPort.InternalAddress.Port;
AddEnvVar("DISTTEST_NETWORK_URL", $"http://{ip}:{port}");
AddEnvVar("DISTTEST_NETWORK_URL", address.ToString());
AddEnvVar("HARDHAT_NETWORK", "codexdisttestnetwork");
AddEnvVar("KEEP_ALIVE", "1");
}