Next release of Helm will hopefully have support for automatic namespace creation.
Would like this natively supported by Helmfile.
This is a pain point when migrating from helm2 to heln3. Using the flag restores the behavior of helm2.
Sounds good!
Can we just always add that flag to helm upgrade called by helmfile?
Or do we need a flag in the config file to toggle? I suppose not, but just asking for clarity.
Toggle. I find BaconGobbler's arguments about letting users opt in/out to this functionality totally valid. Clusters with strong RBAC will have users that want to use Helmfile that don't have permissions to create namespaces.
Edit: Though, having a config param with a default of "true" would work fine for me. That should solve @osterman's desire for having the functionality that he had with Helm 2 back.
Thanks. Fair enough! Let's add a toggle that would look like disableNamespaceCreation, which is set to true when and only when you want to opt-out.
Note that Helmfile will never take care of cleaning up namespaces created with disableNamespaceCreation: false and wrong namespace names.
For that, you'll want to add a dedicated release named something like namespaces with incubator/raw chart that includes namespaces that are required by subsequent releases.
You can use helmfile's DAG after that, like:
helmDefaults:
disableNamespaceCreation: true
{{ $foons := "foo" }}
releases:
- name: namespaces
chart: incubator/raw
namespace: kube-system
values:
- resources:
kind: Namespace
metadata:
name: "{{ $foons }}"
- name: foo
namespace: "{{ $foons }}"
chart: myapp
needs: ["kube-system/namespaces"]
Releated: https://github.com/helm/helm/pull/7648#issuecomment-590520569
I think that this feature should be turned off by default as to not introduce breaking changes.
Yes. That's the plan.
Um? Are you suggesting to make disableNamespaceCreation: true as the default, which doesn't create namespaces (helm3 default)?
Um? Are you suggesting to make
disableNamespaceCreation: trueas the default, which doesn't create namespaces (helm3 default)?
Yes, since it will be turned off by default in helm 3.2 as well (it requires the flag to be present), I think we should stick to the default behaviour.
@dudicoco That makes sense if Helmfile is only for Helm 3!
But Helmfile supports both Helm 2 and Helm 3. The breaking change in Helm 3 broke Helmfile users expectation that Hemlfile would automatically create namespaces. That's why I agreed on disableNamespaceCreation: false as the default, which makes Helmfile consistently behave between Helm 2 and 3.
minor bike-shedding moment here... Would it be best to introduce the parameter as createNamespace: true? Double negatives like disableNamespaceCreation: false always throw me off a little.
If the intention is to preserve Helm 2 behaviour, then creating the namespace by default would be good here. Helm 3 made the breaking change to prevent cases where a mis-typed --namespace flag would cause a helm upgrade --install --namespace oops to perform a fresh install and return success, rather than the expected behaviour of erroring out and saying it could not upgrade the existing release.
e.g.
$ kubectl create namespace foo
$ helm upgrade --install mychart ./mychart --namespace foo # this should succeed
$ helm upgrade --install mychart ./mychart --namespace anotherfoo # this should fail
For helmfile users, the scenario described above may not matter as much as the namespace is embedded in helmfile.yaml, so this case is less likely to occur.
Helm 3.2.0 has been released. When can we expect this to be supported in helmfile?
@bacongobbler Wow! Thanks for the suggestion! Yeah, that makes sense. I'd definitely go with createNamespace.
@cdunford Helmfile is completely a community-driven project without any financial or time support for devs, so I think there's no one who could answer the question.
I can say, it will be supported asap once someone (including me, in my spare time) submits a pull request for it.
And I think you can expect me to review/give feedbacks/merge it quickly enough once submitted, based on my activity so far on this project :) That's all I can say.
Yeah, sorry - for some reason I thought the helmfile dev was already completed and a release just needed to be cut.
Has a decision been made on the default behavior (discussed in this issue)? It sounds like we want to go with a createNamespace parameter, however it is not clear if the default would be true or false if not specified.
Good point! I believe the default value should bettter be createNamespace: true. I've already received a bunch of questions about why Helmfile doesn't create namespaces by default since Helm 3, and I'd like to "fix" that.
I will hopefully have a PR for this by the end of the weekend.
Thanks @mumoshu & @cdunford!
Most helpful comment
I will hopefully have a PR for this by the end of the weekend.