multiple service ports
This commit is contained in:
parent
45050c34e4
commit
2fea475237
|
@ -67,6 +67,12 @@
|
||||||
|
|
||||||
public int Number { get; }
|
public int Number { get; }
|
||||||
public string Tag { get; }
|
public string Tag { get; }
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(Tag)) return $"untagged-port={Number}";
|
||||||
|
return $"{Tag}={Number}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EnvVar
|
public class EnvVar
|
||||||
|
|
|
@ -572,10 +572,9 @@ namespace KubernetesWorkflow
|
||||||
var readback = client.Run(c => c.ReadNamespacedService(serviceSpec.Metadata.Name, K8sNamespace));
|
var readback = client.Run(c => c.ReadNamespacedService(serviceSpec.Metadata.Name, K8sNamespace));
|
||||||
foreach (var r in containerRecipes)
|
foreach (var r in containerRecipes)
|
||||||
{
|
{
|
||||||
if (r.ExposedPorts.Any())
|
foreach (var port in r.ExposedPorts)
|
||||||
{
|
{
|
||||||
var firstExposedPort = r.ExposedPorts.First();
|
var portName = GetNameForPort(r, port);
|
||||||
var portName = GetNameForPort(r, firstExposedPort);
|
|
||||||
|
|
||||||
var matchingServicePorts = readback.Spec.Ports.Where(p => p.Name == portName);
|
var matchingServicePorts = readback.Spec.Ports.Where(p => p.Name == portName);
|
||||||
if (matchingServicePorts.Any())
|
if (matchingServicePorts.Any())
|
||||||
|
|
|
@ -19,12 +19,10 @@
|
||||||
|
|
||||||
public Port[] GetServicePortsForContainerRecipe(ContainerRecipe containerRecipe)
|
public Port[] GetServicePortsForContainerRecipe(ContainerRecipe containerRecipe)
|
||||||
{
|
{
|
||||||
if (PortMapEntries.Any(p => p.ContainerNumber == containerRecipe.Number))
|
return PortMapEntries
|
||||||
{
|
.Where(p => p.ContainerNumber == containerRecipe.Number)
|
||||||
return PortMapEntries.Single(p => p.ContainerNumber == containerRecipe.Number).Ports;
|
.SelectMany(p => p.Ports)
|
||||||
}
|
.ToArray();
|
||||||
|
|
||||||
return Array.Empty<Port>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue