{{- $calculatedConfig := include "mimir.calculatedConfig" . | fromYaml }} {{- $unstructuredConfig := include "mimir.unstructuredConfig" . | fromYaml }} {{- if .Values.config }} {{- fail "Top level 'config' is not allowed. In 'mimir.config', provide the configuration as a string that can contain template expressions. Alternatively, you can provide the configuration as an external secret." }} {{- end }} {{- if .Values.podDisruptionBudget }} {{- fail "Top level 'podDisruptionBudget' is removed in favour of per component podDisruptionBudget" }} {{- end }} {{- if not ($calculatedConfig.activity_tracker).filepath }} {{- fail "The 'activity_tracker.filepath' in 'mimir.config' should be set to a path that is on a writeable volume. For example: '/active-query-tracker/activity.log'." }} {{- end }} {{- if ($unstructuredConfig.server).http_listen_port }} {{- fail "The setting 'server.http_listen_port' is not allowed in 'mimir.config' as it leads to a circular dependency. Set it in 'mimir.structuredConfig' instead." }} {{- end }} {{- if ($unstructuredConfig.server).grpc_listen_port }} {{- fail "The setting 'server.grpc_listen_port' is not allowed in 'mimir.config' as it leads to a circular dependency. Set it in 'mimir.structuredConfig' instead." }} {{- end }} {{- if ($unstructuredConfig.memberlist).bind_port }} {{- fail "The setting 'memberlist.bind_port' is not allowed in 'mimir.config' as it leads to a circular dependency. Set it in 'mimir.structuredConfig' instead." }} {{- end }} {{- if not (has .Values.configStorageType (list "Secret" "ConfigMap")) }} {{- fail "The setting 'configStorageType' should be one of 'Secret' or 'ConfigMap'." }} {{- end }} {{- with .Values.metaMonitoring.grafanaAgent }} {{/* !servmon.Enabled && agent.Enabled && (remote.url != "" || (len(additionalConfigs) > 0 && additionalConfigs.url != "")) */}} {{- if and (not ((($.Values).metaMonitoring).serviceMonitor).enabled) .enabled (or (not (empty ((.metrics).remote).url)) (and (not (empty (.metrics).additionalRemoteWriteConfigs)) (not (empty (first (.metrics).additionalRemoteWriteConfigs).url)) ) ) }} {{- fail "metaMonitoring.grafanaAgent.remote.url is set, but metaMonitoring.serviceMonitor is disabled; you will not see any metrics, so enable the metaMonitoring.serviceMonitor or remove the remote configuration" }} {{- end }} {{- end }} {{- with ($calculatedConfig.blocks_storage).bucket_store }} {{- with .chunks_cache }} {{- if and (index $.Values "chunks-cache" "enabled") (eq .backend "memcached") (ne .memcached.addresses (include "mimir.chunksCacheAddress" $)) }} {{- fail (cat "you set chunks-cache.enabled, but the address of the chunks cache in the Mimir configuration in 'blocks_storage.bucket_store.chunks_cache.memcached.addresses'" " is different from the address of the memcached instance created by the chart. (actual: " .memcached.addresses ", expected: " (include "mimir.chunksCacheAddress" $) "). If you want to use your own memcached cluster, disable chunks-cache.enabled and keep the Mimir configuration in mimir.config or mimir.structuredConfig") }} {{- end }} {{- end }} {{- with .metadata_cache }} {{- if and (index $.Values "metadata-cache" "enabled") (eq .backend "memcached") (ne .memcached.addresses (include "mimir.metadataCacheAddress" $)) }} {{- fail (cat "you set metadata-cache.enabled, but the address of the metadata cache in the Mimir configuration in 'blocks_storage.bucket_store.metadata_cache.memcached.addresses'" " is different from the address of the memcached instance created by the chart. (actual: " .memcached.addresses ", expected: " (include "mimir.metadataCacheAddress" $) "). If you want to use your own memcached cluster, disable metadata-cache.enabled and keep the Mimir configuration in mimir.config or mimir.structuredConfig") }} {{- end }} {{- end }} {{- with .index_cache }} {{- if and (index $.Values "index-cache" "enabled") (eq .backend "memcached") (ne .memcached.addresses (include "mimir.indexCacheAddress" $)) }} {{- fail (cat "you set index-cache.enabled, but the address of the index cache in the Mimir configuration in 'blocks_storage.bucket_store.index_cache.memcached.addresses'" " is different from the address of the memcached instance created by the chart. (actual: " .memcached.addresses ", expected: " (include "mimir.indexCacheAddress" $) "). If you want to use your own memcached cluster, disable index-cache.enabled and keep the Mimir configuration in mimir.config or mimir.structuredConfig") }} {{- end }} {{- end }} {{- end }} {{- with ($calculatedConfig.frontend) }} {{- with .results_cache }} {{- if and (index $.Values "results-cache" "enabled") (eq .backend "memcached") (ne .memcached.addresses (include "mimir.resultsCacheAddress" $)) }} {{- fail (cat "you set results-cache.enabled, but the address of the results cache in the Mimir configuration in 'frontend.results_cache.memcached.addresses'" " is different from the address of the memcached instance created by the chart. (actual: " .memcached.addresses ", expected: " (include "mimir.resultsCacheAddress" $) "). If you want to use your own memcached cluster, disable results-cache.enabled and keep the Mimir configuration in mimir.config or mimir.structuredConfig") }} {{- end }} {{- end }} {{- end }} {{- with .Values.memcached }} {{- if .enabled }} {{- fail "memcached.enabled has been renamed to chunks-cache.enabled" }} {{- end }} {{- end }} {{- with (index .Values "memcached-metadata") }} {{- if .enabled }} {{- fail "memcached-metadata.enabled has been renamed to metadata-cache.enabled" }} {{- end }} {{- end }} {{- with (index .Values "memcached-queries") }} {{- if .enabled }} {{- fail "memcached-queries.enabled has been renamed to index-cache.enabled" }} {{- end }} {{- end }} {{- with (index .Values "memcached-results") }} {{- if .enabled }} {{- fail "memcached-results.enabled has been renamed to results-cache.enabled" }} {{- end }} {{- end }} {{- if not .Values.ingester.statefulSet.enabled -}} {{- fail "You have set ingester.statefulSet.enabled=false. Ingesters are stateful, kubernetes Deployment workloads are no longer supported. Please refer to the documentation for more details." }} {{- end -}} {{- if and .Values.ingester.zoneAwareReplication.enabled (not ((($calculatedConfig).ingester).ring).zone_awareness_enabled) -}} {{- fail "You have set ingester.zoneAwareReplication.enabled=true. The mimir.config must include ingester.ring.zone_awareness_enabled=true. Please merge the latest mimir.config from the chart with your mimir.config."}} {{- end -}} {{- if and .Values.ingester.zoneAwareReplication.migration.enabled (not .Values.ingester.zoneAwareReplication.enabled) -}} {{- fail "You have set ingester.zoneAwareReplication.migration.enabled=true, but ingester.zoneAwareReplication.enabled=false. Please consult the Migrating from single zone with Helm document."}} {{- end -}} {{- with $.Values.ingester.zoneAwareReplication.migration }} {{- if and .replicas (not .enabled) }} {{- fail "You have set ingester.zoneAwareReplication.migration.replicas, but ingester.zoneAwareReplication.migration.enabled=false. Please consult the Migrating from single zone with Helm document."}} {{- end -}} {{/* Check that if a migration step is enabled, every previous step is also enabled. */}} {{- $steps := list "enabled" "writePath" "readPath" "excludeDefaultZone" "scaleDownDefaultZone" }} {{- range $i, $item := rest $steps -}} {{- range $j, $mustHave := slice $steps 0 $i }} {{- with $.Values.ingester.zoneAwareReplication.migration }} {{- if and (index . $item) (not (index . $mustHave)) -}} {{- printf "You have set ingester.zoneAwareReplication.migration.%s=true, but ingester.zoneAwareReplication.migration.%s=false. Please consult the Migrating from single zone with Helm document." $item $mustHave | fail }} {{- end -}} {{- end -}} {{- end -}} {{- end -}} {{- end -}} {{- if and .Values.store_gateway.zoneAwareReplication.enabled (not ((($calculatedConfig).store_gateway).sharding_ring).zone_awareness_enabled) -}} {{- fail "You have set store_gateway.zoneAwareReplication.enabled=true. The mimir.config must include store_gateway.sharding_ring.zone_awareness_enabled=true. Please merge the latest mimir.config from the chart with your mimir.config."}} {{- end -}} {{- if and .Values.store_gateway.zoneAwareReplication.migration.enabled (ne (((($calculatedConfig).store_gateway).sharding_ring).kvstore).prefix "multi-zone/") -}} {{- fail "You have set store_gateway.zoneAwareReplication.migration.enabled=true. The mimir.config must include store_gateway.sharding_ring.kvstore.prefix=multi-zone/. Please merge the latest mimir.config from the chart with your mimir.config."}} {{- end -}} {{- if and .Values.store_gateway.zoneAwareReplication.migration.enabled (not .Values.store_gateway.zoneAwareReplication.enabled) -}} {{- fail "You have set store_gateway.zoneAwareReplication.migration.enabled=true, but store_gateway.zoneAwareReplication.enabled=false. Please consult the Migrating from single zone with Helm document."}} {{- end -}} {{- with $.Values.store_gateway.zoneAwareReplication.migration }} {{/* Check that if a migration step is enabled, every previous step is also enabled. */}} {{- $steps := list "enabled" "readPath" }} {{- range $i, $item := rest $steps -}} {{- range $j, $mustHave := slice $steps 0 $i }} {{- with $.Values.store_gateway.zoneAwareReplication.migration }} {{- if and (index . $item) (not (index . $mustHave)) -}} {{- printf "You have set store_gateway.zoneAwareReplication.migration.%s=true, but store_gateway.zoneAwareReplication.migration.%s=false. Please consult the Migrating from single zone with Helm document." $item $mustHave | fail }} {{- end -}} {{- end -}} {{- end -}} {{- end -}} {{- end -}} {{- if and .Values.alertmanager.zoneAwareReplication.enabled (not .Values.alertmanager.statefulSet.enabled) -}} {{- fail "You have set alertmanager.zoneAwareReplication.enabled=true, but alertmanager.statefulSet.enabled=false. This is not a supported configuration." -}} {{- end -}} {{- if and .Values.alertmanager.zoneAwareReplication.enabled (not ((($calculatedConfig).alertmanager).sharding_ring).zone_awareness_enabled) -}} {{- fail "You have set alertmanager.zoneAwareReplication.enabled=true. The mimir.config must include alertmanager.sharding_ring.zone_awareness_enabled=true. Please merge the latest mimir.config from the chart with your mimir.config."}} {{- end -}} {{- if and .Values.alertmanager.zoneAwareReplication.migration.enabled (not .Values.alertmanager.zoneAwareReplication.enabled) -}} {{- fail "You have set alertmanager.zoneAwareReplication.migration.enabled=true, but alertmanager.zoneAwareReplication.enabled=false. Please consult the Migrating from single zone with Helm document."}} {{- end -}} {{- with $.Values.alertmanager.zoneAwareReplication.migration }} {{/* Check that if a migration step is enabled, every previous step is also enabled. */}} {{- $steps := list "enabled" "writePath" }} {{- range $i, $item := rest $steps -}} {{- range $j, $mustHave := slice $steps 0 $i }} {{- with $.Values.alertmanager.zoneAwareReplication.migration }} {{- if and (index . $item) (not (index . $mustHave)) -}} {{- printf "You have set alertmanager.zoneAwareReplication.migration.%s=true, but alertmanager.zoneAwareReplication.migration.%s=false. Please consult the Migrating from single zone with Helm document." $item $mustHave | fail }} {{- end -}} {{- end -}} {{- end -}} {{- end -}} {{- end -}} {{- with .Values.nginx -}} {{- if and .autoscaling.enabled .autoscaling.targetCPUUtilizationPercentage (not ((.resources).requests).cpu) -}} {{- fail "You have enabled nginx.autoscaling.targetCPUUtilizationPercentage, you must also set nginx.resources.requests.cpu." -}} {{- end -}} {{- if and .autoscaling.enabled .autoscaling.targetMemoryUtilizationPercentage (not ((.resources).requests).memory) -}} {{- fail "You have enabled nginx.autoscaling.targetMemoryUtilizationPercentage, you must also set nginx.resources.requests.memory." -}} {{- end -}} {{- end -}} {{- with .Values.gateway -}} {{- if and .autoscaling.enabled .autoscaling.targetCPUUtilizationPercentage (not ((.resources).requests).cpu) -}} {{- fail "You have enabled gateway.autoscaling.targetCPUUtilizationPercentage, you must also set gateway.resources.requests.cpu." -}} {{- end -}} {{- if and .autoscaling.enabled .autoscaling.targetMemoryUtilizationPercentage (not ((.resources).requests).memory) -}} {{- fail "You have enabled gateway.autoscaling.targetMemoryUtilizationPercentage, you must also set gateway.resources.requests.memory." -}} {{- end -}} {{- end -}} {{- if eq .Values.rbac.type "scc" -}} {{- with .Values.rbac.podSecurityContext -}} {{- if or (hasKey . "fsGroup") (hasKey . "runAsGroup") (hasKey . "runAsUser") -}} {{- fail "You have selected rbac.type=scc, you must set the values fsGroup, runAsGroup, runAsUser to null in rbac.podSecurityContext" -}} {{- end -}} {{- end -}} {{- end -}} {{- if eq .Values.rbac.type "scc" -}} {{- with .Values.rollout_operator.podSecurityContext -}} {{- if or (hasKey . "fsGroup") (hasKey . "runAsGroup") (hasKey . "runAsUser") -}} {{- fail "You have selected rbac.type=scc, you must set the values fsGroup, runAsGroup, runAsUser to null in rollout_operator.podSecurityContext" -}} {{- end -}} {{- end -}} {{- end -}} {{- if and .Values.ingress.enabled .Values.gateway.ingress.enabled -}} {{- fail "You have selected both ingress.enabled and gateway.ingress.enabled, you must select either ingress or gateway but not both" -}} {{- end -}}