Skip to content

Commit

Permalink
A proposal for a helm chart that supports a monolithic
Browse files Browse the repository at this point in the history
deployment. The same chart is used for monolithic,
as was existing for the microservices deployment mode.

To do this a new parameter 'deploymentMode' has been
added to the helm chart. All charts are adapted to
deploy services when applicable according to the
deployment model.

A new template is being added that installs the
monolithic mimir container. All nginx endpoints are
updated to direct to the monolithic service if this
deployment mode has been chosen.

The name of the chart has not been updated from
'mimir-distributed' to 'mimir' yet. This allows for
an easier maintenance as long as this is not merged.
Ideally the rename happens when merging to avoid
further confusion.

I attached a monolithic.yaml yaml file that I have
used to do a monolithic setup.

In monolithic mode, publish not ready addresses and
use these for the frontend.

The read-write mode could be added in the future.

The alert manager is not included in the monolithic
deployment. If you want to run it, you can run it
in a seperate pod by enabling it.

The zone aware reploication functionality is supported
int he monolithic deployment with a similar confiuction
as required for ingester or store gateway.

I have also added the functionality to enable compression
for the monolithic chart. Ideally this would be embedded
into the complete chart instead. A common configuration is
probably the easiest, if you want grpc message compression,
I guess you want it everywhere. The common configuration
setting can then also be used in the monolithic approach.
  • Loading branch information
rubenvw-ngdata authored and janvanbesien-ngdata committed May 31, 2024
1 parent 86a63fb commit b068f97
Show file tree
Hide file tree
Showing 85 changed files with 827 additions and 34 deletions.
2 changes: 2 additions & 0 deletions operations/helm/charts/mimir-distributed/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Entries should include a reference to the Pull Request that introduced the chang

## main / unreleased

* [FEATURE] Support monolithic deployment with the helm chart. #4832

## 5.2.3

* [BUGFIX] admin-cache: set max connections to fix failure to start #7632
Expand Down
81 changes: 81 additions & 0 deletions operations/helm/charts/mimir-distributed/monolithic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# This is an example setup for monolithic mimir deployment

deploymentMode: monolithic

fullnameOverride: mimir

serviceAccount:
annotations:
"eks.amazonaws.com/role-arn": "arn:aws:iam::829850591703:role/multi-az-eks-multi-az-mimir"

mimir:
structuredConfig:
limits:
# Delete from storage metrics data older than 62 days.
compactor_blocks_retention_period: 62d
common:
storage:
backend: s3
s3:
endpoint: s3.eu-west-1.amazonaws.com
region: eu-west-1
blocks_storage:
storage_prefix: blocks
s3:
bucket_name: multi-az-eks-multi-az-mimir
alertmanager_storage:
storage_prefix: alertmanager
s3:
bucket_name: multi-az-eks-multi-az-mimir
ruler_storage:
storage_prefix: ruler
s3:
bucket_name: multi-az-eks-multi-az-mimir

monolithic:
replicas: 3
persistentVolume:
enabled: true
size: "8Gi"
storageClass: gp3-3000-125
priorityClassName: "optional-rescheduling-priority-multi-az"
# The zone aware replication doesn't yet make a lot of difference, since it is not used at query side yet. This is
# however planned in an upcoming release, and therefore it's best to have this configuration already enabled.
zoneAwareReplication:
enabled: true
topologyKey: "topology.kubernetes.io/zone" # This generates default anti-affinity rules
zones: # Zone list has to be fully redefined for modification. Update with you actual zones or skip to use logical zones only.
- name: zone-a
nodeSelector:
topology.kubernetes.io/zone: eu-west-1a
- name: zone-b
nodeSelector:
topology.kubernetes.io/zone: eu-west-1b
- name: zone-c
nodeSelector:
topology.kubernetes.io/zone: eu-west-1c
compression:
enabled: true

nginx:
replicas: 1
priorityClassName: "mandatory-rescheduling-priority-multi-az"
ingress:
enabled: true
hosts:
- host: "mimir.multi-az.test.ngdata.com"
paths:
- path: /
pathType: Prefix
tls:
# empty, disabled.

# Disable Minio, we use S3 storage instead
minio:
enabled: false
replicas: 0

