blob: 93e2490636b4e89168e8966e52169444d40ae993 [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
Mohammed Naser65cda132024-05-02 14:34:08 -04005{{- if and (not .Values.lokiCanary.enabled) .Values.test.enabled }}
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +00006{{- fail "Helm test requires the Loki Canary to be enabled"}}
7{{- end }}
8
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +00009{{- $singleBinaryReplicas := int .Values.singleBinary.replicas }}
10{{- $isUsingFilesystem := eq (include "loki.isUsingObjectStorage" .) "false" }}
11{{- $atLeastOneScalableReplica := or (gt (int .Values.backend.replicas) 0) (gt (int .Values.read.replicas) 0) (gt (int .Values.write.replicas) 0) }}
Mohammed Naser65cda132024-05-02 14:34:08 -040012{{- $atLeastOneDistributedReplica := or (gt (int .Values.ingester.replicas) 0) (gt (int .Values.distributor.replicas) 0) (gt (int .Values.querier.replicas) 0) (gt (int .Values.queryFrontend.replicas) 0) (gt (int .Values.queryScheduler.replicas) 0) (gt (int .Values.indexGateway.replicas) 0) (gt (int .Values.compactor.replicas) 0) (gt (int .Values.ruler.replicas) 0) }}
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +000013
14{{- if and $isUsingFilesystem (gt $singleBinaryReplicas 1) }}
15{{- fail "Cannot run more than 1 Single Binary replica without an object storage backend."}}
16{{- end }}
17
Mohammed Naser65cda132024-05-02 14:34:08 -040018{{- if and $isUsingFilesystem (and (eq $singleBinaryReplicas 0) (or $atLeastOneScalableReplica $atLeastOneDistributedReplica)) }}
19{{- fail "Cannot run scalable targets (backend, read, write) or distributed targets without an object storage backend."}}
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +000020{{- end }}
Mohammed Naser65cda132024-05-02 14:34:08 -040021
22{{- if and $atLeastOneScalableReplica $atLeastOneDistributedReplica (ne .Values.deploymentMode "SimpleScalable<->Distributed") }}
23{{- fail "You have more than zero replicas configured for scalable targets (backend, read, write) and distributed targets. If this was intentional change the deploymentMode to the transitional 'SimpleScalable<->Distributed' mode" }}
24{{- end }}
25
26{{- if and (gt $singleBinaryReplicas 0) $atLeastOneDistributedReplica }}
27{{- fail "You have more than zero replicas configured for both the single binary and distributed targets, there is no transition mode between these targets please change one or the other to zero or transition to the SimpleScalable mode first."}}
28{{- end }}
29
30{{- if and (gt $singleBinaryReplicas 0) $atLeastOneScalableReplica (ne .Values.deploymentMode "SingleBinary<->SimpleScalable") }}
31{{- fail "You have more than zero replicas configured for both the single binary and simple scalable targets. If this was intentional change the deploymentMode to the transitional 'SingleBinary<->SimpleScalable' mode"}}
32{{- end }}
33
34{{- if and (or (not (empty .Values.loki.schemaConfig)) (not (empty .Values.loki.structuredConfig.schema_config))) .Values.loki.useTestSchema }}
35{{- fail "loki.useTestSchema must be false if loki.schemaConfig or loki.structuredConfig.schema_config are defined."}}
36{{- end }}
37
38
39{{- if and (empty .Values.loki.schemaConfig) (empty .Values.loki.structuredConfig.schema_config) (not .Values.loki.useTestSchema) }}
40{{- fail "You must provide a schema_config for Loki, one is not provided as this will be individual for every Loki cluster. See https://grafana.com/docs/loki/latest/operations/storage/schema/ for schema information. For quick testing (with no persistence) add `--set loki.useTestSchema=true`"}}
41{{- end }}