From 198152e0004f20f4844bf71451b5eb9d2e29a45a Mon Sep 17 00:00:00 2001 From: Harsha Gudladona Date: Wed, 26 Jun 2024 10:40:14 -0400 Subject: [PATCH 1/2] Introduce component specific initContainers, volumes and volumeMounts Use nodeSelector, affinity, tolerations from bootstrap config values. This ensures pods generated from k8s Job have these settings propagated. Allow command and args to be overridden via values files. This helps in providing custom config files generated from templates as necessary --- charts/quickwit/templates/_helpers.tpl | 2 +- .../templates/control-plane-deployment.yaml | 14 +++ .../templates/indexer-statefulset.yaml | 16 +++- .../templates/janitor-deployment.yaml | 14 +++ .../templates/job-create-indices.yaml | 27 ++++++ .../templates/job-create-sources.yaml | 29 +++++- .../templates/metastore-deployment.yaml | 16 +++- .../templates/searcher-statefulset.yaml | 16 +++- charts/quickwit/values.yaml | 94 +++++++++++++++++++ 9 files changed, 223 insertions(+), 5 deletions(-) diff --git a/charts/quickwit/templates/_helpers.tpl b/charts/quickwit/templates/_helpers.tpl index 574d1a3..4421428 100644 --- a/charts/quickwit/templates/_helpers.tpl +++ b/charts/quickwit/templates/_helpers.tpl @@ -144,7 +144,7 @@ Quickwit environment fieldRef: fieldPath: status.podIP - name: QW_CONFIG - value: node.yaml + value: {{ .Values.configLocation }} - name: QW_CLUSTER_ID value: {{ .Release.Namespace }}-{{ include "quickwit.fullname" . }} - name: QW_NODE_ID diff --git a/charts/quickwit/templates/control-plane-deployment.yaml b/charts/quickwit/templates/control-plane-deployment.yaml index 4b93996..3d5648d 100644 --- a/charts/quickwit/templates/control-plane-deployment.yaml +++ b/charts/quickwit/templates/control-plane-deployment.yaml @@ -39,13 +39,21 @@ spec: serviceAccountName: {{ include "quickwit.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- with .Values.control_plane.initContainers }} + initContainers: + {{- toYaml . | nindent 8 }} + {{ end }} containers: - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if $.Values.control_plane.args }} + args: {{- toYaml $.Values.control_plane.args | nindent 10 }} + {{- else }} args: ["run", "--service", "control_plane"] + {{- end }} env: {{- include "quickwit.environment" . | nindent 12 }} {{- range $key, $value := .Values.control_plane.extraEnv }} @@ -79,6 +87,9 @@ spec: - name: {{ .name }} mountPath: {{ .mountPath }} {{- end }} + {{- with .Values.indexer.extraVolumeMounts }} + {{- toYaml . | nindent 12 }} + {{- end }} resources: {{- toYaml .Values.control_plane.resources | nindent 14 }} volumes: @@ -95,6 +106,9 @@ spec: configMap: name: {{ .name }} {{- end }} + {{- with .Values.indexer.extraVolumes }} + {{- toYaml . | nindent 8 }} + {{- end }} {{- with .Values.control_plane.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/charts/quickwit/templates/indexer-statefulset.yaml b/charts/quickwit/templates/indexer-statefulset.yaml index a41362d..7925567 100644 --- a/charts/quickwit/templates/indexer-statefulset.yaml +++ b/charts/quickwit/templates/indexer-statefulset.yaml @@ -43,12 +43,21 @@ spec: serviceAccountName: {{ include "quickwit.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- with .Values.indexer.initContainers }} + initContainers: + {{- toYaml . | nindent 8 }} + {{ end }} containers: - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if $.Values.indexer.args }} + args: {{- toYaml $.Values.indexer.args | nindent 10 }} + {{- else }} + args: ["run", "--service", "indexer"] + {{- end }} env: {{- include "quickwit.environment" . | nindent 12 }} {{- range $key, $value := .Values.indexer.extraEnv }} @@ -64,7 +73,6 @@ spec: {{- toYaml . | nindent 12 }} {{- end }} {{- end }} - args: ["run", "--service", "indexer"] ports: {{- include "quickwit.ports" . | nindent 12 }} startupProbe: @@ -83,6 +91,9 @@ spec: - name: {{ .name }} mountPath: {{ .mountPath }} {{- end }} + {{- with .Values.indexer.extraVolumeMounts }} + {{- toYaml . | nindent 12 }} + {{- end }} resources: {{- toYaml .Values.indexer.resources | nindent 12 }} volumes: @@ -101,6 +112,9 @@ spec: configMap: name: {{ .name }} {{- end }} + {{- with .Values.indexer.extraVolumes }} + {{- toYaml . | nindent 8 }} + {{- end }} {{- with .Values.indexer.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/charts/quickwit/templates/janitor-deployment.yaml b/charts/quickwit/templates/janitor-deployment.yaml index ac41ad7..6fb5dc9 100644 --- a/charts/quickwit/templates/janitor-deployment.yaml +++ b/charts/quickwit/templates/janitor-deployment.yaml @@ -40,13 +40,21 @@ spec: serviceAccountName: {{ include "quickwit.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- with .Values.janitor.initContainers }} + initContainers: + {{ toYaml . | nindent 8 }} + {{ end }} containers: - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if $.Values.janitor.args }} + args: {{- toYaml $.Values.janitor.args | nindent 10 }} + {{- else }} args: ["run", "--service", "janitor"] + {{- end }} env: {{- include "quickwit.environment" . | nindent 12 }} {{- range $key, $value := .Values.janitor.extraEnv }} @@ -80,6 +88,9 @@ spec: - name: {{ .name }} mountPath: {{ .mountPath }} {{- end }} + {{- with .Values.indexer.extraVolumeMounts }} + {{- toYaml . | nindent 12 }} + {{- end }} resources: {{- toYaml .Values.janitor.resources | nindent 14 }} volumes: @@ -96,6 +107,9 @@ spec: configMap: name: {{ .name }} {{- end }} + {{- with .Values.indexer.extraVolumes }} + {{- toYaml . | nindent 8 }} + {{- end }} {{- with .Values.janitor.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/charts/quickwit/templates/job-create-indices.yaml b/charts/quickwit/templates/job-create-indices.yaml index 675e438..1ded159 100644 --- a/charts/quickwit/templates/job-create-indices.yaml +++ b/charts/quickwit/templates/job-create-indices.yaml @@ -24,16 +24,25 @@ spec: imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} + serviceAccountName: {{ include "quickwit.serviceAccountName" $ }} securityContext: {{- toYaml $.Values.podSecurityContext | nindent 8 }} restartPolicy: Never + {{- with $.Values.jobs.indexes.initContainers }} + initContainers: + {{- toYaml . | nindent 8 }} + {{ end }} containers: - name: {{ $.Chart.Name }} securityContext: {{- toYaml $.Values.securityContext | nindent 10 }} image: "{{ $.Values.image.repository }}:{{ $.Values.image.tag | default $.Chart.AppVersion }}" imagePullPolicy: {{ $.Values.image.pullPolicy }} + {{- if $.Values.jobs.indexes.command }} + command: {{- toYaml $.Values.jobs.sources.command | nindent 8 }} + {{- else }} command: ["/bin/bash","-c","quickwit index describe --index {{ .index_id }} --endpoint ${QW_CLUSTER_ENDPOINT} || quickwit index create --index-config {{ .index_id }}.yaml --endpoint ${QW_CLUSTER_ENDPOINT}"] + {{- end }} env: {{- include "quickwit.environment" $ | nindent 10 }} {{- range $key, $value := $.Values.bootstrap.extraEnv }} @@ -56,6 +65,9 @@ spec: - name: index mountPath: /quickwit/{{ .index_id }}.yaml subPath: {{ .index_id }}.yaml + {{- with $.Values.jobs.indexes.extraVolumeMounts }} + {{- toYaml . | nindent 10 }} + {{- end }} resources: {{- toYaml $.Values.bootstrap.resources | nindent 10 }} volumes: @@ -71,5 +83,20 @@ spec: items: - key: {{ .index_id }}.yaml path: {{ .index_id }}.yaml + {{- with $.Values.jobs.indexes.extraVolumes }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with $.Values.bootstrap.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with $.Values.bootstrap.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with $.Values.bootstrap.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} {{- end }} {{- end }} diff --git a/charts/quickwit/templates/job-create-sources.yaml b/charts/quickwit/templates/job-create-sources.yaml index 8db18ff..96ce09b 100644 --- a/charts/quickwit/templates/job-create-sources.yaml +++ b/charts/quickwit/templates/job-create-sources.yaml @@ -24,16 +24,25 @@ spec: imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} + serviceAccountName: {{ include "quickwit.serviceAccountName" $ }} securityContext: {{- toYaml $.Values.podSecurityContext | nindent 8 }} restartPolicy: Never + {{- with $.Values.jobs.sources.initContainers }} + initContainers: + {{- toYaml . | nindent 8 }} + {{ end }} containers: - name: {{ $.Chart.Name }} securityContext: {{- toYaml $.Values.securityContext | nindent 10 }} image: "{{ $.Values.image.repository }}:{{ $.Values.image.tag | default $.Chart.AppVersion }}" imagePullPolicy: {{ $.Values.image.pullPolicy }} - command: ["/bin/bash","-c","quickwit source describe --index {{ .index }} --source {{ .source.source_id }} --endpoint ${QW_CLUSTER_ENDPOINT}|| quickwit source create --index {{ .index }} --source-config {{ .source.source_id }}.yaml --endpoint ${QW_CLUSTER_ENDPOINT}"] + {{- if $.Values.jobs.sources.command }} + command: {{- toYaml $.Values.jobs.sources.command | nindent 8 }} + {{- else }} + command: ["/bin/bash","-c","quickwit source describe --index {{ .index }} --source {{ .source.source_id }} --endpoint ${QW_CLUSTER_ENDPOINT} || quickwit source create --index {{ .index }} --source-config {{ .source.source_id }}.yaml --endpoint ${QW_CLUSTER_ENDPOINT}"] + {{- end }} env: {{- include "quickwit.environment" $ | nindent 10 }} {{- range $key, $value := $.Values.bootstrap.extraEnv }} @@ -58,6 +67,9 @@ spec: mountPath: /quickwit/{{ .source.source_id }}.yaml subPath: {{ .source.source_id }}.yaml {{- end }} + {{- with $.Values.jobs.sources.extraVolumeMounts }} + {{- toYaml . | nindent 10 }} + {{- end }} resources: {{- toYaml $.Values.bootstrap.resources | nindent 10 }} volumes: @@ -73,5 +85,20 @@ spec: items: - key: {{ .source.source_id }}.yaml path: {{ .source.source_id }}.yaml + {{- with $.Values.jobs.sources.extraVolumes }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with $.Values.bootstrap.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with $.Values.bootstrap.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with $.Values.bootstrap.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} {{- end }} {{- end }} diff --git a/charts/quickwit/templates/metastore-deployment.yaml b/charts/quickwit/templates/metastore-deployment.yaml index 39f446f..3b19071 100644 --- a/charts/quickwit/templates/metastore-deployment.yaml +++ b/charts/quickwit/templates/metastore-deployment.yaml @@ -38,13 +38,21 @@ spec: serviceAccountName: {{ include "quickwit.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- with .Values.metastore.initContainers }} + initContainers: + {{- toYaml . | nindent 8 }} + {{ end }} containers: - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if $.Values.metastore.args }} + args: {{- toYaml $.Values.metastore.args | nindent 10 }} + {{- else }} args: ["run", "--service", "metastore"] + {{- end }} env: {{- include "quickwit.environment" . | nindent 12 }} {{- range $key, $value := .Values.metastore.extraEnv }} @@ -78,6 +86,9 @@ spec: - name: {{ .name }} mountPath: {{ .mountPath }} {{- end }} + {{- with .Values.metastore.extraVolumeMounts }} + {{- toYaml . | nindent 12 }} + {{- end }} resources: {{- toYaml .Values.metastore.resources | nindent 14 }} volumes: @@ -94,6 +105,9 @@ spec: configMap: name: {{ .name }} {{- end }} + {{- with .Values.metastore.extraVolumes }} + {{- toYaml . | nindent 10 }} + {{- end }} {{- with .Values.metastore.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/charts/quickwit/templates/searcher-statefulset.yaml b/charts/quickwit/templates/searcher-statefulset.yaml index 072dd70..8b977cf 100644 --- a/charts/quickwit/templates/searcher-statefulset.yaml +++ b/charts/quickwit/templates/searcher-statefulset.yaml @@ -43,12 +43,21 @@ spec: serviceAccountName: {{ include "quickwit.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- with .Values.searcher.initContainers }} + initContainers: + {{- toYaml . | nindent 8 }} + {{ end }} containers: - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if $.Values.searcher.args }} + args: {{- toYaml $.Values.searcher.args | nindent 10 }} + {{- else }} + args: ["run", "--service", "searcher"] + {{- end }} env: {{- include "quickwit.environment" . | nindent 12 }} {{- range $key, $value := .Values.searcher.extraEnv }} @@ -64,7 +73,6 @@ spec: {{- toYaml . | nindent 12 }} {{- end }} {{- end }} - args: ["run", "--service", "searcher"] ports: {{- include "quickwit.ports" . | nindent 12 }} startupProbe: @@ -83,6 +91,9 @@ spec: - name: {{ .name }} mountPath: {{ .mountPath }} {{- end }} + {{- with .Values.searcher.extraVolumeMounts }} + {{- toYaml . | nindent 12 }} + {{- end }} resources: {{- toYaml .Values.searcher.resources | nindent 14 }} volumes: @@ -101,6 +112,9 @@ spec: configMap: name: {{ .name }} {{- end }} + {{- with .Values.searcher.extraVolumes }} + {{- toYaml . | nindent 10 }} + {{- end }} {{- with .Values.searcher.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/charts/quickwit/values.yaml b/charts/quickwit/values.yaml index c16cf99..6ec8053 100644 --- a/charts/quickwit/values.yaml +++ b/charts/quickwit/values.yaml @@ -61,6 +61,12 @@ searcher: # - configMapRef: # name: quickwit-searcher + # extraVolumes -- Additional Volumes to use with Vector Pods. + extraVolumes: [] + + # extraVolumeMounts -- Additional Volume to mount into Vector Containers. + extraVolumeMounts: [] + resources: {} # limits: # cpu: 100m @@ -99,6 +105,12 @@ searcher: path: /health/readyz port: rest + # Override args for starting container + args: [] + + # initContainers -- Init Containers to be added to the pods + initContainers: [] + annotations: {} podAnnotations: {} @@ -123,6 +135,12 @@ indexer: # - configMapRef: # name: quickwit-indexer + # extraVolumes -- Additional Volumes to use with Vector Pods. + extraVolumes: [] + + # extraVolumeMounts -- Additional Volume to mount into Vector Containers. + extraVolumeMounts: [] + resources: {} # limits: # cpu: 100m @@ -156,6 +174,12 @@ indexer: path: /health/readyz port: rest + # Override args for starting container + args: [] + + # initContainers -- Init Containers to be added to the pods + initContainers: [] + annotations: {} podAnnotations: {} @@ -186,6 +210,12 @@ metastore: # - configMapRef: # name: quickwit-metastore + # extraVolumes -- Additional Volumes to use with Vector Pods. + extraVolumes: [] + + # extraVolumeMounts -- Additional Volume to mount into Vector Containers. + extraVolumeMounts: [] + resources: {} # limits: # cpu: 100m @@ -214,6 +244,12 @@ metastore: path: /health/readyz port: rest + # Override args for starting container + args: [] + + # initContainers -- Init Containers to be added to the pods + initContainers: [] + annotations: {} podAnnotations: {} @@ -236,6 +272,12 @@ control_plane: # - configMapRef: # name: quickwit-control-plane + # extraVolumes -- Additional Volumes to use with Vector Pods. + extraVolumes: [] + + # extraVolumeMounts -- Additional Volume to mount into Vector Containers. + extraVolumeMounts: [] + resources: {} # limits: # cpu: 100m @@ -261,6 +303,12 @@ control_plane: path: /health/readyz port: rest + # Override args for starting container + args: [] + + # initContainers -- Init Containers to be added to the pods + initContainers: [] + annotations: {} podAnnotations: {} @@ -284,6 +332,12 @@ janitor: # - configMapRef: # name: quickwit-janitor + # extraVolumes -- Additional Volumes to use with Vector Pods. + extraVolumes: [] + + # extraVolumeMounts -- Additional Volume to mount into Vector Containers. + extraVolumeMounts: [] + resources: {} # limits: # cpu: 100m @@ -309,6 +363,12 @@ janitor: path: /health/readyz port: rest + # Override args for starting container + args: [] + + # initContainers -- Init Containers to be added to the pods + initContainers: [] + annotations: {} podAnnotations: {} @@ -333,6 +393,12 @@ bootstrap: # - configMapRef: # name: quickwit-boostrap + # extraVolumes -- Additional Volumes to use with Vector Pods. + extraVolumes: [] + + # extraVolumeMounts -- Additional Volume to mount into Vector Containers. + extraVolumeMounts: [] + resources: {} # limits: # cpu: 100m @@ -341,17 +407,45 @@ bootstrap: # cpu: 100m # memory: 128Mi + # initContainers -- Init Containers to be added to the pods + initContainers: [] + nodeSelector: {} tolerations: [] affinity: {} +jobs: + sources: + # Override command for starting container + command: [] + + # initContainers -- Init Containers to be added to the pods + initContainers: [] + + # extraVolumes -- Additional Volumes to use with quickwit Pods. + extraVolumes: [] + + # extraVolumeMounts -- Additional Volume to mount into quickwit Containers. + extraVolumeMounts: [] + + indexes: + # initContainers -- Init Containers to be added to the pods + initContainers: [] + + # extraVolumes -- Additional Volumes to use with quickwit Pods. + extraVolumes: [] + + # extraVolumeMounts -- Additional Volume to mount into quickwit Containers. + extraVolumeMounts: [] # Quickwit configuration # Warning: This config is writed directly into a configMap # to avoid passing sensitive value you can pass environment variables. # https://quickwit.io/docs/configuration/node-config#using-environment-variables-in-the-configuration +configLocation: /quickwit/node.yaml + config: version: 0.8 listen_address: 0.0.0.0 From ad9371e10b107533098ca63a7621478f48e48ae3 Mon Sep 17 00:00:00 2001 From: Harsha Gudladona Date: Thu, 11 Jul 2024 10:06:23 -0400 Subject: [PATCH 2/2] Bump version to 0.6.2 --- charts/quickwit/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/quickwit/Chart.yaml b/charts/quickwit/Chart.yaml index 5942487..9cef5ee 100644 --- a/charts/quickwit/Chart.yaml +++ b/charts/quickwit/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: quickwit description: Sub-second search & analytics engine on cloud storage. type: application -version: 0.6.0 +version: 0.6.2 appVersion: "v0.8.1" keywords: - quickwit