From fa14ce67710f997cc61b077e8f280153157b633d Mon Sep 17 00:00:00 2001 From: klimenkoas Date: Tue, 12 Dec 2023 19:05:25 +0400 Subject: [PATCH] Add volumeMounts feature --- templates/beat/deployment.yaml | 26 +++++++++++++++++++++++++- templates/flower/deployment.yaml | 26 +++++++++++++++++++++++++- templates/pre-install-job.yaml | 24 ++++++++++++++++++++++++ templates/web/deployment.yaml | 24 ++++++++++++++++++++++++ templates/worker/deployment.yaml | 24 ++++++++++++++++++++++++ values.yaml | 2 ++ 6 files changed, 124 insertions(+), 2 deletions(-) diff --git a/templates/beat/deployment.yaml b/templates/beat/deployment.yaml index 75cce84..f14ce93 100644 --- a/templates/beat/deployment.yaml +++ b/templates/beat/deployment.yaml @@ -62,7 +62,17 @@ spec: {{- end }} - configMapRef: name: {{ include "django.fullname" . }} - {{- with .Values.beat.nodeSelector }} + {{- if .Values.volumeMounts }} + volumeMounts: + {{- range .Values.volumeMounts }} + - name: {{ .name }} + mountPath: {{ .mountPath }} + {{- if .subPath }} + subPath: {{ .subPath }} + {{- end }} + {{- end }} + {{- end }} + {{- with .Values.web.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} @@ -74,5 +84,19 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} + {{- if .Values.volumeMounts }} + volumes: + {{- range .Values.volumeMounts }} + - name: {{ .name }} + {{- if .source.configMap }} + configMap: + name: {{ .source.configMap.name }} + {{- end }} + {{- if .source.secret }} + secret: + secretName: {{ .source.secret.secretName }} + {{- end }} + {{- end }} + {{- end }} {{- end }} {{- end }} diff --git a/templates/flower/deployment.yaml b/templates/flower/deployment.yaml index ff2f0f5..ce3a6be 100644 --- a/templates/flower/deployment.yaml +++ b/templates/flower/deployment.yaml @@ -5,7 +5,7 @@ metadata: name: {{ include "django.fullname" . }}-flower labels: {{- include "django.labels" . | nindent 4 }} - app.kubernetes.io/component: flower + app.kubernetes.io/component: flower spec: replicas: 1 selector: @@ -57,6 +57,16 @@ spec: {{- end }} - configMapRef: name: {{ include "django.fullname" . }} + {{- if .Values.volumeMounts }} + volumeMounts: + {{- range .Values.volumeMounts }} + - name: {{ .name }} + mountPath: {{ .mountPath }} + {{- if .subPath }} + subPath: {{ .subPath }} + {{- end }} + {{- end }} + {{- end }} {{- with .Values.flower.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} @@ -69,4 +79,18 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} + {{- if .Values.volumeMounts }} + volumes: + {{- range .Values.volumeMounts }} + - name: {{ .name }} + {{- if .source.configMap }} + configMap: + name: {{ .source.configMap.name }} + {{- end }} + {{- if .source.secret }} + secret: + secretName: {{ .source.secret.secretName }} + {{- end }} + {{- end }} + {{- end }} {{- end }} diff --git a/templates/pre-install-job.yaml b/templates/pre-install-job.yaml index c467241..5c88368 100644 --- a/templates/pre-install-job.yaml +++ b/templates/pre-install-job.yaml @@ -49,4 +49,28 @@ spec: envFrom: - configMapRef: name: {{ include "django.fullname" . }} + {{- if .Values.volumeMounts }} + volumeMounts: + {{- range .Values.volumeMounts }} + - name: {{ .name }} + mountPath: {{ .mountPath }} + {{- if .subPath }} + subPath: {{ .subPath }} + {{- end }} + {{- end }} + {{- end }} + {{- if .Values.volumeMounts }} + volumes: + {{- range .Values.volumeMounts }} + - name: {{ .name }} + {{- if .source.configMap }} + configMap: + name: {{ .source.configMap.name }} + {{- end }} + {{- if .source.secret }} + secret: + secretName: {{ .source.secret.secretName }} + {{- end }} + {{- end }} + {{- end }} {{- end }} diff --git a/templates/web/deployment.yaml b/templates/web/deployment.yaml index 9a232bf..967cab9 100644 --- a/templates/web/deployment.yaml +++ b/templates/web/deployment.yaml @@ -83,6 +83,16 @@ spec: {{- end }} - configMapRef: name: {{ include "django.fullname" . }} + {{- if .Values.volumeMounts }} + volumeMounts: + {{- range .Values.volumeMounts }} + - name: {{ .name }} + mountPath: {{ .mountPath }} + {{- if .subPath }} + subPath: {{ .subPath }} + {{- end }} + {{- end }} + {{- end }} {{- with .Values.web.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} @@ -95,3 +105,17 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} + {{- if .Values.volumeMounts }} + volumes: + {{- range .Values.volumeMounts }} + - name: {{ .name }} + {{- if .source.configMap }} + configMap: + name: {{ .source.configMap.name }} + {{- end }} + {{- if .source.secret }} + secret: + secretName: {{ .source.secret.secretName }} + {{- end }} + {{- end }} + {{- end }} diff --git a/templates/worker/deployment.yaml b/templates/worker/deployment.yaml index 35fe4d4..db64863 100644 --- a/templates/worker/deployment.yaml +++ b/templates/worker/deployment.yaml @@ -66,6 +66,16 @@ spec: {{- end }} - configMapRef: name: {{ include "django.fullname" . }} + {{- if .Values.volumeMounts }} + volumeMounts: + {{- range .Values.volumeMounts }} + - name: {{ .name }} + mountPath: {{ .mountPath }} + {{- if .subPath }} + subPath: {{ .subPath }} + {{- end }} + {{- end }} + {{- end }} {{- with .Values.worker.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} @@ -78,4 +88,18 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} + {{- if .Values.volumeMounts }} + volumes: + {{- range .Values.volumeMounts }} + - name: {{ .name }} + {{- if .source.configMap }} + configMap: + name: {{ .source.configMap.name }} + {{- end }} + {{- if .source.secret }} + secret: + secretName: {{ .source.secret.secretName }} + {{- end }} + {{- end }} + {{- end }} {{- end }} diff --git a/values.yaml b/values.yaml index 4b64733..ef13e94 100644 --- a/values.yaml +++ b/values.yaml @@ -24,6 +24,8 @@ env: existingSecret: "" +volumeMounts: [] + web: replicaCount: 2 port: 8080