Creates internal service ports for external ports from container recipe.
This commit is contained in:
parent
8d0b3feff7
commit
ad88560061
|
@ -647,7 +647,7 @@ namespace KubernetesWorkflow
|
||||||
|
|
||||||
private RunningService? CreateInternalService(ContainerRecipe[] recipes)
|
private RunningService? CreateInternalService(ContainerRecipe[] recipes)
|
||||||
{
|
{
|
||||||
return CreateService(recipes, r => r.InternalPorts, "ClusterIP", "int");
|
return CreateService(recipes, r => r.InternalPorts.Concat(r.ExposedPorts).ToArray(), "ClusterIP", "int");
|
||||||
}
|
}
|
||||||
|
|
||||||
private RunningService? CreateExternalService(ContainerRecipe[] recipes)
|
private RunningService? CreateExternalService(ContainerRecipe[] recipes)
|
||||||
|
|
|
@ -48,13 +48,18 @@ namespace KubernetesWorkflow
|
||||||
|
|
||||||
public Address GetAddress(string portTag)
|
public Address GetAddress(string portTag)
|
||||||
{
|
{
|
||||||
var containerAddress = Addresses.Single(a => a.PortTag == portTag);
|
var addresses = Addresses.Where(a => a.PortTag == portTag).ToArray();
|
||||||
if (containerAddress.IsInteral && RunningContainers.StartResult.RunnerLocation == RunnerLocation.ExternalToCluster)
|
if (!addresses.Any()) throw new Exception("No addresses found for portTag: " + portTag);
|
||||||
|
|
||||||
|
var location = RunningContainers.StartResult.RunnerLocation;
|
||||||
|
if (location == RunnerLocation.InternalToCluster)
|
||||||
{
|
{
|
||||||
throw new Exception("Attempt to access a container address created from an Internal port, " +
|
return addresses.Single(a => a.IsInteral).Address;
|
||||||
"while runner is located external to the cluster.");
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return addresses.Single(a => !a.IsInteral).Address;
|
||||||
}
|
}
|
||||||
return containerAddress.Address;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Address GetInternalAddress(string portTag)
|
public Address GetInternalAddress(string portTag)
|
||||||
|
|
Loading…
Reference in New Issue