| {{- if .Values.config }} |
| {{- 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." }} |
| {{- end }} |
| |
| {{- if and (not .Values.monitoring.selfMonitoring.enabled) .Values.test.enabled }} |
| {{- fail "Helm test requires self monitoring to be enabled"}} |
| {{- end }} |
| |
| {{- if and (not .Values.monitoring.lokiCanary.enabled) .Values.test.enabled }} |
| {{- fail "Helm test requires the Loki Canary to be enabled"}} |
| {{- end }} |
| |
| {{- if and .Values.test.enabled (not .Values.test.prometheusAddress) }} |
| {{- fail "Helm test requires a prometheusAddress for an instance scraping the Loki canary's metrics"}} |
| {{- end }} |
| |
| {{- $singleBinaryReplicas := int .Values.singleBinary.replicas }} |
| {{- $isUsingFilesystem := eq (include "loki.isUsingObjectStorage" .) "false" }} |
| {{- $atLeastOneScalableReplica := or (gt (int .Values.backend.replicas) 0) (gt (int .Values.read.replicas) 0) (gt (int .Values.write.replicas) 0) }} |
| |
| {{- if and $isUsingFilesystem (gt $singleBinaryReplicas 1) }} |
| {{- fail "Cannot run more than 1 Single Binary replica without an object storage backend."}} |
| {{- end }} |
| |
| {{- if and $isUsingFilesystem (and (eq $singleBinaryReplicas 0) $atLeastOneScalableReplica) }} |
| {{- fail "Cannot run Scalable targets (backend, read, write) without an object storage backend."}} |
| {{- end }} |