{{ if .Values.sorcerer.enabled }}
{{- range .Values.atlantis.envs }}
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: prod-sorcerer
  namespace: argocd
  annotations:
    argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
  finalizers:
  - resources-finalizer.argocd.argoproj.io
spec:
  destination:
    namespace: prod-sorcerer
    server: https://10.255.241.99:4443
  project: atlantis
  sources:
  - repoURL: https://gitlab.com/oceanbox/manifests.git
    targetRevision: main
    ref: values
  - repoURL: https://gitlab.com/oceanbox/manifests.git
    targetRevision: main
    path: values/sorcerer
    plugin:
      name: kustomize-helm-with-rewrite
      parameters:
      - name: env
        string: prod
      - name: hostname
        string: sorcerer.data.oceanbox.io
  - repoURL: https://charts.bitnami.com/bitnami
    targetRevision: 20.1.7
    chart: redis
    helm:
      valueFiles:
      - $values/values/sorcerer/prod/redis.yaml
  ignoreDifferences:
    - kind: Secret
      name: azure-keyvault
      jqPathExpressions:
        - '.data'
        - '.metadata.labels'
        - '.metadata.annotations'
    - kind: Secret
      name: prod-atlantis-rabbitmq
      jqPathExpressions:
        - '.data'
        - '.metadata.labels'
        - '.metadata.annotations'
  syncPolicy:
    syncOptions:
      - CreateNamespace=true
      - ApplyOutOfSyncOnly=true
    # automated:
    #   prune: true
    #   selfHeal: false
{{- end }}
{{- end }}
