Browse Source

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

pull/745/head
TeBeCo 6 years ago
committed by GitHub
parent
commit
5331046d7d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/Microsoft.Tye.Core/CombineStep.cs
  2. 4
      src/Microsoft.Tye.Core/KubernetesManifestGenerator.cs

2
src/Microsoft.Tye.Core/CombineStep.cs

@ -38,7 +38,7 @@ namespace Microsoft.Tye
if (binding.Protocol == "http")
{
var port = binding.Port ?? 80;
var port = binding.ContainerPort ?? binding.Port ?? 80;
var urls = $"http://*{(port == 80 ? "" : (":" + port.ToString()))}";
project.EnvironmentVariables.Add(new EnvironmentVariableBuilder("ASPNETCORE_URLS") { Value = urls, });
project.EnvironmentVariables.Add(new EnvironmentVariableBuilder("PORT") { Value = port.ToString(CultureInfo.InvariantCulture), });

4
src/Microsoft.Tye.Core/KubernetesManifestGenerator.cs

@ -183,7 +183,7 @@ namespace Microsoft.Tye
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());
}
}
@ -374,7 +374,7 @@ namespace Microsoft.Tye
{
var containerPort = new YamlMappingNode();
ports.Add(containerPort);
containerPort.Add("containerPort", binding.Port.Value.ToString());
containerPort.Add("containerPort", (binding.ContainerPort ?? binding.Port.Value).ToString());
}
}
}

Loading…
Cancel
Save