-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
helm template --namespace should set the 'metadata.namespace' field on created resources #3553
Comments
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Please don't close this issue - it impacts us quite heavily as having to fork charts just to add the namespace metadata is arduous. |
It's a hack, but you can pass the output of helm template through this to add the namespace. https://gist.github.com/deltaroe/63afd52ba84274ed5b86ba9b0c357e8f
|
Would it be safe to assume that this issue won't be looked into until Helm 3 is released? |
Using the hack of @deltaroe don't forget to pass |
this is needed for when helm is used purely as a templating tool, since helm template does not add the namespace helm/helm#3553 Signed-off-by: eduardo aleixo <eduardoaleixomartins@gmail.com>
this is needed for when helm is used purely as a templating tool, since helm template does not add the namespace helm/helm#3553 Signed-off-by: eduardo aleixo <eduardoaleixomartins@gmail.com>
this is needed for when helm is used purely as a templating tool, since helm template does not add the namespace helm/helm#3553 Signed-off-by: eduardo aleixo <eduardoaleixomartins@gmail.com>
this is needed for when helm is used purely as a templating tool, since helm template does not add the namespace helm/helm#3553 Signed-off-by: eduardo aleixo <eduardoaleixomartins@gmail.com>
this is needed for when helm is used purely as a templating tool, since helm template does not add the namespace helm/helm#3553 Signed-off-by: eduardo aleixo <eduardoaleixomartins@gmail.com>
this is needed for when helm is used purely as a templating tool, since helm template does not add the namespace helm/helm#3553 Signed-off-by: eduardo aleixo <eduardoaleixomartins@gmail.com>
I WAS setting up a process to store rendered templates versioned such that I can validate any changes to the values as well as any changes to the helm in one location. The fact that namespaces are not saved in the templates took me several hours to debug and working with helm was a waste of my time. This was closed for a ridiculous reason. The yaml files output from helm template should represent the EXACT state that helm install would create. Not "the state that would be applied if kubectl uses the same arguments". Otherwise whats the point of having those options on template to begin with? Or the point of templating at all? They are literally irrelevant for my use case now, and I have to redesign my process. Either add them to the template, or remove them as arguments (crash if set). I'm for the former because that option makes actual sense as to what templates are supposed to do, but at least pick one. |
We are running into major headaches with |
I did it with
|
…mespace (#2655) ### Proposed changes This pull request modifies the `GetResource` Go method for the Helm Chart resource. Previously, when a resource was deployed to the default namespace, the `default` namespace was always omitted from the resource lookup key. However, in cases where the namespace is explicitly defined in the Helm chart template, the `default` namespace was inadvertently excluded from the resource lookup key despite it being needed. This behavior in Helm is documented in the upstream issue: helm/helm#3553. **Changes Made:** - Implemented a fallback mechanism to include the `default` namespace in the resource lookup key when necessary for the `GetResource` method. **Test Added:** - Added a test (`ChartGetResource`) to verify the `GetResource` method for both types of Helm charts—those with the explicitly defined default namespace and those without. **Verification:** - Verified that the modified `GetResource` method successfully handles scenarios where the namespace is explicitly defined in the Helm chart template. - Confirmed that the added test covers both types of Helm charts and fails when the fallback logic is reverted. ### Related issues (optional) Fixes: #2638
…mespace (#2655) This pull request modifies the `GetResource` Go method for the Helm Chart resource. Previously, when a resource was deployed to the default namespace, the `default` namespace was always omitted from the resource lookup key. However, in cases where the namespace is explicitly defined in the Helm chart template, the `default` namespace was inadvertently excluded from the resource lookup key despite it being needed. This behavior in Helm is documented in the upstream issue: helm/helm#3553. **Changes Made:** - Implemented a fallback mechanism to include the `default` namespace in the resource lookup key when necessary for the `GetResource` method. **Test Added:** - Added a test (`ChartGetResource`) to verify the `GetResource` method for both types of Helm charts—those with the explicitly defined default namespace and those without. **Verification:** - Verified that the modified `GetResource` method successfully handles scenarios where the namespace is explicitly defined in the Helm chart template. - Confirmed that the added test covers both types of Helm charts and fails when the fallback logic is reverted. Fixes: #2638
why is this closed ? The documentation makes it seem like This is clearly not a "feature" : Countless downstream projects and users are wasting time because of this, as you can obviously see with the trail of links pointing to this issue above. |
I'm currently using
helm template
to generate static manifests from our authoritative helm chart in the cert-manager project. You can see the script that does this here: https://github.com/jetstack/cert-manager/blob/master/hack/update-deploy-gen.sh.Currently, despite specifying --namespace, the namespace field is not set on the generated resources. I'm aware that I could deploy with
-n namespace
, however for a cleaner experience for end-users, it'd be preferable to not have to include this step.In the meantime, I will likely add
namespace: {{ .Release.Namespace }}
to each of my namespaced resources, however it'd be ideal ifhelm template
itself could do this (as from what I understand, the best practice with helm chart is to not include themetadata.namespace
field at all, and let helm/tiller manage namespace selection).Is this the recommended approach, and would it be conceivable to change the behaviour of
helm template
to do this for us automatically?The text was updated successfully, but these errors were encountered: