bases:
 - ../envs/environments.yaml.gotmpl

repositories:
- name: cloudnative-pg
  url: 'https://cloudnative-pg.github.io/charts'

commonLabels:
  tier: system

apiVersions:
- monitoring.coreos.com/v1

releases:
- name: postgres-operator
  namespace: cnpg
  chart: cloudnative-pg/cloudnative-pg
  version: 0.18.2
  condition: postgres_operator.enabled
  values:
  - ../values/postgres-operator/values/postgres-operator.yaml.gotmpl
  - ../values/postgres-operator/values/postgres-operator-{{ .Environment.Name }}.yaml.gotmpl
  postRenderer: ../bin/kustomizer
  postRendererArgs:
  - ../values/postgres-operator/kustomize/{{ .Environment.Name }}
  missingFileHandler: Info
- name: manifests
  namespace: cnpg
  chart: manifests
  condition: postgres_operator.enabled
  missingFileHandler: Info
  values:
  - ../values/env.yaml
  - ../values/env-{{ requiredEnv "ARGOCD_ENV_CLUSTER_NAME" }}.yaml
  - ../values/postgres-operator/env.yaml.gotmpl
  - ../values/postgres-operator/env-{{ requiredEnv "ARGOCD_ENV_CLUSTER_NAME" }}.yaml.gotmpl
  hooks:
  - events: [ prepare, cleanup ]
    showlogs: true
    command: ../bin/helmify
    args:
    - '{{`{{ if eq .Event.Name "prepare" }}build{{ else }}clean{{ end }}`}}'
    - '{{`{{ .Release.Chart }}`}}'
    - '{{`{{ .Environment.Name }}`}}'
    - ../values/postgres-operator/manifests
    - manifests
