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

repositories:
- name: loki
  url: https://grafana.github.io/helm-charts

commonLabels:
  tier: system

releases:
- name: loki
  namespace: loki
  chart: loki/loki
  # version: 1.2.3
  condition: loki.enabled
  values:
  - ../values/loki/values/loki.yaml.gotmpl
  - ../values/loki/values/loki-{{ .Environment.Name }}.yaml.gotmpl
  postRenderer: ../bin/kustomizer
  postRendererArgs:
  - ../values/loki/kustomize/{{ .Environment.Name }}
  missingFileHandler: Info
- name: manifests
  namespace: loki
  chart: manifests
  condition: loki.enabled
  missingFileHandler: Info
  values:
  - ../values/env.yaml
  - ../values/env-{{ requiredEnv "ARGOCD_ENV_CLUSTER_NAME" }}.yaml
  - ../values/loki/env.yaml.gotmpl
  - ../values/loki/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/loki/manifests
    - manifests
