apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: application-set-cl01tl
  namespace: argocd
  labels:
    app.kubernetes.io/name: application-set-cl01tl
    app.kubernetes.io/instance: argocd
    app.kubernetes.io/part-of: argocd
spec:
  syncPolicy:
    applicationsSync: create-update
    preserveResourcesOnDeletion: false
  generators:
    - git:
        repoURL: http://gitea-http.gitea:3000/alexlebens/infrastructure
        revision: manifests
        directories:
          - path: clusters/cl01tl/manifests/*
          - path: clusters/cl01tl/manifests/stack
            exclude: true
          - path: clusters/cl01tl/manifests/cilium
            exclude: true
          - path: clusters/cl01tl/manifests/coredns
            exclude: true
          - path: clusters/cl01tl/manifests/metrics-server
            exclude: true
  template:
    metadata:
      name: '{{path.basename}}'
    spec:
      project: default
      source:
        repoURL: http://gitea-http.gitea:3000/alexlebens/infrastructure
        targetRevision: manifests
        path: '{{path}}'
      destination:
        name: in-cluster
        namespace: '{{path.basename}}'
      revisionHistoryLimit: 3
      ignoreDifferences:
        - group: ""
          kind: Service
          jqPathExpressions:
            - .spec.externalName
      syncPolicy:
        automated:
          enabled: true
          prune: true
          selfHeal: false
        retry:
          limit: 3
          backoff:
            duration: 1m
            factor: 2
            maxDuration: 15m
        syncOptions:
          - CreateNamespace=true
          - ApplyOutOfSyncOnly=true
          - ServerSideApply=true
          - PruneLast=true
          - RespectIgnoreDifferences=true
