{{- if .Values.monitoring }}
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: monitoring
  namespace: {{ include "tenant.name" . }}
  annotations:
    helm.sh/resource-policy: keep
  labels:
    cozystack.io/ui: "true"
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
  chart:
    spec:
      chart: monitoring
      reconcileStrategy: Revision
      sourceRef:
        kind: HelmRepository
        name: cozystack-extra
        namespace: cozy-public
      version: "*"
  interval: 1m0s
  timeout: 5m0s
  values:
    {{- with .Values.host }}
    host: grafana.{{ . }}
    {{- end }}
    metricsStorages:
    - name: shortterm
      retentionPeriod: "3d"
      deduplicationInterval: "5m"
      storage: 10Gi
    - name: longterm
      retentionPeriod: "14d"
      deduplicationInterval: "15s"
      storage: 10Gi
    oncall:
      enabled: false
{{- end }}
