Adds numberSource for correct range for external ports
This commit is contained in:
parent
ca350604e3
commit
b82c74865e
|
@ -52,7 +52,7 @@ namespace KubernetesWorkflow.Recipe
|
|||
|
||||
protected Port AddExposedPort(string tag, PortProtocol protocol = PortProtocol.TCP)
|
||||
{
|
||||
return AddExposedPort(factory.CreatePort(tag, protocol));
|
||||
return AddExposedPort(factory.CreateExternalPort(tag, protocol));
|
||||
}
|
||||
|
||||
protected Port AddExposedPort(int number, string tag, PortProtocol protocol = PortProtocol.TCP)
|
||||
|
@ -62,7 +62,7 @@ namespace KubernetesWorkflow.Recipe
|
|||
|
||||
protected Port AddInternalPort(string tag = "", PortProtocol protocol = PortProtocol.TCP)
|
||||
{
|
||||
var p = factory.CreatePort(tag, protocol);
|
||||
var p = factory.CreateInternalPort(tag, protocol);
|
||||
internalPorts.Add(p);
|
||||
return p;
|
||||
}
|
||||
|
|
|
@ -5,16 +5,22 @@ namespace KubernetesWorkflow.Recipe
|
|||
{
|
||||
public class RecipeComponentFactory
|
||||
{
|
||||
private NumberSource portNumberSource = new NumberSource(8080);
|
||||
private NumberSource internalNumberSource = new NumberSource(8080);
|
||||
private NumberSource externalNumberSource = new NumberSource(30000);
|
||||
|
||||
public Port CreatePort(int number, string tag, PortProtocol protocol)
|
||||
{
|
||||
return new Port(number, tag, protocol);
|
||||
}
|
||||
|
||||
public Port CreatePort(string tag, PortProtocol protocol)
|
||||
public Port CreateInternalPort(string tag, PortProtocol protocol)
|
||||
{
|
||||
return new Port(portNumberSource.GetNextNumber(), tag, protocol);
|
||||
return new Port(internalNumberSource.GetNextNumber(), tag, protocol);
|
||||
}
|
||||
|
||||
public Port CreateExternalPort(string tag, PortProtocol protocol)
|
||||
{
|
||||
return new Port(externalNumberSource.GetNextNumber(), tag, protocol);
|
||||
}
|
||||
|
||||
public EnvVar CreateEnvVar(string name, int value)
|
||||
|
|
Loading…
Reference in New Issue