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;
|
||||
}
|
||||
if (containerPort.ExternalAddress == Address.InvalidAddress) throw new Exception($"Getting address by tag {portTag} resulted in an invalid address.");
|
||||
return containerPort.ExternalAddress;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,6 +146,16 @@ namespace KubernetesWorkflow
|
|||
GetContainerExternalAddress(pod, servicePorts, 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();
|
||||
}
|
||||
|
@ -159,14 +169,13 @@ namespace KubernetesWorkflow
|
|||
servicePort.Number);
|
||||
}
|
||||
|
||||
private Address GetContainerInternalAddress(Port exposedPort)
|
||||
private Address GetContainerInternalAddress(Port port)
|
||||
{
|
||||
var serviceName = "service-" + numberSource.WorkflowNumber;
|
||||
var port = exposedPort.Number;
|
||||
|
||||
return new Address(
|
||||
$"http://{serviceName}.{k8sNamespace}.svc.cluster.local",
|
||||
port);
|
||||
port.Number);
|
||||
}
|
||||
|
||||
private ContainerRecipe[] CreateRecipes(int numberOfContainers, ContainerRecipeFactory recipeFactory, StartupConfig startupConfig)
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
{
|
||||
public class Address
|
||||
{
|
||||
public static readonly Address InvalidAddress = new Address(string.Empty, 0);
|
||||
|
||||
public Address(string host, int port)
|
||||
{
|
||||
Host = host;
|
||||
|
|
Loading…
Reference in New Issue