kustomize: namespace not supported by helmCharts
The new helmCharts feature (added in #3784) has no way to pass in a namespace.
This is problematic with many common charts where the namespace is used in e.g. arguments or annotations
e.g. try rendering the cert-manager helm chart:
helmCharts:
- name: cert-manager
releaseName: cert-manager
version: 1.3.0
repo: https://charts.jetstack.io
Actual output
it results in annotations that contain the namespace, e.g.
cert-manager.io/inject-ca-from-secret: default/cert-manager-webhook-ca
it also has the argument:
- --dynamic-serving-dns-names=cert-manager-webhook,cert-manager-webhook.default,cert-manager-webhook.default.svc
Kustomize version/Platform
{Version:4.1.2 GitCommit:$Format:%H$ BuildDate:2021-04-19T00:04:53Z GoOs:linux GoArch:amd64}
CC @monopole
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 6
- Comments: 29 (13 by maintainers)
Bumping again as this breaks our flow of specifying
namespacein overlays completely.The community position on some of these flaws are baffling.
I cannot inline edit multi-line string values for some of my YAML objects after flattening a helm chart, so I go towards the helmChart generator for an exception basis.
I cannot use the helmChart generator effectively, because it does not honor the namespace.
What are my remaining options?
The helm program does many many things, including (so I’m told) arbitrary execution of shell commands via
--extra-argsand particularly crafted Go templates.The basic chart inflation kustomize performs is intentionally rudimentary to prove out the concept of performing “last mile” chart customization. Maintaining kustomize long term as a helm runner with full helm flag and argument knowledge as helm evolves would be toilsome and imply kustomize inherits whatever security risks helm presents.
So - anything that looks like what kustomize does should be done by kustomize, rather than delegated to helm, e.g. setting namespace (#3838).
The safest, most performant, and completely unlimited way to use kustomize + helm to generate config is
helm template --foo --bar ...(with whatever risky options one wants),From time to time, capture the latest chart, and repeat steps 1 and 2. It’s dangerous to set up a production stack that relies on kustomize to freshly download a helm chart with each build.
I have tried to define the namespace twice. Works with https://github.com/grafana/helm-charts/tree/main/charts/grafana
could you or one of the contributors reopen this issue @KnVerey
This is an issue with Helm’s --post-renderer option in particular and the scary part was that someone running kustomize didn’t have to consciously opt-in to run Helm. Given that we now have to explicitly elect to run Helm when we run kustomize, the user is consciously choosing to run Helm and accept the risks associated with it.
This is a partially workable solution to me. The main places I could see it causing issues is with charts like Jenkins that create resources in other namespaces intentionally (in this case, creating a role in the agent namepace to allow Jenkins to spin up agent pods there).
Perhaps if you’re pulling the Helm chart from an uncontrolled source. We pull specific versions of Helm charts into a private Helm repo and enforce tag immutability from there. We deploy multiple instances of a given application with different configurations and storing the fully templated code for each deployment adds a ton of noise and places for user error.