diff --git a/KubernetesWorkflow/StartupWorkflow.cs b/KubernetesWorkflow/StartupWorkflow.cs index 96706a9..59fe617 100644 --- a/KubernetesWorkflow/StartupWorkflow.cs +++ b/KubernetesWorkflow/StartupWorkflow.cs @@ -98,7 +98,7 @@ namespace KubernetesWorkflow { var serviceName = "service-" + numberSource.WorkflowNumber; var namespaceName = cluster.Configuration.K8sNamespacePrefix + testNamespace; - var port = recipe.ExposedPorts.First().Number; + var port = GetInternalPort(recipe); return new RunningContainerAddress( $"http://{serviceName}.{namespaceName}.svc.cluster.local", @@ -111,6 +111,12 @@ namespace KubernetesWorkflow return 0; } + private static int GetInternalPort(ContainerRecipe recipe) + { + if (recipe.ExposedPorts.Any()) return recipe.ExposedPorts.First().Number; + return 0; + } + private ContainerRecipe[] CreateRecipes(int numberOfContainers, ContainerRecipeFactory recipeFactory, StartupConfig startupConfig) { log.Debug();