argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
17.79k stars 5.43k forks source link

Multiple sources with Kustomize #16790

Open mihaigalos opened 9 months ago

mihaigalos commented 9 months ago

Checklist:

Describe the bug Multiple sources for kustomize seem to not work using v2.9.3.

To Reproduce

I'm using a generator in a monorepo containing the appset and custom overlays. It has following file hierarchy:

.
├── all
│   ├── README.md
│   └── accounts
│       └── proj1.yaml
├── bootstrap.yaml
└── core
    ├── proj-externaldns
    │   ├── component_kustomize.yaml
    │   ├── kustomization.yaml
    │   └── stages
    │       └── proj1-dev
    │           ├── deploymentPatch.yaml
    │           └── kustomization.yaml
    └── dev-applicationSet.yaml

core/dev-applicationSet.yaml (simplified - this is a file in the same repo (proj-mono), referencing the repo again to include another path (core/{{.name}}/stages/proj1-dev)):

- git:
      requeueAfterSeconds: 300
      repoURL: 'https://do.main/company/proj-mono.git'
      revision: HEAD
      files:
      - path: 'core/*/component_kustomize.yaml'
      template:
        metadata: {}
        spec:
          project: proj
          sources:
          - repoURL: '{{.repoURL}}'
            targetRevision: '{{.targetRevision}}'
            path: deployment
          - repoURL: 'https://do.main/company/proj-mono.git'
            targetRevision: HEAD
            path: 'core/{{.name}}/stages/proj1-dev'
          destination: {}

This does generate the proj-externaldns app, but does not add the overlays in core/{{.name}}/stages/proj1-dev.

Expected behavior

Overlays get added using multiple sources.

Screenshots

Version

v2.9.3

Logs

MauroSoli commented 9 months ago

There is a workaround .

mihaigalos commented 9 months ago

Hi @MauroSoli, it seems this changes kustomize's openAPI sources. I'm not ok to deploy this in production.

Would like to specify multiple entries in the sources[] and have kustomize consume them.

Since this is not natively possible in kustomize, ArgoCD might need to generate some intermediate files and mix them in.