diff --git a/Framework/KubernetesWorkflow/RunningContainers.cs b/Framework/KubernetesWorkflow/RunningContainers.cs index 0b9db88..8d9956f 100644 --- a/Framework/KubernetesWorkflow/RunningContainers.cs +++ b/Framework/KubernetesWorkflow/RunningContainers.cs @@ -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; } } diff --git a/Framework/KubernetesWorkflow/StartupWorkflow.cs b/Framework/KubernetesWorkflow/StartupWorkflow.cs index e50e39e..7d7a874 100644 --- a/Framework/KubernetesWorkflow/StartupWorkflow.cs +++ b/Framework/KubernetesWorkflow/StartupWorkflow.cs @@ -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) diff --git a/Framework/Utils/Address.cs b/Framework/Utils/Address.cs index 27ff16a..b9f15a8 100644 --- a/Framework/Utils/Address.cs +++ b/Framework/Utils/Address.cs @@ -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;