aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaiwalya Joshi <kjoshi@d2iq.com>2022-08-03 12:21:36 -0700
committerKaiwalya Joshi <kjoshi@d2iq.com>2022-08-03 12:21:36 -0700
commit6e9d39ac72e1e23cce63f6c518e0c7aaa5d9415a (patch)
treeda5feac7cf9ef3e03686b3f3a148d7a75f40c2a9
parent90db4b5a44a3fcb70209a116789844acefed1d28 (diff)
downloadseaweedfs-6e9d39ac72e1e23cce63f6c518e0c7aaa5d9415a.tar.xz
seaweedfs-6e9d39ac72e1e23cce63f6c518e0c7aaa5d9415a.zip
feat: Add support for initContainers
-rw-r--r--k8s/helm_charts2/templates/_helpers.tpl9
-rw-r--r--k8s/helm_charts2/templates/filer-statefulset.yaml4
-rw-r--r--k8s/helm_charts2/templates/master-statefulset.yaml4
-rw-r--r--k8s/helm_charts2/templates/s3-deployment.yaml4
-rw-r--r--k8s/helm_charts2/templates/volume-statefulset.yaml20
-rw-r--r--k8s/helm_charts2/values.yaml8
6 files changed, 42 insertions, 7 deletions
diff --git a/k8s/helm_charts2/templates/_helpers.tpl b/k8s/helm_charts2/templates/_helpers.tpl
index b679fe520..b8048abb6 100644
--- a/k8s/helm_charts2/templates/_helpers.tpl
+++ b/k8s/helm_charts2/templates/_helpers.tpl
@@ -173,4 +173,13 @@ Inject extra environment vars in the format key:value, if populated
{{- printf "false" -}}
{{- end -}}
{{- end -}}
+{{- end -}}
+
+{{/* check if any InitContainers exist for Volumes */}}
+{{- define "volume.initContainers_exists" -}}
+{{- if or (not (empty .Values.volume.dir_idx )) (not (empty .Values.volume.initContainers )) -}}
+{{- printf "true" -}}
+{{- else -}}
+{{- printf "false" -}}
+{{- end -}}
{{- end -}} \ No newline at end of file
diff --git a/k8s/helm_charts2/templates/filer-statefulset.yaml b/k8s/helm_charts2/templates/filer-statefulset.yaml
index 266c95a98..c36783650 100644
--- a/k8s/helm_charts2/templates/filer-statefulset.yaml
+++ b/k8s/helm_charts2/templates/filer-statefulset.yaml
@@ -52,6 +52,10 @@ spec:
priorityClassName: {{ .Values.filer.priorityClassName | quote }}
{{- end }}
enableServiceLinks: false
+ {{- if .Values.filer.initContainers }}
+ initContainers:
+ {{ tpl .Values.filer.initContainers . | nindent 8 | trim }}
+ {{- end }}
containers:
- name: seaweedfs
image: {{ template "filer.image" . }}
diff --git a/k8s/helm_charts2/templates/master-statefulset.yaml b/k8s/helm_charts2/templates/master-statefulset.yaml
index 8af1bf91d..65038be78 100644
--- a/k8s/helm_charts2/templates/master-statefulset.yaml
+++ b/k8s/helm_charts2/templates/master-statefulset.yaml
@@ -51,6 +51,10 @@ spec:
priorityClassName: {{ .Values.master.priorityClassName | quote }}
{{- end }}
enableServiceLinks: false
+ {{- if .Values.master.initContainers }}
+ initContainers:
+ {{ tpl .Values.master.initContainers . | nindent 8 | trim }}
+ {{- end }}
containers:
- name: seaweedfs
image: {{ template "master.image" . }}
diff --git a/k8s/helm_charts2/templates/s3-deployment.yaml b/k8s/helm_charts2/templates/s3-deployment.yaml
index aac09f328..e3b5b33b4 100644
--- a/k8s/helm_charts2/templates/s3-deployment.yaml
+++ b/k8s/helm_charts2/templates/s3-deployment.yaml
@@ -39,6 +39,10 @@ spec:
priorityClassName: {{ .Values.s3.priorityClassName | quote }}
{{- end }}
enableServiceLinks: false
+ {{- if .Values.s3.initContainers }}
+ initContainers:
+ {{ tpl .Values.s3.initContainers . | nindent 8 | trim }}
+ {{- end }}
containers:
- name: seaweedfs
image: {{ template "s3.image" . }}
diff --git a/k8s/helm_charts2/templates/volume-statefulset.yaml b/k8s/helm_charts2/templates/volume-statefulset.yaml
index de2703d14..d0031e1e2 100644
--- a/k8s/helm_charts2/templates/volume-statefulset.yaml
+++ b/k8s/helm_charts2/templates/volume-statefulset.yaml
@@ -45,18 +45,24 @@ spec:
priorityClassName: {{ .Values.volume.priorityClassName | quote }}
{{- end }}
enableServiceLinks: false
- {{- if .Values.volume.dir_idx }}
+ {{- $initContainers_exists := include "volume.initContainers_exists" . -}}
+ {{- if $initContainers_exists }}
initContainers:
+ {{- if .Values.volume.dir_idx }}
- name: seaweedfs-vol-move-idx
image: {{ template "volume.image" . }}
- imagePullPolicy: {{ .Values.global.pullPolicy | default "IfNotPresent" }}
+ imagePullPolicy: {{ .Values.global.imagePullPolicy | default "IfNotPresent" }}
command: [ '/bin/sh', '-c' ]
- args: ['if ls {{ .Values.volume.dir }}/*.idx >/dev/null 2>&1; then mv {{ .Values.volume.dir }}/*.idx {{ .Values.volume.dir_idx }}/; fi;']
+ args: [ 'if ls {{ .Values.volume.dir }}/*.idx >/dev/null 2>&1; then mv {{ .Values.volume.dir }}/*.idx {{ .Values.volume.dir_idx }}/; fi;' ]
volumeMounts:
- - name: idx
- mountPath: {{ .Values.volume.dir_idx }}
- - name: data
- mountPath: {{ .Values.volume.dir }}
+ - name: idx
+ mountPath: {{ .Values.volume.dir_idx }}
+ - name: data
+ mountPath: {{ .Values.volume.dir }}
+ {{- end }}
+ {{- if .Values.volume.initContainers }}
+ {{ tpl .Values.volume.initContainers . | nindent 8 | trim }}
+ {{- end }}
{{- end }}
containers:
- name: seaweedfs
diff --git a/k8s/helm_charts2/values.yaml b/k8s/helm_charts2/values.yaml
index 948b336b9..6f724879c 100644
--- a/k8s/helm_charts2/values.yaml
+++ b/k8s/helm_charts2/values.yaml
@@ -73,6 +73,8 @@ master:
size: ""
storageClass: ""
+ initContainers: ""
+
extraVolumes: ""
extraVolumeMounts: ""
@@ -210,6 +212,8 @@ volume:
# Adjust jpg orientation when uploading.
imagesFixOrientation: false
+ initContainers: ""
+
extraVolumes: ""
extraVolumeMounts: ""
@@ -309,6 +313,8 @@ filer:
size: ""
storageClass: ""
+ initContainers: ""
+
extraVolumes: ""
extraVolumeMounts: ""
@@ -424,6 +430,8 @@ s3:
# Suffix of the host name, {bucket}.{domainName}
domainName: ""
+ initContainers: ""
+
extraVolumes: ""
extraVolumeMounts: ""