Merge pull request #3367 from kaiwalyajoshi/kjoshi/v3.18-hostpath-fixes

This commit is contained in:
Chris Lu
2022-07-26 08:08:08 -07:00
committed by GitHub
4 changed files with 143 additions and 27 deletions

View File

@@ -113,7 +113,7 @@ Inject extra environment vars in the format key:value, if populated
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{/* check if any PVC exists */}} {{/* check if any Volume PVC exists */}}
{{- define "volume.pvc_exists" -}} {{- define "volume.pvc_exists" -}}
{{- if or (or (eq .Values.volume.data.type "persistentVolumeClaim") (and (eq .Values.volume.idx.type "persistentVolumeClaim") .Values.volume.dir_idx )) (eq .Values.volume.logs.type "persistentVolumeClaim") -}} {{- if or (or (eq .Values.volume.data.type "persistentVolumeClaim") (and (eq .Values.volume.idx.type "persistentVolumeClaim") .Values.volume.dir_idx )) (eq .Values.volume.logs.type "persistentVolumeClaim") -}}
{{- printf "true" -}} {{- printf "true" -}}
@@ -122,7 +122,7 @@ Inject extra environment vars in the format key:value, if populated
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{/* check if any HostPath exists */}} {{/* check if any Volume HostPath exists */}}
{{- define "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") -}} {{- 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" -}} {{- printf "true" -}}
@@ -134,3 +134,43 @@ Inject extra environment vars in the format key:value, if populated
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{/* check if any Filer PVC exists */}}
{{- define "filer.pvc_exists" -}}
{{- if or (eq .Values.filer.data.type "persistentVolumeClaim") (eq .Values.filer.logs.type "persistentVolumeClaim") -}}
{{- printf "true" -}}
{{- else -}}
{{- printf "false" -}}
{{- 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 "false" -}}
{{- end -}}
{{- end -}}
{{/* check if any Master PVC exists */}}
{{- define "master.pvc_exists" -}}
{{- if or (eq .Values.master.data.type "persistentVolumeClaim") (eq .Values.master.logs.type "persistentVolumeClaim") -}}
{{- printf "true" -}}
{{- else -}}
{{- printf "false" -}}
{{- 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 "false" -}}
{{- end -}}
{{- end -}}
{{- end -}}

View File

@@ -216,10 +216,18 @@ spec:
{{ tpl .Values.filer.resources . | nindent 12 | trim }} {{ tpl .Values.filer.resources . | nindent 12 | trim }}
{{- end }} {{- end }}
volumes: volumes:
{{- if eq .Values.filer.logs.type "hostPath" }}
- name: seaweedfs-filer-log-volume - name: seaweedfs-filer-log-volume
hostPath: hostPath:
path: /storage/logs/seaweedfs/filer path: /storage/logs/seaweedfs/filer
type: DirectoryOrCreate type: DirectoryOrCreate
{{- end }}
{{- if eq .Values.filer.data.type "hostPath" }}
- name: data-filer
hostPath:
path: /storage/filer_store
type: DirectoryOrCreate
{{- end }}
- name: db-schema-config-volume - name: db-schema-config-volume
configMap: configMap:
name: seaweedfs-db-init-config name: seaweedfs-db-init-config
@@ -253,6 +261,7 @@ spec:
{{ tpl .Values.filer.nodeSelector . | indent 8 | trim }} {{ tpl .Values.filer.nodeSelector . | indent 8 | trim }}
{{- end }} {{- end }}
{{- if .Values.filer.enablePVC }} {{- if .Values.filer.enablePVC }}
# DEPRECATION: Deprecate in favor of filer.data section below
volumeClaimTemplates: volumeClaimTemplates:
- metadata: - metadata:
name: data-filer name: data-filer
@@ -266,4 +275,28 @@ spec:
storageClassName: {{ .Values.filer.storageClass }} storageClassName: {{ .Values.filer.storageClass }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- $pvc_exists := include "filer.pvc_exists" . -}}
{{- if $pvc_exists }}
volumeClaimTemplates:
{{- if eq .Values.filer.data.type "persistentVolumeClaim"}}
- metadata:
name: data-filer
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: {{ .Values.filer.data.storageClass }}
resources:
requests:
storage: {{ .Values.filer.data.size }}
{{- end }}
{{- if eq .Values.filer.logs.type "persistentVolumeClaim"}}
- metadata:
name: seaweedfs-filer-log-volume
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: {{ .Values.filer.logs.storageClass }}
resources:
requests:
storage: {{ .Values.filer.logs.size }}
{{- end }}
{{- end }}
{{- end }} {{- end }}

View File

