{{ if .Values.linkerd.multicluster.enabled }}
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: linkerd-multicluster
  namespace: argocd
  finalizers:
  - resources-finalizer.argocd.argoproj.io
  annotations:
    # Should sync after linkerd (which is wave 0)
    argocd.argoproj.io/sync-wave: "1"
spec:
  destination:
    namespace: linkerd-multicluster
    server: 'https://kubernetes.default.svc'
  source:
    repoURL: 'https://helm.linkerd.io/stable'
    targetRevision: {{ .Values.linkerd.multicluster.version }}
    chart: linkerd-multicluster
    helm:
      values: |
        gateway:
          serviceType: "NodePort"
  project: sys
  syncPolicy:
    managedNamespaceMetadata:
      labels:
        component: sys
    syncOptions:
      - CreateNamespace=true
      - ApplyOutOfSyncOnly=true
    automated:
      prune: true
      # selfHeal: false
{{ end }}
