feat: Add support for initContainers

This commit is contained in:
Kaiwalya Joshi 2022-08-03 12:21:36 -07:00
parent 90db4b5a44
commit 6e9d39ac72
No known key found for this signature in database
GPG key ID: 32F1D7195C15408C
6 changed files with 42 additions and 7 deletions

View file

@ -174,3 +174,12 @@ Inject extra environment vars in the format key:value, if populated
{{- end -}} {{- end -}}
{{- end -}} {{- 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 -}}

View file

@ -52,6 +52,10 @@ spec:
priorityClassName: {{ .Values.filer.priorityClassName | quote }} priorityClassName: {{ .Values.filer.priorityClassName | quote }}
{{- end }} {{- end }}
enableServiceLinks: false enableServiceLinks: false
{{- if .Values.filer.initContainers }}
initContainers:
{{ tpl .Values.filer.initContainers . | nindent 8 | trim }}
{{- end }}
containers: containers:
- name: seaweedfs - name: seaweedfs
image: {{ template "filer.image" . }} image: {{ template "filer.image" . }}

View file

@ -51,6 +51,10 @@ spec:
priorityClassName: {{ .Values.master.priorityClassName | quote }} priorityClassName: {{ .Values.master.priorityClassName | quote }}
{{- end }} {{- end }}
enableServiceLinks: false enableServiceLinks: false
{{- if .Values.master.initContainers }}
initContainers:
{{ tpl .Values.master.initContainers . | nindent 8 | trim }}
{{- end }}
containers: containers:
- name: seaweedfs - name: seaweedfs
image: {{ template "master.image" . }} image: {{ template "master.image" . }}

View file

@ -39,6 +39,10 @@ spec:
priorityClassName: {{ .Values.s3.priorityClassName | quote }} priorityClassName: {{ .Values.s3.priorityClassName | quote }}
{{- end }} {{- end }}
enableServiceLinks: false enableServiceLinks: false
{{- if .Values.s3.initContainers }}
initContainers:
{{ tpl .Values.s3.initContainers . | nindent 8 | trim }}
{{- end }}
containers: containers:
- name: seaweedfs - name: seaweedfs
image: {{ template "s3.image" . }} image: {{ template "s3.image" . }}

View file

@ -45,11 +45,13 @@ spec:
priorityClassName: {{ .Values.volume.priorityClassName | quote }} priorityClassName: {{ .Values.volume.priorityClassName | quote }}
{{- end }} {{- end }}
enableServiceLinks: false enableServiceLinks: false
{{- if .Values.volume.dir_idx }} {{- $initContainers_exists := include "volume.initContainers_exists" . -}}
{{- if $initContainers_exists }}
initContainers: initContainers:
{{- if .Values.volume.dir_idx }}
- name: seaweedfs-vol-move-idx - name: seaweedfs-vol-move-idx
image: {{ template "volume.image" . }} image: {{ template "volume.image" . }}
imagePullPolicy: {{ .Values.global.pullPolicy | default "IfNotPresent" }} imagePullPolicy: {{ .Values.global.imagePullPolicy | default "IfNotPresent" }}
command: [ '/bin/sh', '-c' ] 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: volumeMounts:
@ -58,6 +60,10 @@ spec:
- name: data - name: data
mountPath: {{ .Values.volume.dir }} mountPath: {{ .Values.volume.dir }}
{{- end }} {{- end }}
{{- if .Values.volume.initContainers }}
{{ tpl .Values.volume.initContainers . | nindent 8 | trim }}
{{- end }}
{{- end }}
containers: containers:
- name: seaweedfs - name: seaweedfs
image: {{ template "volume.image" . }} image: {{ template "volume.image" . }}

View file

@ -73,6 +73,8 @@ master:
size: "" size: ""
storageClass: "" storageClass: ""
initContainers: ""
extraVolumes: "" extraVolumes: ""
extraVolumeMounts: "" extraVolumeMounts: ""
@ -210,6 +212,8 @@ volume:
# Adjust jpg orientation when uploading. # Adjust jpg orientation when uploading.
imagesFixOrientation: false imagesFixOrientation: false
initContainers: ""
extraVolumes: "" extraVolumes: ""
extraVolumeMounts: "" extraVolumeMounts: ""
@ -309,6 +313,8 @@ filer:
size: "" size: ""
storageClass: "" storageClass: ""
initContainers: ""
extraVolumes: "" extraVolumes: ""
extraVolumeMounts: "" extraVolumeMounts: ""
@ -424,6 +430,8 @@ s3:
# Suffix of the host name, {bucket}.{domainName} # Suffix of the host name, {bucket}.{domainName}
domainName: "" domainName: ""
initContainers: ""
extraVolumes: "" extraVolumes: ""
extraVolumeMounts: "" extraVolumeMounts: ""