argoproj / argo-cd

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

Helm Chart manifest creates recursive app within app #18084

Open andeke07 opened 1 week ago

andeke07 commented 1 week ago

Checklist:

Describe the bug

When creating an app (from the web UI in this case) it seems to create a recursive app within my app. This is causing my app to constantly be considered out of sync. Deleting redundant app will delete the main app, as this redundant app seems to be referencing itself. I have tried this with 2 separate applications and gotten the same results.

To Reproduce Repo Structure:

image

(argocd-apps/pihole/pihole.yml is the app definition and pihole/values.yaml is the helm chart values file)

App manifest as shown in the web UI

project: default
source:
  repoURL: 'git@github.com:MY_REPO/homelab.git'
  path: argocd-apps/pihole
  targetRevision: HEAD
destination:
  server: 'https://kubernetes.default.svc'
  namespace: pihole
syncPolicy:
  automated: {}
sources:
  - repoURL: 'https://mojo2600.github.io/pihole-kubernetes/'
    targetRevision: 2.23.0
    helm:
      valueFiles:
        - $values/pihole/values.yaml
    chart: pihole
  - repoURL: 'git@github.com:MY_REPO/homelab'
    ref: values

argocd-apps/pihole/pihole.yml

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  namespace: argocd
  name: pihole
spec:
  project: default
  destination: 
     namespace: pihole
     server: https://kubernetes.default.svc
  sources:
  - repoURL: https://mojo2600.github.io/pihole-kubernetes/
    chart: pihole
    targetRevision: 2.23.0
    helm:
      valueFiles:
      - $values/pihole/values.yaml
  - repoURL: git@github.com:MY_REPO/homelab
    ref: values

pihole/values.yaml:

admin:
  existingSecret: pihole-password
ingress:
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-prod
  enabled: true
  hosts:
  - dns.my.tld
  tls:
  - hosts:
    - dns.my.tld
    secretName: dns-ui-tls
persistentVolumeClaim:
  enabled: true
serviceDhcp:
  annotations:
    metallb.universe.tf/allow-shared-ip: pihole
  enabled: false
serviceDns:
  annotations:
    metallb.universe.tf/allow-shared-ip: pihole
  loadBalancerIP: 192.168.0.2
  type: LoadBalancer
serviceWeb:
  annotations:
    metallb.universe.tf/allow-shared-ip: pihole
dnsmasq:
  customDnsEntries:
    - address=/my.custom.domains/192.168.0.123
    - ...

Expected behavior A redundant application would not be created. This app cannot be deleted as it is somehow cyclically referencing the main app and deletion of the redundant app deletes the main app.

Screenshots

image image

Version

argocd: v2.10.9+c071af8
  BuildDate: 2024-04-30T18:34:15Z
  GitCommit: c071af808170bfc39cbdf6b9be4d0212dd66db0c
  GitTreeState: clean
  GoVersion: go1.22.2
  Compiler: gc
  Platform: darwin/arm64
argocd-server: v2.10.6+d504d2b
  BuildDate: 2024-04-05T00:27:47Z
  GitCommit: d504d2b1d92f0cf831a124a5fd1a96ee29fa7679
  GitTreeState: clean
  GoVersion: go1.21.3
  Compiler: gc
  Platform: linux/amd64
  Kustomize Version: v5.2.1 2023-10-19T20:13:51Z
  Helm Version: v3.14.3+gf03cc04
  Kubectl Version: v0.26.11
  Jsonnet Version: v0.20.0
andeke07 commented 1 week ago

For the sake of tidiness, moving values out of an external file and moving it all to the app manifest produces the same behaviour:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  namespace: argocd
  name: pihole
spec:
  project: default
  destination: 
     namespace: pihole
     server: https://kubernetes.default.svc
  source:
    repoURL: https://mojo2600.github.io/pihole-kubernetes/
    chart: pihole
    targetRevision: 2.23.0
    helm:
      valuesObject:
        admin:
          existingSecret: pihole-password
        ingress:
          annotations:
            cert-manager.io/cluster-issuer: letsencrypt-prod
          enabled: true
          hosts:
          - dns.my.tld
          tls:
          - hosts:
            - dns.my.tld
            secretName: dns-ui-tls
        persistentVolumeClaim:
          enabled: true
        serviceDhcp:
          annotations:
            metallb.universe.tf/allow-shared-ip: pihole
          enabled: false
        serviceDns:
          annotations:
            metallb.universe.tf/allow-shared-ip: pihole
          loadBalancerIP: 192.168.0.2
          type: LoadBalancer
        serviceWeb:
          annotations:
            metallb.universe.tf/allow-shared-ip: pihole
        dnsmasq:
          customDnsEntries:
            - address=/my.custom.urls/192.168.0.4
            - ...
andeke07 commented 1 week ago

It seems applying this manifest through the CLI works fine and the issue is limited to creating the app through the web UI.

The working manifest, applied via kubectl apply

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: pihole
  namespace: argocd
spec:
  destination:
    namespace: pihole
    server: https://kubernetes.default.svc
  project: default
  sources:
    - chart: pihole
      helm:
        valueFiles:
        - $values/pihole/values.yaml
      repoURL: https://mojo2600.github.io/pihole-kubernetes/
      targetRevision: 2.23.0
    - repoURL: git@github.com:MY-REPO/homelab
      ref: values
  syncPolicy:
    automated:
      prune: true
      selfHeal: true