1
0
Fork 0
mirror of https://github.com/chrislusf/seaweedfs synced 2024-05-19 18:01:03 +02:00

feat: Add PVC Storage option for Master data and logs.

This commit is contained in:
Kaiwalya Joshi 2022-07-26 03:27:41 -07:00
parent 53e3536975
commit 1f99bb4e4e
No known key found for this signature in database
GPG key ID: 32F1D7195C15408C
3 changed files with 68 additions and 12 deletions

View file

@ -151,4 +151,26 @@ Inject extra environment vars in the format key:value, if populated
{{- else -}} {{- else -}}
{{- printf "false" -}} {{- printf "false" -}}
{{- end -}} {{- 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 -}} {{- 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,6 +58,21 @@ 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: ""