Skip to content

Commit

Permalink
fix the deployment modes and validations
Browse files Browse the repository at this point in the history
Signed-off-by: Edward Welch <[email protected]>
  • Loading branch information
slim-bean committed Mar 1, 2024
1 parent e512338 commit 40bb084
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 9 deletions.
15 changes: 15 additions & 0 deletions production/helm/loki/ci/default-single-binary-values.yaml
Original file line number Diff line number Diff line change
@@ -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
29 changes: 29 additions & 0 deletions production/helm/loki/ci/distributed-values.yaml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions production/helm/loki/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}


Expand Down
8 changes: 4 additions & 4 deletions production/helm/loki/templates/validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
4 changes: 2 additions & 2 deletions production/helm/loki/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 40bb084

Please sign in to comment.