helm: `helm upgrade` does not re-create namespace when it is gone
When the namespace of a release had been deleted, upgrade fails:
Error: UPGRADE FAILED: failed to create resource: namespaces "xxxxx" not found
This is arguably a special situation, but I would expect helm to re-create the “resources that do not already exist” (https://github.com/kubernetes/helm/blob/master/pkg/kube/client.go#L201), including namespaces.
How about calling ensureNamespace there in Update, as is done in Create? I can try and send a PR for this.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 10
- Comments: 34 (15 by maintainers)
Commits related to this issue
- works around helm bug. see: https://github.com/kubernetes/helm/issues/2013 — committed to sapcc/kubernikus by BugRoger 7 years ago
- Bump helm-diff to version 3.3.1 (#2041) helm-diff 3.3.1 adds a new option `HELM_DIFF_THREE_WAY_MERGE=true` which enables the use of there-way merge for diff, which is expected to fix #2013 — committed to Nordix/helm by mumoshu 2 years ago
any updates on this?
Thank you @bacongobbler. Just for clarification, I understand if
helm upgradedoes not support re-creating namespaces. But, we use the--installflag along with upgrade by defaulthelm upgrade --installand it would be nice if namespaces are also re-created in that case (when--installflag is used).Is it recommended practice to add a namespace.yml file like so:
/cc @tback @wjkohnen
My workaround: Add
namespace: {{ .Values.namespace }}to each resource and don’t use--namespaceflagIn
helm listit looks like it’s deployed underdefaultnamespace though.@technosophos Isn’t it weird that even Helm is supposed to work on global level, there are “namespaces” as first-class concept in both cli and
helm listoutput? Wouldn’t it make more sense to drop namespace concept from helm cli at all and allow to override namespaces of all resources in some way in templates? Like: