{{- if .Values.rabbitmq.enabled }}
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: rabbitmq
  namespace: argocd
spec:
  generators:
  - list:
      elements:
      - cluster: https://kubernetes.default.svc
        env: prod
        hostname: rabbitmq.srv.oceanbox.io
      - cluster: https://kubernetes.default.svc
        env: staging
        hostname: rabbitmq.beta.oceanbox.io
  template:
    metadata:
      name: '{{- env }}-rabbitmq'
    spec:
      project: aux
      destination:
        server: https://kubernetes.default.svc
        namespace: rabbitmq
      sources:
        - repoURL: https://charts.bitnami.com/bitnami
          targetRevision: 12.9.0
          chart: rabbitmq
          helm:
            valueFiles:
              - $values/values/rabbitmq/values-{{- env }}.yaml
        - repoURL: https://gitlab.com/oceanbox/manifests.git
          targetRevision: main
          path: values/rabbitmq/{{- env }}
          ref: values
{{- end }}
