How to create a namespace if it doesn't exists from HELM templates


Kasun Siyambalapitiya <kasunsi@...>
 

Hi all,

I have a `kind: Namespace` template yaml like follows,

    apiVersion: v1
    kind: Namespace
    metadata:
      name: {{ .Values.namespace }}
      namespace: ""


How do I make `helm install` create the above-given namespace (`{{ .Values.namespace }}`) if and only if above namespace (`{{ .Values.namespace }}`) doesn't exits in the pointed kubernets cluster?

Thanks,
Kasun Siyambalapitiya

--
Regards,
Kasun Siyambalapitiya
Software Engineer
WSO2 Inc. - http://wso2.com/
lean . enterprise . middleware
Tel : 0715523466
E mail : kasunsi@...


Matt Fisher <matt.fisher@...>
 

Responded in https://github.com/helm/helm/issues/4456

 

From: cncf-helm@... <cncf-helm@...> On Behalf Of via Lists.Cncf.Io
Sent: Friday, August 10, 2018 2:57 AM
To: cncf-helm@...
Cc: cncf-helm@...
Subject: [cncf-helm] How to create a namespace if it doesn't exists from HELM templates

 

Hi all,

 

I have a `kind: Namespace` template yaml like follows,

 

    apiVersion: v1
    kind: Namespace
    metadata:
      name: {{ .Values.namespace }}
      namespace: ""

 

 

How do I make `helm install` create the above-given namespace (`{{ .Values.namespace }}`) if and only if above namespace (`{{ .Values.namespace }}`) doesn't exits in the pointed kubernets cluster?

 

Thanks,

Kasun Siyambalapitiya

 

--

Regards,

Kasun Siyambalapitiya

Software Engineer

WSO2 Inc. - http://wso2.com/
lean . enterprise . middleware

Tel : 0715523466

E mail : kasunsi@...


me@...
 

With an operator and a CRD?

Sent from my phone

On 10 Aug 2018, at 19:57, via Lists.Cncf.Io <kasunsi=wso2.com@...> wrote:

Hi all,

I have a `kind: Namespace` template yaml like follows,

    apiVersion: v1
    kind: Namespace
    metadata:
      name: {{ .Values.namespace }}
      namespace: ""


How do I make `helm install` create the above-given namespace (`{{ .Values.namespace }}`) if and only if above namespace (`{{ .Values.namespace }}`) doesn't exits in the pointed kubernets cluster?

Thanks,
Kasun Siyambalapitiya

--
Regards,
Kasun Siyambalapitiya
Software Engineer
WSO2 Inc. - http://wso2.com/
lean . enterprise . middleware
Tel : 0715523466
E mail : kasunsi@...