@@ -178,15 +178,21 @@ 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" . -}}
{{- if $hostpath_exists }}
volumes: volumes:
{{- if eq .Values.master.logs.type "hostPath" }}
- name: seaweedfs-master-log-volume - name: seaweedfs-master-log-volume
hostPath: hostPath:
path: /storage/logs/seaweedfs/master path: /storage/logs/seaweedfs/master
type: DirectoryOrCreate type: DirectoryOrCreate
{{- end }}
{{- if eq .Values.master.data.type "hostPath" }}
- name: data-{{ .Release.Namespace }} - name: data-{{ .Release.Namespace }}
hostPath: hostPath:
path: /ssd/seaweed-master/ path: /ssd/seaweed-master/
type: DirectoryOrCreate type: DirectoryOrCreate
{{- end }}
{{- if .Values.global.enableSecurity }} {{- if .Values.global.enableSecurity }}
- name: security-config - name: security-config
configMap: configMap:
@@ -208,20 +214,33 @@ 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 }}
{{- end }} {{- end }}
{{/* volumeClaimTemplates:*/}} {{- $pvc_exists := include "volume.pvc_exists" . -}}
{{/* - metadata:*/}} {{- if $pvc_exists }}
{{/* name: data-{{ .Release.Namespace }}*/}} volumeClaimTemplates:
{{/* spec:*/}} {{- if eq .Values.master.data.type "persistentVolumeClaim"}}
{{/* accessModes:*/}} - metadata:
{{/* - ReadWriteOnce*/}} name: data-{{ .Release.Namespace }}
{{/* resources:*/}} spec:
{{/* requests:*/}} accessModes: [ "ReadWriteOnce" ]
{{/* storage: {{ .Values.master.storage }}*/}} storageClassName: {{ .Values.master.data.storageClass }}
{{/* {{- if .Values.master.storageClass }}*/}} resources:
{{/* storageClassName: {{ .Values.master.storageClass }}*/}} requests:
{{/* {{- end }}*/}} storage: {{ .Values.master.data.size }}
{{- end }}
{{- if eq .Values.master.logs.type "persistentVolumeClaim"}}
- metadata:
name: seaweedfs-master-log-volume
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: {{ .Values.master.logs.storageClass }}
resources:
requests:
storage: {{ .Values.master.logs.size }}
{{- end }}
{{- end }}
{{- end }} {{- end }}

View File

@@ -58,16 +58,24 @@ master:
# Disable http request, only gRpc operations are allowed # Disable http request, only gRpc operations are allowed
disableHttp: false disableHttp: false
# can use ANY storage-class , example with local-path-provisioner
# data:
# type: "persistentVolumeClaim"
# size: "24Ti"
# storageClass: "local-path-provisioner"
data:
type: "hostPath"
size: ""
storageClass: ""
logs:
type: "hostPath"
size: ""
storageClass: ""
extraVolumes: "" extraVolumes: ""
extraVolumeMounts: "" extraVolumeMounts: ""
# storage and storageClass are the settings for configuring stateful
# storage for the master pods. storage should be set to the disk size of
# the attached volume. storageClass is the class of storage which defaults
# to null (the Kube cluster will pick the default).
storage: 25Gi
storageClass: null
# Resource requests, limits, etc. for the master cluster placement. This # Resource requests, limits, etc. for the master cluster placement. This
# should map directly to the value of the resources field for a PodSpec, # should map directly to the value of the resources field for a PodSpec,
# formatted as a multi-line string. By default no direct resource request # formatted as a multi-line string. By default no direct resource request
@@ -156,7 +164,7 @@ volume:
# minimum free disk space(in percents). If free disk space lower this value - all volumes marks as ReadOnly # minimum free disk space(in percents). If free disk space lower this value - all volumes marks as ReadOnly
minFreeSpacePercent: 7 minFreeSpacePercent: 7
# can use ANY storage-class , example with local-path-provisner # can use ANY storage-class , example with local-path-provisioner
# data: # data:
# type: "persistentVolumeClaim" # type: "persistentVolumeClaim"
# size: "24Ti" # size: "24Ti"
@@ -275,16 +283,32 @@ filer:
# Disable http request, only gRpc operations are allowed # Disable http request, only gRpc operations are allowed
disableHttp: false disableHttp: false
# DEPRECATE: enablePVC, storage, storageClass
# Consider replacing with filer.data section below instead.
# Settings for configuring stateful storage of filer pods.
# enablePVC will create a pvc for filer for data persistence. # enablePVC will create a pvc for filer for data persistence.
enablePVC: false enablePVC: false
# storage should be set to the disk size of the attached volume.
# storage and storageClass are the settings for configuring stateful
# storage for the master pods. storage should be set to the disk size of
# the attached volume. storageClass is the class of storage which defaults
# to null (the Kube cluster will pick the default).
storage: 25Gi storage: 25Gi
# storageClass is the class of storage which defaults to null (the Kube cluster will pick the default).
storageClass: null storageClass: null
# can use ANY storage-class , example with local-path-provisioner
# data:
# type: "persistentVolumeClaim"
# size: "24Ti"
# storageClass: "local-path-provisioner"
data:
type: "hostPath"
size: ""
storageClass: ""
logs:
type: "hostPath"
size: ""
storageClass: ""
extraVolumes: "" extraVolumes: ""
extraVolumeMounts: "" extraVolumeMounts: ""