Browse Source
Map "binding.ContainerPort" instead of "binding.Port" to "manifest containerPort" (#740)
pull/745/head
TeBeCo
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
3 additions and
3 deletions
-
src/Microsoft.Tye.Core/CombineStep.cs
-
src/Microsoft.Tye.Core/KubernetesManifestGenerator.cs
|
|
@ -38,7 +38,7 @@ namespace Microsoft.Tye |
|
|
|
|
|
|
|
|
if (binding.Protocol == "http") |
|
|
if (binding.Protocol == "http") |
|
|
{ |
|
|
{ |
|
|
var port = binding.Port ?? 80; |
|
|
var port = binding.ContainerPort ?? binding.Port ?? 80; |
|
|
var urls = $"http://*{(port == 80 ? "" : (":" + port.ToString()))}"; |
|
|
var urls = $"http://*{(port == 80 ? "" : (":" + port.ToString()))}"; |
|
|
project.EnvironmentVariables.Add(new EnvironmentVariableBuilder("ASPNETCORE_URLS") { Value = urls, }); |
|
|
project.EnvironmentVariables.Add(new EnvironmentVariableBuilder("ASPNETCORE_URLS") { Value = urls, }); |
|
|
project.EnvironmentVariables.Add(new EnvironmentVariableBuilder("PORT") { Value = port.ToString(CultureInfo.InvariantCulture), }); |
|
|
project.EnvironmentVariables.Add(new EnvironmentVariableBuilder("PORT") { Value = port.ToString(CultureInfo.InvariantCulture), }); |
|
|
|
|
|
@ -183,7 +183,7 @@ namespace Microsoft.Tye |
|
|
port.Add("name", binding.Name ?? binding.Protocol ?? "http"); |
|
|
port.Add("name", binding.Name ?? binding.Protocol ?? "http"); |
|
|
port.Add("protocol", "TCP"); // we use assume TCP. YOLO
|
|
|
port.Add("protocol", "TCP"); // we use assume TCP. YOLO
|
|
|
port.Add("port", binding.Port.Value.ToString()); |
|
|
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(); |
|
|
var containerPort = new YamlMappingNode(); |
|
|
ports.Add(containerPort); |
|
|
ports.Add(containerPort); |
|
|
containerPort.Add("containerPort", binding.Port.Value.ToString()); |
|
|
containerPort.Add("containerPort", (binding.ContainerPort ?? binding.Port.Value).ToString()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|