Skip to content
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

Chart doesn't respect namespace when used with Kustomize HelmCharts in Argo CD app of apps pattern #96

Open
gabrielcosi opened this issue Feb 22, 2025 · 0 comments

Comments

@gabrielcosi
Copy link

Description

When deploying the Windmill Helm chart using Kustomize's HelmCharts feature within an Argo CD app of apps pattern, all resources are being created in the ArgoCD namespace instead of the intended namespace specified in the Kustomization file.

Current Setup and Behavior

I have an app of apps setup with ApplicationSet and AppProject:

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: tools
  namespace: argocd
spec:
  generators:
    - git:
        repoURL: https://github.com/gabrielcosi/homelab
        revision: HEAD
        directories:
          - path: kubernetes/apps/tools/*
  template:
    metadata:
      name: "{{ path.basename }}"
    spec:
      project: tools
      source:
        plugin:
          name: kustomize-build-with-helm
      destination:
        name: in-cluster
        namespace: argocd  # This seems to override the namespace specified in Kustomization

Inside one of the tool directories, I have a Kustomization using HelmCharts:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
  - ns.yaml
  - cnpg-db.yaml
  - http-route.yaml
  - db-credentials.yaml
helmCharts:
  - name: windmill
    repo: https://windmill-labs.github.io/windmill-helm-charts/
    version: 2.0.384
    releaseName: windmill
    namespace: windmill
    valuesFile: values.yaml

The issue appears to be a combination of:

  1. The ApplicationSet template specifying namespace: argocd
  2. The Helm chart templates not explicitly handling namespace inheritance
  3. Kustomize's HelmCharts namespace specification not being respected in this setup

Expected Behavior

Resources should be deployed to the namespace specified in the Kustomization file's HelmCharts section (windmill in this case), regardless of the ApplicationSet's destination namespace.

Suggested Fix

Add namespace templating to the Helm chart templates, for example:

metadata:
  namespace: {{ .Release.Namespace }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant