Browse Source

Always include volumes in statefulsets

pull/5083/head
Bálint József Jánvári 1 year ago
committed by Chris Lu
parent
commit
43a6b60375
  1. 44
      k8s/charts/seaweedfs/templates/_helpers.tpl
  2. 4
      k8s/charts/seaweedfs/templates/master-statefulset.yaml
  3. 3
      k8s/charts/seaweedfs/templates/volume-statefulset.yaml

44
k8s/charts/seaweedfs/templates/_helpers.tpl

@ -122,19 +122,6 @@ Inject extra environment vars in the format key:value, if populated
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{/* check if any Volume HostPath exists */}}
{{- define "volume.hostpath_exists" -}}
{{- if or (or (eq .Values.volume.data.type "hostPath") (and (eq .Values.volume.idx.type "hostPath") .Values.volume.dir_idx )) (eq .Values.volume.logs.type "hostPath") -}}
{{- printf "true" -}}
{{- else -}}
{{- if or .Values.global.enableSecurity .Values.volume.extraVolumes -}}
{{- printf "true" -}}
{{- else -}}
{{- printf "" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/* check if any Filer PVC exists */}} {{/* check if any Filer PVC exists */}}
{{- define "filer.pvc_exists" -}} {{- define "filer.pvc_exists" -}}
{{- if or (eq .Values.filer.data.type "persistentVolumeClaim") (eq .Values.filer.logs.type "persistentVolumeClaim") -}} {{- if or (eq .Values.filer.data.type "persistentVolumeClaim") (eq .Values.filer.logs.type "persistentVolumeClaim") -}}
@ -144,15 +131,6 @@ Inject extra environment vars in the format key:value, if populated
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{/* check if any Filer HostPath exists */}}
{{- define "filer.hostpath_exists" -}}
{{- if or (eq .Values.filer.data.type "hostPath") (eq .Values.filer.logs.type "hostPath") -}}
{{- printf "true" -}}
{{- else -}}
{{- printf "" -}}
{{- end -}}
{{- end -}}
{{/* check if any Master PVC exists */}} {{/* check if any Master PVC exists */}}
{{- define "master.pvc_exists" -}} {{- define "master.pvc_exists" -}}
{{- if or (eq .Values.master.data.type "persistentVolumeClaim") (eq .Values.master.logs.type "persistentVolumeClaim") -}} {{- if or (eq .Values.master.data.type "persistentVolumeClaim") (eq .Values.master.logs.type "persistentVolumeClaim") -}}
@ -162,28 +140,6 @@ Inject extra environment vars in the format key:value, if populated
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{/* check if any Master HostPath exists */}}
{{- define "master.hostpath_exists" -}}
{{- if or (eq .Values.master.data.type "hostPath") (eq .Values.master.logs.type "hostPath") -}}
{{- printf "true" -}}
{{- else -}}
{{- if or .Values.global.enableSecurity .Values.volume.extraVolumes -}}
{{- printf "true" -}}
{{- else -}}
{{- printf "" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/* check if any Master existingClaim is defined */}}
{{- define "master.existing_claims" -}}
{{- if or (eq .Values.master.data.type "existingClaim") (eq .Values.master.logs.type "existingClaim") -}}
{{- printf "true" -}}
{{- else -}}
{{- printf "" -}}
{{- end -}}
{{- end -}}
{{/* check if any InitContainers exist for Volumes */}} {{/* check if any InitContainers exist for Volumes */}}
{{- define "volume.initContainers_exists" -}} {{- define "volume.initContainers_exists" -}}
{{- if or (not (empty .Values.volume.dir_idx )) (not (empty .Values.volume.initContainers )) -}} {{- if or (not (empty .Values.volume.dir_idx )) (not (empty .Values.volume.initContainers )) -}}

4
k8s/charts/seaweedfs/templates/master-statefulset.yaml

@ -212,9 +212,6 @@ spec:
resources: resources:
{{ tpl .Values.master.resources . | nindent 12 | trim }} {{ tpl .Values.master.resources . | nindent 12 | trim }}
{{- end }} {{- end }}
{{- $hostpath_exists := include "master.hostpath_exists" . -}}
{{- $existing_claims := include "master.existing_claims" . -}}
{{- if or ($hostpath_exists) ($existing_claims) }}
volumes: volumes:
{{- if eq .Values.master.logs.type "hostPath" }} {{- if eq .Values.master.logs.type "hostPath" }}
- name: seaweedfs-master-log-volume - name: seaweedfs-master-log-volume
@ -262,7 +259,6 @@ spec:
secretName: {{ template "seaweedfs.name" . }}-client-cert secretName: {{ template "seaweedfs.name" . }}-client-cert
{{- end }} {{- end }}
{{ tpl .Values.master.extraVolumes . | indent 8 | trim }} {{ tpl .Values.master.extraVolumes . | indent 8 | trim }}
{{- end }}
{{- if .Values.master.nodeSelector }} {{- if .Values.master.nodeSelector }}
nodeSelector: nodeSelector:
{{ tpl .Values.master.nodeSelector . | indent 8 | trim }} {{ tpl .Values.master.nodeSelector . | indent 8 | trim }}

3
k8s/charts/seaweedfs/templates/volume-statefulset.yaml

@ -218,8 +218,6 @@ spec:
resources: resources:
{{ tpl .Values.volume.resources . | nindent 12 | trim }} {{ tpl .Values.volume.resources . | nindent 12 | trim }}
{{- end }} {{- end }}
{{- $hostpath_exists := include "volume.hostpath_exists" . -}}
{{- if $hostpath_exists }}
volumes: volumes:
{{- if eq .Values.volume.data.type "hostPath" }} {{- if eq .Values.volume.data.type "hostPath" }}
- name: data - name: data
@ -277,7 +275,6 @@ spec:
{{- if .Values.volume.extraVolumes }} {{- if .Values.volume.extraVolumes }}
{{ tpl .Values.volume.extraVolumes . | indent 8 | trim }} {{ tpl .Values.volume.extraVolumes . | indent 8 | trim }}
{{- end }} {{- end }}
{{- end }}
{{- if .Values.volume.nodeSelector }} {{- if .Values.volume.nodeSelector }}
nodeSelector: nodeSelector:
{{ tpl .Values.volume.nodeSelector . | indent 8 | trim }} {{ tpl .Values.volume.nodeSelector . | indent 8 | trim }}

Loading…
Cancel
Save