Fixes issue where containers with no exposed ports cannot start.

This commit is contained in:
benbierens 2023-06-01 12:44:48 +02:00
parent 4d654e106c
commit 9eae7cf25e
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
1 changed files with 7 additions and 1 deletions

View File

@ -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();