I noticed the related PR #68, so apologies if this should be handled there instead. I wanted to ask whether you would be open to adding explicit namespace support to the chart, possibly as an opt-in namespaceOverride value.
Context
The reason this came up for us is Kustomize v5.8.0+.
In kubernetes-sigs/kustomize#5940, Kustomize changed Helm namespace handling so Helm-generated resources are expected to manage their own namespaces. The v5.8.0 release notes mention this under:
fix: Propagate Namespace correctly to Helm
The PR summary also notes:
If you use Kustomize with Helm charts, ensure that your Helm templates explicitly set the namespace, for example:
metadata.namespace: {{ .Release.Namespace }}
There are also Kustomize issues from users seeing this after upgrading:
Issue kubernetes-sigs/kustomize#6058 is open/accepted and describes the case where Kustomize 5.8.0 no longer adds namespaces to Helm chart resources that do not set an explicit namespace.
Current behavior
When this chart is rendered through Kustomize helmCharts, users may configure a namespace like this:
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: chartmuseum
helmCharts:
- name: chartmuseum
repo: https://chartmuseum.github.io/charts
releaseName: chartmuseum
namespace: chartmuseum
With Kustomize v5.8.0+, chart resources that do not render metadata.namespace may no longer get the namespace injected by Kustomize. This can leave users needing extra Kustomize patches to add namespaces to resources such as Service, Deployment, Secret, PersistentVolumeClaim, Ingress, and ServiceAccount.
Those patches are somewhat fragile because the list can change when chart templates change.
Relationship to #68
PR #68 already proposed adding explicit namespace rendering to several templates using:
namespace: {{ .Release.Namespace }}
This request is related, but slightly different.
Instead of unconditional namespace rendering, would you prefer an opt-in approach that keeps the chart's default output mostly unchanged?
For example:
- Add
namespaceOverride: ""
- Add a helper resolving to
.Values.namespaceOverride or .Release.Namespace
- Add
metadata.namespace only when namespaceOverride is set
- Keep cluster-scoped resources such as
PersistentVolume namespace-free
- Use the same helper for
ServiceMonitor.namespaceSelector.matchNames
I have a small branch prepared here if helpful:
https://github.com/Xanonymous-GitHub/chartmuseum-charts/tree/feat/add-chartmuseum-namespace-override
I noticed the related PR #68, so apologies if this should be handled there instead. I wanted to ask whether you would be open to adding explicit namespace support to the chart, possibly as an opt-in
namespaceOverridevalue.Context
The reason this came up for us is Kustomize
v5.8.0+.In kubernetes-sigs/kustomize#5940, Kustomize changed Helm namespace handling so Helm-generated resources are expected to manage their own namespaces. The
v5.8.0release notes mention this under:The PR summary also notes:
There are also Kustomize issues from users seeing this after upgrading:
Issue kubernetes-sigs/kustomize#6058 is open/accepted and describes the case where Kustomize
5.8.0no longer adds namespaces to Helm chart resources that do not set an explicit namespace.Current behavior
When this chart is rendered through Kustomize
helmCharts, users may configure a namespace like this:With Kustomize
v5.8.0+, chart resources that do not rendermetadata.namespacemay no longer get the namespace injected by Kustomize. This can leave users needing extra Kustomize patches to add namespaces to resources such asService,Deployment,Secret,PersistentVolumeClaim,Ingress, andServiceAccount.Those patches are somewhat fragile because the list can change when chart templates change.
Relationship to #68
PR #68 already proposed adding explicit namespace rendering to several templates using:
This request is related, but slightly different.
Instead of unconditional namespace rendering, would you prefer an opt-in approach that keeps the chart's default output mostly unchanged?
For example:
namespaceOverride: "".Values.namespaceOverrideor.Release.Namespacemetadata.namespaceonly whennamespaceOverrideis setPersistentVolumenamespace-freeServiceMonitor.namespaceSelector.matchNamesI have a small branch prepared here if helpful:
https://github.com/Xanonymous-GitHub/chartmuseum-charts/tree/feat/add-chartmuseum-namespace-override