{{- if .Values.osm-tile-server.enabled }}
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: osm-tile-server
  namespace: argocd
spec:
  generators:
  - list:
      elements:
      - cluster: https://kubernetes.default.svc
        env: prod
        hostname: osm.srv.oceanbox.io
      - cluster: https://staging-vcluster.staging-vcluster
        env: staging
        hostname: osm.beta.oceanbox.io
  template:
    metadata:
      name: '{{- env }}-osm-tile-server'
    spec:
      project: aux
      destination:
        namespace: oceanbox
        server: '{{- cluster }}'
      source:
        repoURL: https://gitlab.com/oceanbox/manifests.git
        targetRevision: HEAD
        path: values/osm-tile-server
        plugin:
          name: kustomize-helm-with-rewrite
          parameters:
          - name: env
            string: '{{- env }}'
          - name: hostname
            string: '{{- hostname }}'
{{- end }}
