Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

Map "binding.ContainerPort" instead of "binding.Port" to "manifest containerPort" #740

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Microsoft.Tye.Core/KubernetesManifestGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public static KubernetesServiceOutput CreateService(
port.Add("name", binding.Name ?? binding.Protocol ?? "http");
port.Add("protocol", "TCP"); // we use assume TCP. YOLO
port.Add("port", binding.Port.Value.ToString());
port.Add("targetPort", binding.Port.Value.ToString());
port.Add("targetPort", (binding.ContainerPort ?? binding.Port.Value).ToString());
}
}

Expand Down Expand Up @@ -374,8 +374,9 @@ public static KubernetesDeploymentOutput CreateDeployment(
{
var containerPort = new YamlMappingNode();
ports.Add(containerPort);
containerPort.Add("containerPort", binding.Port.Value.ToString());
containerPort.Add("containerPort", (binding.ContainerPort ?? binding.Port.Value).ToString());
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: new line not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤨

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx, that will teach me to double check when editing directly from the portal :D
(Not on the head please)

}
}

Expand Down