mirror of
https://github.com/codex-storage/cs-codex-dist-tests.git
synced 2025-02-10 11:06:42 +00:00
Adds internal ports to container-port array as long as they have tags.
This commit is contained in:
parent
5a021a4bfe
commit
58816430e3
@ -46,6 +46,7 @@ namespace KubernetesWorkflow
|
|||||||
{
|
{
|
||||||
return containerPort.InternalAddress;
|
return containerPort.InternalAddress;
|
||||||
}
|
}
|
||||||
|
if (containerPort.ExternalAddress == Address.InvalidAddress) throw new Exception($"Getting address by tag {portTag} resulted in an invalid address.");
|
||||||
return containerPort.ExternalAddress;
|
return containerPort.ExternalAddress;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,6 +146,16 @@ namespace KubernetesWorkflow
|
|||||||
GetContainerExternalAddress(pod, servicePorts, exposedPort),
|
GetContainerExternalAddress(pod, servicePorts, exposedPort),
|
||||||
GetContainerInternalAddress(exposedPort)));
|
GetContainerInternalAddress(exposedPort)));
|
||||||
}
|
}
|
||||||
|
foreach (var internalPort in recipe.InternalPorts)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(internalPort.Tag))
|
||||||
|
{
|
||||||
|
result.Add(new ContainerPort(
|
||||||
|
internalPort,
|
||||||
|
Address.InvalidAddress,
|
||||||
|
GetContainerInternalAddress(internalPort)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return result.ToArray();
|
return result.ToArray();
|
||||||
}
|
}
|
||||||
@ -159,14 +169,13 @@ namespace KubernetesWorkflow
|
|||||||
servicePort.Number);
|
servicePort.Number);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Address GetContainerInternalAddress(Port exposedPort)
|
private Address GetContainerInternalAddress(Port port)
|
||||||
{
|
{
|
||||||
var serviceName = "service-" + numberSource.WorkflowNumber;
|
var serviceName = "service-" + numberSource.WorkflowNumber;
|
||||||
var port = exposedPort.Number;
|
|
||||||
|
|
||||||
return new Address(
|
return new Address(
|
||||||
$"http://{serviceName}.{k8sNamespace}.svc.cluster.local",
|
$"http://{serviceName}.{k8sNamespace}.svc.cluster.local",
|
||||||
port);
|
port.Number);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ContainerRecipe[] CreateRecipes(int numberOfContainers, ContainerRecipeFactory recipeFactory, StartupConfig startupConfig)
|
private ContainerRecipe[] CreateRecipes(int numberOfContainers, ContainerRecipeFactory recipeFactory, StartupConfig startupConfig)
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
{
|
{
|
||||||
public class Address
|
public class Address
|
||||||
{
|
{
|
||||||
|
public static readonly Address InvalidAddress = new Address(string.Empty, 0);
|
||||||
|
|
||||||
public Address(string host, int port)
|
public Address(string host, int port)
|
||||||
{
|
{
|
||||||
Host = host;
|
Host = host;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user