Automatically create a Namespace
complete
G
Grateful Caribou
Is there a way to automatically create a Namespace in the cluster (of deployment) if it doesn't exist.
Let's say I want to deploy my X service in a cluster in XNS namespace. If the service is new and I want a new namespace, can we enable the functionality that "Harness looks for the XNS namespace in that cluster and if found, it simply deploys the service and if not, it creates the namespaces, logs it and then deploy the services"
Please feel free to reach out to me, in case of any more information is required.
Thanks,
VIKAS
Log In
P
Pranay Kaikini
complete
G
Grateful Caribou
HI, On further look up. We concluded that neither of the solution fits perfect for us. We would rather create the namespaces manually as it's a one time thing.
But thank you so much for your help and you can close the ticket
G
Grateful Caribou
Hi, Rohan!
Thanks for your response.
Let me try these in my infra and check which works best for us. Meanwhile, can we keep this ticket open so that I can reach back to you or your team in case of any issues that may arise?
Thanks,
Rohan Gupta
pending feedback
Rohan Gupta
Option 2: Using the Apply Step, you can create the namespace on the fly before the rolling deployment step. You define a namespace yaml that you can conditionally apply. Or can always run.
Rohan Gupta
Our customers solve this use case in 2 Ways.
Option 1: In their Kubernetes Manifest they define a namespace object and create an if condition.
In their values yaml they have this
createNamespace: <+serviceVariable.createNamespace>
In their service object they set it as a runtime input with true or false. <+input.createNamespace.allowedValues("true, false")
Based on this you can tell Harness Create a namespace yes or No