---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: traefik
  namespace: argocd
spec:
  project: default
  sources:
    - repoURL: https://traefik.github.io/charts
      chart: traefik
      targetRevision: 34.2.0
      helm:
        releaseName: traefik
        valueFiles:
          - $values/traefik/values.yaml
    - repoURL: https://git.ar21.de/yolokube/core-deployments.git
      targetRevision: HEAD
      ref: values
    - repoURL: https://git.ar21.de/yolokube/core-deployments.git
      targetRevision: HEAD
      path: traefik
  destination:
    server: https://kubernetes.default.svc
    namespace: traefik
  syncPolicy:
    syncOptions:
      - CreateNamespace=true
    automated:
      prune: false
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: argocd
  namespace: argocd
spec:
  project: default
  sources:
    - repoURL: https://argoproj.github.io/argo-helm
      chart: argo-cd
      targetRevision: 7.7.23
      helm:
        releaseName: argo
        valueFiles:
          - $values/argo/values.yaml
    - repoURL: https://git.ar21.de/yolokube/core-deployments.git
      targetRevision: HEAD
      ref: values
    - repoURL: https://git.ar21.de/yolokube/core-deployments.git
      targetRevision: HEAD
      path: argo
  destination:
    server: https://kubernetes.default.svc
    namespace: argocd
  syncPolicy:
    syncOptions:
      - CreateNamespace=true
    automated:
      selfHeal: true
      prune: false
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: longhorn
  namespace: argocd
spec:
  project: default
  sources:
    - repoURL: https://charts.longhorn.io
      chart: longhorn
      targetRevision: 1.8.0  # see Infos below, the CSI snapshotter needs to be updated too <-- version association can be found here: https://longhorn.io/docs/latest/snapshots-and-backups/csi-snapshot-support/enable-csi-snapshot-support/
      helm:
        releaseName: longhorn
        valueFiles:
          - $values/longhorn/values.yaml
    - repoURL: https://git.ar21.de/yolokube/core-deployments.git
      targetRevision: HEAD
      ref: values
    - repoURL: https://git.ar21.de/yolokube/core-deployments.git
      targetRevision: HEAD
      path: longhorn
    - repoURL: https://github.com/kubernetes-csi/external-snapshotter.git
      targetRevision: v7.0.2  # <-- needs to be updated when longhorn version is changed. Find the correct version here: https://longhorn.io/docs/latest/snapshots-and-backups/csi-snapshot-support/csi-volume-snapshot-associated-with-longhorn-snapshot/
      path: client/config/crd
    - repoURL: https://github.com/kubernetes-csi/external-snapshotter.git
      targetRevision: v7.0.2  # <-- needs to be updated when longhorn version is changed. Find the correct version here: https://longhorn.io/docs/latest/snapshots-and-backups/csi-snapshot-support/csi-volume-snapshot-associated-with-longhorn-snapshot/
      path: deploy/kubernetes/snapshot-controller
  destination:
    server: https://kubernetes.default.svc
    namespace: longhorn-system
  syncPolicy:
    syncOptions:
      - CreateNamespace=true
    automated:
      prune: false
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: prometheus
  namespace: argocd
spec:
  project: default
  sources:
    - chart: kube-prometheus-stack
      repoURL: https://prometheus-community.github.io/helm-charts
      targetRevision: 68.1.0
      helm:
        releaseName: prometheus
        valueFiles:
          - $values/prometheus/values.yaml
    - repoURL: https://git.ar21.de/yolokube/core-deployments.git
      targetRevision: HEAD
      ref: values
    - repoURL: https://git.ar21.de/yolokube/core-deployments.git
      targetRevision: HEAD
      path: prometheus
  destination:
    server: https://kubernetes.default.svc
    namespace: prometheus
  syncPolicy:
    syncOptions:
      - CreateNamespace=true
      - ServerSideApply=true
      - RespectIgnoreDifferences=true
    automated:
      prune: false
  ignoreDifferences:
    - group: apps
      kind: Deployment
      jqPathExpressions:
        - '.spec.template.spec.initContainers[]?.resources'
        - '.spec.template.spec.containers[]?.resources'
    - group: apps
      kind: DaemonSet
      jqPathExpressions:
        - '.spec.template.spec.initContainers[]?.resources'
        - '.spec.template.spec.containers[]?.resources'
    - group: admissionregistration.k8s.io
      kind: MutatingWebhookConfiguration
      jqPathExpressions:
        - '.webhooks[]?.clientConfig.caBundle'
    - group: admissionregistration.k8s.io
      kind: ValidatingWebhookConfiguration
      jqPathExpressions:
        - '.webhooks[]?.clientConfig.caBundle'
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: cilium
  namespace: argocd
