---
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: observability-apps
  namespace: argocd
spec:
  generators:
  - git:
      repoURL: https://git.unkin.net/unkin/argocd-apps
      revision: HEAD
      directories:
      - path: apps/overlays/*/observability
      - path: apps/overlays/*/grafana
  template:
    metadata:
      name: 'observability-{{path[3]}}'
    spec:
      project: observability
      source:
        repoURL: https://git.unkin.net/unkin/argocd-apps
        targetRevision: HEAD
        path: '{{path}}'
      destination:
        server: https://kubernetes.default.svc
        namespace: '{{path[3]}}'
      syncPolicy:
        automated:
          prune: true
          selfHeal: true
        syncOptions:
        - ServerSideApply=true
