blob: 3a2e8ca79fade871fbfbae3e83959637ff8cf019 [file] [log] [blame]
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +00001{{- if .Values.config }}
2{{- fail "Top level 'config' is not allowed. Most common configuration sections are exposed under the `loki` section. If you need to override the whole config, provide the configuration as a string that can contain template expressions under `loki.config`. Alternatively, you can provide the configuration as an external secret." }}
3{{- end }}
4
5{{- if and (not .Values.monitoring.selfMonitoring.enabled) .Values.test.enabled }}
6{{- fail "Helm test requires self monitoring to be enabled"}}
7{{- end }}
8
9{{- if and (not .Values.monitoring.lokiCanary.enabled) .Values.test.enabled }}
10{{- fail "Helm test requires the Loki Canary to be enabled"}}
11{{- end }}
12
13{{- if and .Values.test.enabled (not .Values.test.prometheusAddress) }}
14{{- fail "Helm test requires a prometheusAddress for an instance scraping the Loki canary's metrics"}}
15{{- end }}
16
17{{- $singleBinaryReplicas := int .Values.singleBinary.replicas }}
18{{- $isUsingFilesystem := eq (include "loki.isUsingObjectStorage" .) "false" }}
19{{- $atLeastOneScalableReplica := or (gt (int .Values.backend.replicas) 0) (gt (int .Values.read.replicas) 0) (gt (int .Values.write.replicas) 0) }}
20
21{{- if and $isUsingFilesystem (gt $singleBinaryReplicas 1) }}
22{{- fail "Cannot run more than 1 Single Binary replica without an object storage backend."}}
23{{- end }}
24
25{{- if and $isUsingFilesystem (and (eq $singleBinaryReplicas 0) $atLeastOneScalableReplica) }}
26{{- fail "Cannot run Scalable targets (backend, read, write) without an object storage backend."}}
27{{- end }}