diff --git a/Framework/KubernetesWorkflow/Recipe/ContainerRecipeFactory.cs b/Framework/KubernetesWorkflow/Recipe/ContainerRecipeFactory.cs index 134b280..c10d4a1 100644 --- a/Framework/KubernetesWorkflow/Recipe/ContainerRecipeFactory.cs +++ b/Framework/KubernetesWorkflow/Recipe/ContainerRecipeFactory.cs @@ -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; } diff --git a/Framework/KubernetesWorkflow/Recipe/RecipeComponentFactory.cs b/Framework/KubernetesWorkflow/Recipe/RecipeComponentFactory.cs index c144746..b881d47 100644 --- a/Framework/KubernetesWorkflow/Recipe/RecipeComponentFactory.cs +++ b/Framework/KubernetesWorkflow/Recipe/RecipeComponentFactory.cs @@ -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)