# The Alert manager is currently not used. When enabling, it has to be configured for zone aware replication similar to
# monolithic setup.
alertmanager:
enabled: false
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ Examples:
*/}}
{{- define "mimir.componentSectionFromName" -}}
{{- $componentsMap := dict
"monolithic" "monolithic"
"admin-api" "admin_api"
"admin-cache" "admin-cache"
"alertmanager" "alertmanager"
Expand Down Expand Up @@ -442,6 +443,7 @@ mimir.vaultAgent.annotations takes 2 arguments
*/}}
{{- define "mimir.vaultAgent.annotations" -}}
{{- $vaultEnabledComponents := dict
"monolithic" true
"admin-api" true
"alertmanager" true
"compactor" true
Expand Down Expand Up @@ -528,7 +530,7 @@ which allows us to keep generating everything for the default zone.
{{- end -}}

{{- $requestedReplicas := $componentSection.replicas -}}
{{- if and (has .component (list "ingester" "alertmanager")) $componentSection.zoneAwareReplication.migration.enabled (not $componentSection.zoneAwareReplication.migration.writePath) -}}
{{- if and (has .component (list "monolithic" "ingester" "alertmanager")) $componentSection.zoneAwareReplication.migration.enabled (not $componentSection.zoneAwareReplication.migration.writePath) -}}
{{- $requestedReplicas = $componentSection.zoneAwareReplication.migration.replicas }}
{{- end -}}
{{- $replicaPerZone := div (add $requestedReplicas $numberOfZones -1) $numberOfZones -}}
Expand Down Expand Up @@ -640,4 +642,4 @@ mimir.parseCPU takes 1 argument
{{- else -}}
{{- $value_string }}
{{- end -}}
{{- end -}}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if has .Values.deploymentMode (list "microservices" "monolithic")}}
{{- if .Values.alertmanager.enabled -}}
{{- if .Values.alertmanager.fallbackConfig -}}
apiVersion: v1
Expand All @@ -14,3 +15,4 @@ data:
{{- .Values.alertmanager.fallbackConfig | nindent 4 }}
{{- end -}}
{{- end -}}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if has .Values.deploymentMode (list "microservices" "monolithic")}}
{{- if .Values.alertmanager.enabled -}}
{{- if not .Values.alertmanager.statefulSet.enabled -}}
apiVersion: apps/v1
Expand Down Expand Up @@ -145,3 +146,4 @@ spec:
{{- end }}
{{- end -}}
{{- end -}}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{- if has .Values.deploymentMode (list "microservices" "monolithic")}}
{{- if .Values.alertmanager.enabled -}}
{{- include "mimir.lib.podDisruptionBudget" (dict "ctx" $ "component" "alertmanager" "memberlist" true) }}
{{- end -}}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{- if has .Values.deploymentMode (list "microservices" "monolithic")}}
{{- if .Values.alertmanager.enabled -}}
{{- include "mimir.lib.serviceMonitor" (dict "ctx" $ "component" "alertmanager" "memberlist" true) }}
{{- end -}}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if has .Values.deploymentMode (list "microservices" "monolithic")}}
{{- if .Values.alertmanager.enabled -}}
{{- if .Values.alertmanager.statefulSet.enabled -}}
{{- $args := dict "ctx" . "component" "alertmanager" "memberlist" true -}}
Expand Down Expand Up @@ -202,3 +203,4 @@ spec:
{{ end }}
{{ end }}
{{ end }}
{{ end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if has .Values.deploymentMode (list "microservices" "monolithic")}}
{{- if .Values.alertmanager.enabled -}}
{{- $clusterPort := regexReplaceAll ".+[:]" (default "0.0.0.0:9094" (include "mimir.alertmanagerClusterBindAddress" .) ) "" -}}
apiVersion: v1
Expand Down Expand Up @@ -32,3 +33,4 @@ spec:
selector:
{{- include "mimir.selectorLabels" (dict "ctx" . "component" "alertmanager" "memberlist" true) | nindent 4 }}
{{- end -}}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if has .Values.deploymentMode (list "microservices" "monolithic")}}
{{- if .Values.alertmanager.enabled -}}
{{- $args := dict "ctx" . "component" "alertmanager" "memberlist" true -}}
{{- $zonesMap := include "mimir.zoneAwareReplicationMap" $args | fromYaml -}}
Expand Down Expand Up @@ -37,4 +38,5 @@ spec:
---
{{ end }}
{{ end }}
{{ end }}
{{ end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{- if eq .Values.deploymentMode "microservices" }}
{{- if index .Values "chunks-cache" "enabled" }}
{{- include "mimir.lib.podDisruptionBudget" (dict "ctx" $ "component" "chunks-cache") }}
{{- end -}}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{- if eq .Values.deploymentMode "microservices" }}
{{- if index .Values "chunks-cache" "enabled" }}
{{- include "mimir.lib.serviceMonitor" (dict "ctx" $ "component" "chunks-cache") }}
{{- end -}}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{{- if eq .Values.deploymentMode "microservices" }}
{{- include "mimir.memcached.statefulSet" (dict "ctx" $ "component" "chunks-cache" ) }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{{- if eq .Values.deploymentMode "microservices" }}
{{- include "mimir.memcached.service" (dict "ctx" $ "component" "chunks-cache" ) }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{{- if eq .Values.deploymentMode "microservices" }}
{{- include "mimir.lib.podDisruptionBudget" (dict "ctx" $ "component" "compactor" "memberlist" true) }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{{- if eq .Values.deploymentMode "microservices" }}
{{- include "mimir.lib.serviceMonitor" (dict "ctx" $ "component" "compactor" "memberlist" true) }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if eq .Values.deploymentMode "microservices" }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
Expand Down Expand Up @@ -161,3 +162,4 @@ spec:
{{- with .Values.compactor.extraEnvFrom }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if eq .Values.deploymentMode "microservices" }}
apiVersion: v1
kind: Service
metadata:
Expand All @@ -23,3 +24,4 @@ spec:
targetPort: grpc
selector:
{{- include "mimir.selectorLabels" (dict "ctx" . "component" "compactor" "memberlist" true) | nindent 4 }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if eq .Values.deploymentMode "microservices" }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -142,4 +143,4 @@ spec:
emptyDir: {}
- name: active-queries
emptyDir: {}

{{- end }}
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{{- if eq .Values.deploymentMode "microservices" }}
{{- include "mimir.lib.podDisruptionBudget" (dict "ctx" $ "component" "distributor" "memberlist" true) }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{{- if eq .Values.deploymentMode "microservices" }}
{{- include "mimir.lib.serviceMonitor" (dict "ctx" $ "component" "distributor" "memberlist" true) }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if eq .Values.deploymentMode "microservices" }}
apiVersion: v1
kind: Service
metadata:
Expand Down Expand Up @@ -25,3 +26,4 @@ spec:
targetPort: grpc
selector:
{{- include "mimir.selectorLabels" (dict "ctx" . "component" "distributor" "memberlist" true) | nindent 4 }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if eq .Values.deploymentMode "microservices" }}
apiVersion: v1
kind: Service
metadata:
Expand All @@ -23,3 +24,4 @@ spec:
targetPort: grpc
selector:
{{- include "mimir.selectorLabels" (dict "ctx" . "component" "distributor" "memberlist" true) | nindent 4 }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if eq .Values.deploymentMode "microservices" }}
{{- if (eq (include "mimir.gateway.isEnabled" .) "true") }}
{{- with .Values.gateway }}
{{- $isGEMGateway := $.Values.enterprise.enabled -}}
Expand Down Expand Up @@ -169,3 +170,4 @@ spec:
{{- end }}
{{- end -}}
{{- end -}}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if eq .Values.deploymentMode "microservices" }}
{{- if and (eq (include "mimir.gateway.isEnabled" .) "true") .Values.gateway.ingress.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
Expand Down Expand Up @@ -42,3 +43,4 @@ spec:
{{- end }}
{{- end }}
{{- end -}}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{- if eq .Values.deploymentMode "microservices" }}
{{- if eq (include "mimir.gateway.isEnabled" .) "true" -}}
{{- include "mimir.lib.podDisruptionBudget" (dict "ctx" $ "component" "gateway") }}
{{- end -}}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if eq .Values.deploymentMode "microservices" }}
{{- if .Values.gateway.route.enabled }}
kind: Route
apiVersion: route.openshift.io/v1
Expand All @@ -23,3 +24,4 @@ spec:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{- if eq .Values.deploymentMode "microservices" }}
{{- if and (eq (include "mimir.gateway.isEnabled" .) "true") (not .Values.gateway.enabledNonEnterprise) -}}
{{- include "mimir.lib.serviceMonitor" (dict "ctx" $ "component" "gateway") }}
{{- end -}}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if eq .Values.deploymentMode "microservices" }}
{{- if eq (include "mimir.gateway.isEnabled" .) "true" -}}
{{- with .Values.gateway -}}
apiVersion: v1
Expand Down Expand Up @@ -35,3 +36,4 @@ spec:
{{- include "mimir.selectorLabels" (dict "ctx" $ "component" "gateway") | nindent 4 }}
{{- end -}}
{{- end -}}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if eq .Values.deploymentMode "microservices" }}
{{- if .Values.gateway.autoscaling.enabled }}
{{- if eq (include "mimir.hpa.version" .) "autoscaling/v2" }}
apiVersion: autoscaling/v2
Expand Down Expand Up @@ -33,3 +34,4 @@ spec:
{{- end }}
{{- end -}}
{{- end -}}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if eq .Values.deploymentMode "microservices" }}
{{- if .Values.gateway.autoscaling.enabled }}
{{- if eq (include "mimir.hpa.version" .) "autoscaling/v2beta1" }}
apiVersion: autoscaling/v2beta1
Expand Down Expand Up @@ -29,3 +30,4 @@ spec:
{{- end }}
{{- end -}}
{{- end -}}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if eq .Values.deploymentMode "microservices" }}
{{- if and (not .Values.enterprise.enabled) .Values.gateway.enabledNonEnterprise -}}
apiVersion: v1
kind: ConfigMap
Expand All @@ -10,3 +11,4 @@ data:
nginx.conf: |
{{- tpl .Values.gateway.nginx.config.file . | nindent 4 }}
{{- end -}}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if eq .Values.deploymentMode "microservices" }}
{{- if not .Values.enterprise.enabled -}}
{{- if and .Values.gateway.enabledNonEnterprise .Values.gateway.nginx.basicAuth.enabled (not .Values.gateway.nginx.basicAuth.existingSecret) }}
apiVersion: v1
Expand All @@ -12,3 +13,4 @@ stringData:
{{- tpl .Values.gateway.nginx.basicAuth.htpasswd $ | nindent 4 }}
{{- end -}}
{{- end -}}
{{- end }}
Loading

0 comments on commit b068f97

Please sign in to comment.