From 40bb084b1795843567be1ae1c17f15cdc7a4c471 Mon Sep 17 00:00:00 2001 From: Edward Welch Date: Fri, 1 Mar 2024 00:18:48 +0000 Subject: [PATCH] fix the deployment modes and validations Signed-off-by: Edward Welch --- .../loki/ci/default-single-binary-values.yaml | 15 ++++++++++ .../helm/loki/ci/distributed-values.yaml | 29 +++++++++++++++++++ production/helm/loki/templates/_helpers.tpl | 6 ++-- production/helm/loki/templates/validate.yaml | 8 ++--- production/helm/loki/values.yaml | 4 +-- 5 files changed, 53 insertions(+), 9 deletions(-) create mode 100644 production/helm/loki/ci/default-single-binary-values.yaml create mode 100644 production/helm/loki/ci/distributed-values.yaml diff --git a/production/helm/loki/ci/default-single-binary-values.yaml b/production/helm/loki/ci/default-single-binary-values.yaml new file mode 100644 index 0000000000000..f54c0c139aa64 --- /dev/null +++ b/production/helm/loki/ci/default-single-binary-values.yaml @@ -0,0 +1,15 @@ +--- +loki: + commonConfig: + replication_factor: 1 + image: + tag: "main-5e53303" +deploymentMode: SingleBinary +singleBinary: + replicas: 1 +read: + replicas: 0 +write: + replicas: 0 +backend: + replicas: 0 diff --git a/production/helm/loki/ci/distributed-values.yaml b/production/helm/loki/ci/distributed-values.yaml new file mode 100644 index 0000000000000..dd86b6aecc89d --- /dev/null +++ b/production/helm/loki/ci/distributed-values.yaml @@ -0,0 +1,29 @@ +--- +loki: + commonConfig: + replication_factor: 1 + image: + tag: "2.8.9" +deploymentMode: Distributed +backend: + replicas: 0 +read: + replicas: 0 +write: + replicas: 0 +ingester: + replicas: 1 +querier: + replicas: 1 +queryFrontend: + replicas: 1 +queryScheduler: + replicas: 1 +distributor: + replicas: 1 +compactor: + replicas: 1 +indexGateway: + replicas: 1 +minio: + enabled: true diff --git a/production/helm/loki/templates/_helpers.tpl b/production/helm/loki/templates/_helpers.tpl index f4e13771927b4..fe7604911e769 100644 --- a/production/helm/loki/templates/_helpers.tpl +++ b/production/helm/loki/templates/_helpers.tpl @@ -50,21 +50,21 @@ Params: Return if deployment mode is simple scalable */}} {{- define "loki.deployment.isScalable" -}} - {{- and (eq (include "loki.isUsingObjectStorage" . ) "true") (or (eq .Values.deploymentMode "SimpleScalable")) (eq .Values.deploymentMode "SimpleScalable-Distributed") }} + {{- and (eq (include "loki.isUsingObjectStorage" . ) "true") (or (eq .Values.deploymentMode "SingleBinary<->SimpleScalable") (eq .Values.deploymentMode "SimpleScalable") (eq .Values.deploymentMode "SimpleScalable<->Distributed")) }} {{- end -}} {{/* Return if deployment mode is single binary */}} {{- define "loki.deployment.isSingleBinary" -}} - {{- or (eq .Values.deploymentMode "SingleBinary") (eq .Values.deploymentMode "SingleBinary-SimpleScalable") }} + {{- or (eq .Values.deploymentMode "SingleBinary") (eq .Values.deploymentMode "SingleBinary<->SimpleScalable") }} {{- end -}} {{/* Return if deployment mode is distributed */}} {{- define "loki.deployment.isDistributed" -}} - {{- and (eq (include "loki.isUsingObjectStorage" . ) "true") (or (eq .Values.deploymentMode "Distributed") (eq .Values.deploymentMode "SimpleScalable-Distributed")) }} + {{- and (eq (include "loki.isUsingObjectStorage" . ) "true") (or (eq .Values.deploymentMode "Distributed") (eq .Values.deploymentMode "SimpleScalable<->Distributed")) }} {{- end -}} diff --git a/production/helm/loki/templates/validate.yaml b/production/helm/loki/templates/validate.yaml index 01f4f00f29bf0..fa1938316b60a 100644 --- a/production/helm/loki/templates/validate.yaml +++ b/production/helm/loki/templates/validate.yaml @@ -19,14 +19,14 @@ {{- fail "Cannot run scalable targets (backend, read, write) or distributed targets without an object storage backend."}} {{- end }} -{{- if and $atLeastOneScalableReplica $atLeastOneDistributedReplica (ne .Values.deploymentMode "SimpleScalable-Distributed") }} -{{- 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" }} +{{- if and $atLeastOneScalableReplica $atLeastOneDistributedReplica (ne .Values.deploymentMode "SimpleScalable<->Distributed") }} +{{- 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" }} {{- end }} {{- if and (gt $singleBinaryReplicas 0) $atLeastOneDistributedReplica }} {{- 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."}} {{- end }} -{{- if and (gt $singleBinaryReplicas 0) $atLeastOneScalableReplica }} -{{- 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"}} +{{- if and (gt $singleBinaryReplicas 0) $atLeastOneScalableReplica (ne .Values.deploymentMode "SingleBinary<->SimpleScalable") }} +{{- 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"}} {{- end }} diff --git a/production/helm/loki/values.yaml b/production/helm/loki/values.yaml index 6965f0d48c237..863d17c8079c7 100644 --- a/production/helm/loki/values.yaml +++ b/production/helm/loki/values.yaml @@ -25,8 +25,8 @@ imagePullSecrets: [] # - SimpleScalable: Loki is deployed as 3 targets: read, write, and backend. Useful for medium installs easier to manage than distributed, up to a about 1TB/day. # - Distributed: Loki is deployed as individual microservices. The most complicated but most capable, useful for large installs, typically over 1TB/day. # There are also 2 additional modes used for migrating between deployment modes: -# - SingleBinary-SimpleScalable: Migrate from SingleBinary to SimpleScalable (or vice versa) -# - SimpleScalable-Distributed: Migrate from SimpleScalable to Distributed (or vice versa) +# - SingleBinary<->SimpleScalable: Migrate from SingleBinary to SimpleScalable (or vice versa) +# - SimpleScalable<->Distributed: Migrate from SimpleScalable to Distributed (or vice versa) # Note: SimpleScalable and Distributed REQUIRE the use of object storage. deploymentMode: SimpleScalable