spec:
  project: default
  sources:
    - chart: cilium
      repoURL: https://helm.cilium.io/
      targetRevision: 1.16.6
      helm:
        releaseName: cilium-cni
        valueFiles:
          - $values/cilium/values.yaml
    - repoURL: https://git.ar21.de/yolokube/core-deployments.git
      targetRevision: HEAD
      ref: values
    - repoURL: https://git.ar21.de/yolokube/core-deployments.git
      targetRevision: HEAD
      path: cilium
  destination:
    server: https://kubernetes.default.svc
    namespace: kube-cilium
  syncPolicy:
    syncOptions:
      - CreateNamespace=true
      - ServerSideApply=true
      - RespectIgnoreDifferences=true
    automated:
      prune: false
  ignoreDifferences:
    - group: apps
      kind: Deployment
      jqPathExpressions:
        - '.spec.template.spec.containers[]?.resources'
    - group: apps
      kind: DaemonSet
      jqPathExpressions:
        - '.spec.template.spec.initContainers[]?.resources'
        - '.spec.template.spec.containers[]?.resources'
        - '.spec.template.metadata.annotations'
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: node-labeler
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://git.ar21.de/yolokube/core-deployments.git
    targetRevision: HEAD
    path: node-labeler
  destination:
    server: https://kubernetes.default.svc
    namespace: node-labeler
  syncPolicy:
    syncOptions:
      - CreateNamespace=true
    automated:
      prune: false
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: quota
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://git.ar21.de/yolokube/core-deployments.git
    targetRevision: HEAD
    path: quota
  destination:
    server: https://kubernetes.default.svc
    namespace: quota
  syncPolicy:
    syncOptions:
      - CreateNamespace=true
    automated:
      prune: false
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: dashboard
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://git.ar21.de/yolokube/core-deployments.git
    targetRevision: HEAD
    path: dashboard/overlays/prod
  destination:
    server: https://kubernetes.default.svc
    namespace: dashboard
  syncPolicy:
    syncOptions:
      - CreateNamespace=true
    automated:
      prune: false
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: dashboard-staging
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://git.ar21.de/yolokube/core-deployments.git
    targetRevision: HEAD
    path: dashboard/overlays/staging
  destination:
    server: https://kubernetes.default.svc
    namespace: dashboard-staging
  syncPolicy:
    syncOptions:
      - CreateNamespace=true
    automated:
      prune: false
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: loki
  namespace: argocd
spec:
  project: default
  sources:
    - chart: loki
      repoURL: https://grafana.github.io/helm-charts
      targetRevision: 6.25.0
      helm:
        releaseName: loki
        valueFiles:
          - $values/loki/values.yaml
    - repoURL: https://git.ar21.de/yolokube/core-deployments.git
      targetRevision: HEAD
      ref: values
    - repoURL: https://git.ar21.de/yolokube/core-deployments.git
      targetRevision: HEAD
      path: loki
  destination:
    server: https://kubernetes.default.svc
    namespace: logs
  syncPolicy:
    syncOptions:
      - CreateNamespace=true
    automated:
      prune: false
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: promtail
  namespace: argocd
spec:
  project: default
  sources:
    - chart: promtail
      repoURL: https://grafana.github.io/helm-charts
      targetRevision: 6.16.6
      helm:
        releaseName: promtail
  destination:
    server: https://kubernetes.default.svc
    namespace: logs
  syncPolicy:
    syncOptions:
      - CreateNamespace=true
    automated:
      prune: false
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: metrics-server
  namespace: argocd
spec:
  project: default
  sources:
    - chart: metrics-server
      repoURL: https://kubernetes-sigs.github.io/metrics-server/
      targetRevision: 3.12.2
      helm:
        releaseName: metrics-server
        values: |
          metrics:
            enabled: true
          serviceMonitor:
            enabled: true
          replicas: 2
          args:
            - --kubelet-insecure-tls
  destination:
    server: https://kubernetes.default.svc
    namespace: kube-system
  syncPolicy:
    syncOptions:
      - CreateNamespace=true
    automated:
      prune: false
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: core-deployments-self
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://git.ar21.de/yolokube/core-deployments.git
    targetRevision: HEAD
    path: "app-files"
    directory:
      include: 'core-deployments.yaml'
  destination:
    server: https://kubernetes.default.svc
    namespace: argocd
  syncPolicy:
    automated:
      prune: false
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: grafana-backuper
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://git.ar21.de/yolokube/core-deployments.git
    targetRevision: HEAD
    path: grafana-backuper
  destination:
    server: https://kubernetes.default.svc
    namespace: grafana-backuper
  syncPolicy:
    automated:
      selfHeal: true
      prune: false
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: cert-manager
  namespace: argocd
spec:
  project: default
  sources:
    - repoURL: https://charts.jetstack.io
      chart: cert-manager
      targetRevision: v1.17.0
      helm:
        releaseName: cert-manager
        valueFiles:
          - $values/cert-manager/values.yaml
    - repoURL: https://git.ar21.de/yolokube/core-deployments.git
      targetRevision: HEAD
      ref: values
    - repoURL: https://git.ar21.de/yolokube/core-deployments.git
      targetRevision: HEAD
      path: cert-manager
  destination:
    server: https://kubernetes.default.svc
    namespace: cert-manager
  syncPolicy:
    syncOptions:
      - CreateNamespace=true
    automated:
      prune: false
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: authentik
  namespace: argocd
spec:
  project: default
  sources:
    - repoURL: https://git.ar21.de/yolokube/core-deployments.git
      targetRevision: HEAD
      path: authentik
  destination:
    server: https://kubernetes.default.svc
    namespace: authentik
  syncPolicy:
    syncOptions:
      - CreateNamespace=true
    automated:
      prune: false
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: thanos
  namespace: argocd
spec:
  project: default
  sources:
    - repoURL: https://git.ar21.de/yolokube/core-deployments.git
      targetRevision: HEAD
      path: thanos
  destination:
    server: https://kubernetes.default.svc
    namespace: thanos
  syncPolicy:
    syncOptions:
      - CreateNamespace=true
    automated:
      prune: false
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: traefik-certmanager
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://git.ar21.de/yolokube/core-deployments.git
    targetRevision: HEAD
    path: traefik-certmanager/overlay
  destination:
    server: https://kubernetes.default.svc
    namespace: traefik
  syncPolicy:
    syncOptions:
      - CreateNamespace=true
    automated:
      prune: false
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: apt-version-exporter
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://git.ar21.de/yolokube/core-deployments.git
    targetRevision: HEAD
    path: apt-version-exporter
  destination:
    server: https://kubernetes.default.svc
    namespace: apt-version-exporter
  syncPolicy:
    syncOptions:
      - CreateNamespace=true
    automated:
      selfHeal: true
      prune: true