From 4bd1efd412e3641c809d2bd9f172a99746b897d4 Mon Sep 17 00:00:00 2001 From: Xavier Lange Date: Wed, 25 Sep 2024 13:51:37 -0400 Subject: [PATCH 1/2] per-service extraEnv supports arbitrary YAML --- charts/quickwit/templates/_helpers.tpl | 5 +-- .../templates/control-plane-deployment.yaml | 7 ++-- .../templates/indexer-statefulset.yaml | 5 ++- .../templates/janitor-deployment.yaml | 9 +++-- .../templates/metastore-deployment.yaml | 5 ++- .../templates/searcher-statefulset.yaml | 5 ++- charts/quickwit/values.yaml | 35 +++++++++++-------- 7 files changed, 35 insertions(+), 36 deletions(-) diff --git a/charts/quickwit/templates/_helpers.tpl b/charts/quickwit/templates/_helpers.tpl index 4421428..8aaef6a 100644 --- a/charts/quickwit/templates/_helpers.tpl +++ b/charts/quickwit/templates/_helpers.tpl @@ -155,8 +155,5 @@ Quickwit environment value: "$(POD_IP)" - name: QW_CLUSTER_ENDPOINT value: http://{{ include "quickwit.fullname" $ }}-metastore.{{ $.Release.Namespace }}.svc.cluster.local:7280 -{{- range $key, $value := .Values.environment }} -- name: "{{ $key }}" - value: "{{ $value }}" -{{- end }} +{{ $.Values.environment | toYaml }} {{- end }} diff --git a/charts/quickwit/templates/control-plane-deployment.yaml b/charts/quickwit/templates/control-plane-deployment.yaml index 3d5648d..dcf75cf 100644 --- a/charts/quickwit/templates/control-plane-deployment.yaml +++ b/charts/quickwit/templates/control-plane-deployment.yaml @@ -3,7 +3,7 @@ kind: Deployment metadata: name: {{ include "quickwit.fullname" . }}-control-plane labels: - {{- include "quickwit.labels" . | nindent 4 }} + {{- include "quickwit.labels" . | nindent 4 }} annotations: {{- with .Values.annotations }} {{- toYaml . | nindent 4 }} @@ -56,9 +56,8 @@ spec: {{- end }} env: {{- include "quickwit.environment" . | nindent 12 }} - {{- range $key, $value := .Values.control_plane.extraEnv }} - - name: "{{ $key }}" - value: "{{ $value }}" + {{- with .Values.control_plane.extraEnv }} + {{- . | toYaml | nindent 12 }} {{- end }} {{- if or (.Values.environmentFrom) (.Values.control_plane.extraEnvFrom) }} envFrom: diff --git a/charts/quickwit/templates/indexer-statefulset.yaml b/charts/quickwit/templates/indexer-statefulset.yaml index 52b1e09..272e174 100644 --- a/charts/quickwit/templates/indexer-statefulset.yaml +++ b/charts/quickwit/templates/indexer-statefulset.yaml @@ -60,9 +60,8 @@ spec: {{- end }} env: {{- include "quickwit.environment" . | nindent 12 }} - {{- range $key, $value := .Values.indexer.extraEnv }} - - name: "{{ $key }}" - value: "{{ $value }}" + {{- with .Values.indexer.extraEnv }} + {{- . | toYaml | nindent 12 }} {{- end }} {{- if or (.Values.environmentFrom) (.Values.indexer.extraEnvFrom) }} envFrom: diff --git a/charts/quickwit/templates/janitor-deployment.yaml b/charts/quickwit/templates/janitor-deployment.yaml index 6fb5dc9..4c7b22b 100644 --- a/charts/quickwit/templates/janitor-deployment.yaml +++ b/charts/quickwit/templates/janitor-deployment.yaml @@ -4,7 +4,7 @@ kind: Deployment metadata: name: {{ include "quickwit.fullname" . }}-janitor labels: - {{- include "quickwit.labels" . | nindent 4 }} + {{- include "quickwit.labels" . | nindent 4 }} annotations: {{- with .Values.annotations }} {{- toYaml . | nindent 4 }} @@ -57,9 +57,8 @@ spec: {{- end }} env: {{- include "quickwit.environment" . | nindent 12 }} - {{- range $key, $value := .Values.janitor.extraEnv }} - - name: "{{ $key }}" - value: "{{ $value }}" + {{- with .Values.janitor.extraEnv }} + {{- . | toYaml | nindent 12 }} {{- end }} {{- if or (.Values.environmentFrom) (.Values.janitor.extraEnvFrom) }} envFrom: @@ -122,4 +121,4 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} -{{- end }} +{{- end }} diff --git a/charts/quickwit/templates/metastore-deployment.yaml b/charts/quickwit/templates/metastore-deployment.yaml index 80b461d..8890f3a 100644 --- a/charts/quickwit/templates/metastore-deployment.yaml +++ b/charts/quickwit/templates/metastore-deployment.yaml @@ -55,9 +55,8 @@ spec: {{- end }} env: {{- include "quickwit.environment" . | nindent 12 }} - {{- range $key, $value := .Values.metastore.extraEnv }} - - name: "{{ $key }}" - value: "{{ $value }}" + {{- with .Values.metastore.extraEnv }} + {{- . | toYaml | nindent 12 }} {{- end }} {{- if or (.Values.environmentFrom) (.Values.metastore.extraEnvFrom) }} envFrom: diff --git a/charts/quickwit/templates/searcher-statefulset.yaml b/charts/quickwit/templates/searcher-statefulset.yaml index 0677b33..9781f29 100644 --- a/charts/quickwit/templates/searcher-statefulset.yaml +++ b/charts/quickwit/templates/searcher-statefulset.yaml @@ -60,9 +60,8 @@ spec: {{- end }} env: {{- include "quickwit.environment" . | nindent 12 }} - {{- range $key, $value := .Values.searcher.extraEnv }} - - name: "{{ $key }}" - value: "{{ $value }}" + {{- with .Values.searcher.extraEnv }} + {{- . | toYaml | nindent 12 }} {{- end }} {{- if or (.Values.environmentFrom) (.Values.searcher.extraEnvFrom) }} envFrom: diff --git a/charts/quickwit/values.yaml b/charts/quickwit/values.yaml index d27b912..be7b364 100644 --- a/charts/quickwit/values.yaml +++ b/charts/quickwit/values.yaml @@ -37,8 +37,9 @@ securityContext: runAsUser: 1005 # Additional global env -environment: {} - # KEY: VALUE +environment: [] + # - name: KEY + # value: VALUE environmentFrom: [] # - secretRef: # name: quickwit @@ -53,8 +54,9 @@ searcher: replicaCount: 3 # Extra env for searcher - extraEnv: {} - # KEY: VALUE + extraEnv: [] + # - name: KEY + # value: VALUE extraEnvFrom: [] # - secretRef: # name: quickwit-searcher @@ -129,8 +131,9 @@ indexer: replicaCount: 1 # Extra env for indexer - extraEnv: {} - # KEY: VALUE + extraEnv: [] + # - name: KEY + # value: VALUE extraEnvFrom: [] # - secretRef: # name: quickwit-indexer @@ -209,8 +212,9 @@ metastore: replicaCount: 1 # Extra env for metastore - extraEnv: {} - # KEY: VALUE + extraEnv: [] + # - name: KEY + # value: VALUE # This is the recommended way to inject `QW_METASTORE_URI` when using the postgres metastore (see https://quickwit.io/docs/configuration/metastore-config) extraEnvFrom: [] # - secretRef: @@ -274,8 +278,9 @@ metastore: control_plane: # Extra env for control plane - extraEnv: {} - # KEY: VALUE + extraEnv: [] + # - name: KEY + # value: VALUE extraEnvFrom: [] # - secretRef: # name: quickwit-control-plane @@ -338,8 +343,9 @@ janitor: enabled: true # Extra env for janitor - extraEnv: {} - # KEY: VALUE + extraEnv: [] + # - name: KEY + # value: VALUE extraEnvFrom: [] # - secretRef: # name: quickwit-janitor @@ -403,8 +409,9 @@ bootstrap: enabled: false # Extra env for bootstrap jobs - extraEnv: {} - # KEY: VALUE + extraEnv: [] + # - name: KEY + # value: VALUE extraEnvFrom: [] # - secretRef: # name: quickwit-bootstrap From 5885d51f3ea24c66aaf483d85121595ca114963a Mon Sep 17 00:00:00 2001 From: Xavier Lange Date: Wed, 25 Sep 2024 15:35:33 -0400 Subject: [PATCH 2/2] don't emit an empty environment list --- charts/quickwit/templates/_helpers.tpl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/charts/quickwit/templates/_helpers.tpl b/charts/quickwit/templates/_helpers.tpl index 8aaef6a..eb2ce9d 100644 --- a/charts/quickwit/templates/_helpers.tpl +++ b/charts/quickwit/templates/_helpers.tpl @@ -155,5 +155,7 @@ Quickwit environment value: "$(POD_IP)" - name: QW_CLUSTER_ENDPOINT value: http://{{ include "quickwit.fullname" $ }}-metastore.{{ $.Release.Namespace }}.svc.cluster.local:7280 -{{ $.Values.environment | toYaml }} +{{- with $.Values.environment }} +{{ . | toYaml }} +{{- end }} {{- end }}