Skip to content

Commit

Permalink
mimir-distributed: allow components to override their container image (
Browse files Browse the repository at this point in the history
…#10340)

* mimir-distributed: allow components to override their container image

Signed-off-by: Vladimir Varankin <[email protected]>

* add test values

Signed-off-by: Vladimir Varankin <[email protected]>

* rebuild assets

Signed-off-by: Vladimir Varankin <[email protected]>

* update changelog

Signed-off-by: Vladimir Varankin <[email protected]>

* update code comments

Signed-off-by: Vladimir Varankin <[email protected]>

* add default values for component images

Signed-off-by: Vladimir Varankin <[email protected]>

* update changelog

Signed-off-by: Vladimir Varankin <[email protected]>

* rebuild assets

Signed-off-by: Vladimir Varankin <[email protected]>

* fix how build script removes default image from generated manifest

Signed-off-by: Vladimir Varankin <[email protected]>

* rebuild assets

Signed-off-by: Vladimir Varankin <[email protected]>

* update values comments

Signed-off-by: Vladimir Varankin <[email protected]>

---------

Signed-off-by: Vladimir Varankin <[email protected]>
  • Loading branch information
narqo authored Jan 10, 2025
1 parent 8bedb97 commit 6c186ae
Show file tree
Hide file tree
Showing 138 changed files with 7,221 additions and 25 deletions.
1 change: 1 addition & 0 deletions operations/helm/charts/mimir-distributed/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Entries should include a reference to the Pull Request that introduced the chang

* [CHANGE] Memcached: Update to Memcached 1.6.34. #10318
* [ENHANCEMENT] Minio: update subchart to v5.4.0. #10346
* [ENHANCEMENT] Individual mimir components can override their container images via the *.image values. The component's image definitions always override the values set in global `image` or `enterprise.image`. #10340
* [BUGFIX] Fix calculation of `mimir.siToBytes` and use floating point arithmetics. #10044

## 5.6.0-rc.0
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# General setup
enterprise:
enabled: true
minio:
enabled: false

# Individual components under test
admin_api:
image:
repository: test/admin-api
tag: 1-admin-api

alertmanager:
image:
repository: test/alertmanager
tag: 1-alertmanager

compactor:
image:
repository: test/compactor
tag: 1-compactor

continuous_test:
image:
repository: test/continuous_test
tag: 1-continuous-test

distributor:
image:
repository: test/distributor
tag: 1-distributor

federation_frontend:
enabled: true
image:
repository: test/federation_frontend
tag: 1-federation-frontend

gateway:
image:
repository: test/gateway
tag: 1-gateway

ingester:
image:
repository: test/ingester
tag: 1-ingester

overrides_exporter:
image:
repository: test/overrides_exporter
tag: 1-overrides-exporter

querier:
image:
repository: test/querier
tag: 1-querier

query_frontend:
image:
repository: test/query_frontend
tag: 1-query-frontend

query_scheduler:
image:
repository: test/query_scheduler
tag: 1-query-scheduler

ruler:
image:
repository: test/ruler
tag: 1-ruler

ruler_querier:
image:
repository: test/ruler_querier
tag: 1-ruler-querier

ruler_query_frontend:
image:
repository: test/ruler_query_frontend
tag: 1-ruler-query-frontend

ruler_query_scheduler:
image:
repository: test/ruler_query_scheduler
tag: 1-ruler-query-scheduler

smoke_test:
image:
repository: test/smoke_test
tag: 1-smoke-test

store_gateway:
image:
repository: test/store_gateway
tag: 1-store-gateway
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# General setup
minio:
enabled: false

# Individual components under test
alertmanager:
image:
repository: test/alertmanager
tag: 1-alertmanager

compactor:
image:
repository: test/compactor
tag: 1-compactor

continuous_test:
image:
repository: test/continuous_test
tag: 1-continuous-test

distributor:
image:
repository: test/distributor
tag: 1-distributor

gateway:
image:
repository: test/gateway
tag: 1-gateway

ingester:
image:
repository: test/ingester
tag: 1-ingester

overrides_exporter:
image:
repository: test/overrides_exporter
tag: 1-overrides-exporter

querier:
image:
repository: test/querier
tag: 1-querier

query_frontend:
image:
repository: test/query_frontend
tag: 1-query-frontend

query_scheduler:
image:
repository: test/query_scheduler
tag: 1-query-scheduler

ruler:
image:
repository: test/ruler
tag: 1-ruler

ruler_querier:
image:
repository: test/ruler_querier
tag: 1-ruler-querier

ruler_query_frontend:
image:
repository: test/ruler_query_frontend
tag: 1-ruler-query-frontend

ruler_query_scheduler:
image:
repository: test/ruler_query_scheduler
tag: 1-ruler-query-scheduler

smoke_test:
image:
repository: test/smoke_test
tag: 1-smoke-test

store_gateway:
image:
repository: test/store_gateway
tag: 1-store-gateway
14 changes: 12 additions & 2 deletions operations/helm/charts/mimir-distributed/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,20 @@ Create chart name and version as used by the chart label.
{{- end -}}

{{/*
Calculate image name based on whether enterprise features are requested
Build mimir image reference based on whether enterprise features are requested. The component local values always take precedence.
Params:
ctx = . context
component = component name
*/}}
{{- define "mimir.imageReference" -}}
{{- if .Values.enterprise.enabled -}}{{ .Values.enterprise.image.repository }}:{{ .Values.enterprise.image.tag }}{{- else -}}{{ .Values.image.repository }}:{{ .Values.image.tag }}{{- end -}}
{{- $componentSection := include "mimir.componentSectionFromName" . | fromYaml -}}
{{- $image := $componentSection.image | default dict -}}
{{- if .ctx.Values.enterprise.enabled -}}
{{- $image = mustMerge $image .ctx.Values.enterprise.image -}}
{{- else -}}
{{- $image = mustMerge $image .ctx.Values.image -}}
{{- end -}}
{{ $image.repository }}:{{ $image.tag }}
{{- end -}}

{{/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
{{- end }}
containers:
- name: admin-api
image: "{{ include "mimir.imageReference" . }}"
image: {{ include "mimir.imageReference" (dict "ctx" . "component" "admin-api") }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "-target=admin-api"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ spec:
{{- end }}
containers:
- name: alertmanager
image: "{{ include "mimir.imageReference" . }}"
image: {{ include "mimir.imageReference" (dict "ctx" . "component" "alertmanager") }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "-target=alertmanager"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ spec:
{{ toYaml .Values.alertmanager.extraContainers | nindent 8 }}
{{- end }}
- name: alertmanager
image: "{{ include "mimir.imageReference" . }}"
image: {{ include "mimir.imageReference" (dict "ctx" . "component" "alertmanager") }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "-target=alertmanager"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ spec:
{{ toYaml .Values.compactor.extraContainers | nindent 8 }}
{{- end }}
- name: compactor
image: "{{ include "mimir.imageReference" . }}"
image: {{ include "mimir.imageReference" (dict "ctx" . "component" "compactor") }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "-target=compactor"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
{{- end }}
containers:
- name: continuous-test
image: "{{ include "mimir.imageReference" . }}"
image: {{ include "mimir.imageReference" (dict "ctx" . "component" "continuous-test") }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "-target=continuous-test"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
{{- end }}
containers:
- name: distributor
image: "{{ include "mimir.imageReference" . }}"
image: {{ include "mimir.imageReference" (dict "ctx" . "component" "distributor") }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "-target=distributor"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ spec:
{{- end }}
containers:
- name: federation-frontend
image: {{ include "mimir.imageReference" . | quote }}
image: {{ include "mimir.imageReference" (dict "ctx" . "component" "federation-frontend") }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "-target=federation-frontend"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ spec:
containers:
{{- if $isGEMGateway }}
- name: gateway
image: {{ include "mimir.imageReference" $ | quote }}
image: {{ include "mimir.imageReference" (dict "ctx" $ "component" "gateway") }}
imagePullPolicy: {{ $.Values.image.pullPolicy }}
args:
- "-target=gateway"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ spec:
{{ toYaml .Values.graphite.querier.extraContainers | nindent 8 }}
{{- end }}
- name: graphite-querier
image: {{ include "mimir.imageReference" . | quote }}
image: {{ include "mimir.imageReference" (dict "ctx" . "component" "graphite-querier") }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- -target=graphite-querier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ spec:
{{ toYaml .Values.graphite.write_proxy.extraContainers | nindent 8 }}
{{- end }}
- name: graphite-write-proxy
image: "{{ include "mimir.imageReference" . }}"
image: {{ include "mimir.imageReference" (dict "ctx" . "component" "graphite-write-proxy") }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- -target=graphite-write-proxy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ spec:
{{ toYaml .Values.ingester.extraContainers | nindent 8 }}
{{- end }}
- name: ingester
image: "{{ include "mimir.imageReference" . }}"
image: {{ include "mimir.imageReference" (dict "ctx" . "component" "ingester") }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "-target=ingester"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
{{- end }}
containers:
- name: overrides-exporter
image: "{{ include "mimir.imageReference" . }}"
image: {{ include "mimir.imageReference" (dict "ctx" . "component" "overrides-exporter") }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "-target=overrides-exporter"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ spec:
{{- end }}
containers:
- name: querier
image: "{{ include "mimir.imageReference" . }}"
image: {{ include "mimir.imageReference" (dict "ctx" . "component" "querier") }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "-target=querier"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
{{- end }}
containers:
- name: query-frontend
image: "{{ include "mimir.imageReference" . }}"
image: {{ include "mimir.imageReference" (dict "ctx" . "component" "query-frontend") }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "-target=query-frontend"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ spec:
{{- end }}
containers:
- name: query-scheduler
image: "{{ include "mimir.imageReference" . }}"
image: {{ include "mimir.imageReference" (dict "ctx" . "component" "query-scheduler") }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "-target=query-scheduler"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ spec:
{{- end }}
containers:
- name: ruler-querier
image: "{{ include "mimir.imageReference" . }}"
image: {{ include "mimir.imageReference" (dict "ctx" . "component" "ruler-querier") }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "-target=querier"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
{{- end }}
containers:
- name: ruler-query-frontend
image: "{{ include "mimir.imageReference" . }}"
image: {{ include "mimir.imageReference" (dict "ctx" . "component" "ruler-query-frontend") }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "-target=query-frontend"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ spec:
{{- end }}
containers:
- name: ruler-query-scheduler
image: "{{ include "mimir.imageReference" . }}"
image: {{ include "mimir.imageReference" (dict "ctx" . "component" "ruler-query-scheduler") }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "-target=query-scheduler"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ spec:
{{- end }}
containers:
- name: ruler
image: "{{ include "mimir.imageReference" . }}"
image: {{ include "mimir.imageReference" (dict "ctx" . "component" "ruler") }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "-target=ruler"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ spec:
{{- toYaml .Values.smoke_test.initContainers | nindent 8 }}
containers:
- name: smoke-test
image: "{{ include "mimir.imageReference" . }}"
image: {{ include "mimir.imageReference" (dict "ctx" . "component" "smoke-test") }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "-target=continuous-test"
Expand Down
Loading

0 comments on commit 6c186ae

Please sign in to comment.