{{- if .Values.argo_rollouts.enabled }}
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: argo-rollouts
  namespace: argocd
  annotations:
    argocd.argoproj.io/sync-wave: "-1"
spec:
  destination:
    namespace: argocd
    server: 'https://kubernetes.default.svc'
  sources:
  #- repoURL: {{ .Values.cluster_config.manifests }}
  #  path: {{ .Values.cluster_config.policies }}/argo-rollouts
  #  targetRevision: HEAD
  - repoURL: 'https://argoproj.github.io/argo-helm'
    targetRevision: {{ .Values.argo_rollouts.version }}
    chart: argo-rollouts
    helm:
      values: |
        dashboard:
          enabled: {{ .Values.argo_rollouts.dashboard_enabled }}
        {{- with .Values.argo_rollouts.metrics.enabled }}
        controller:
          metrics:
            enabled: true
            serviceMonitor:
              enabled: true
        {{- end }}
  project: sys
  {{- if .Values.argo_rollouts.autosync }}
  syncPolicy:
    automated:
      prune: true
  {{- end }}
{{- end }}
