aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaiwalya Joshi <kjoshi@d2iq.com>2022-07-26 03:27:41 -0700
committerKaiwalya Joshi <kjoshi@d2iq.com>2022-07-26 03:27:41 -0700
commit1f99bb4e4e86473528ea602810b9541926abf1fa (patch)
tree027ba671112f8d829b4f95d412708dd2c675a3f8
parent53e3536975694cc13ae3636afbbfb280cbad712a (diff)
downloadseaweedfs-1f99bb4e4e86473528ea602810b9541926abf1fa.tar.xz
seaweedfs-1f99bb4e4e86473528ea602810b9541926abf1fa.zip
feat: Add PVC Storage option for Master data and logs.
-rw-r--r--k8s/helm_charts2/templates/_helpers.tpl22
-rw-r--r--k8s/helm_charts2/templates/master-statefulset.yaml43
-rw-r--r--k8s/helm_charts2/values.yaml15
3 files changed, 68 insertions, 12 deletions
diff --git a/k8s/helm_charts2/templates/_helpers.tpl b/k8s/helm_charts2/templates/_helpers.tpl
index 57b6b7a75..b679fe520 100644
--- a/k8s/helm_charts2/templates/_helpers.tpl
+++ b/k8s/helm_charts2/templates/_helpers.tpl
@@ -151,4 +151,26 @@ Inject extra environment vars in the format key:value, if populated
{{- 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 -}} \ No newline at end of file
diff --git a/k8s/helm_charts2/templates/master-statefulset.yaml b/k8s/helm_charts2/templates/master-statefulset.yaml
index e5a7a537a..8af1bf91d 100644
--- a/k8s/helm_charts2/templates/master-statefulset.yaml
+++ b/k8s/helm_charts2/templates/master-statefulset.yaml
@@ -178,15 +178,21 @@ spec:
resources:
{{ tpl .Values.master.resources . | nindent 12 | trim }}
{{- end }}
+ {{- $hostpath_exists := include "master.hostpath_exists" . -}}
+ {{- if $hostpath_exists }}
volumes:
+ {{- if eq .Values.master.logs.type "hostPath" }}
- name: seaweedfs-master-log-volume
hostPath:
path: /storage/logs/seaweedfs/master
type: DirectoryOrCreate
+ {{- end }}
+ {{- if eq .Values.master.data.type "hostPath" }}
- name: data-{{ .Release.Namespace }}
hostPath:
path: /ssd/seaweed-master/
type: DirectoryOrCreate
+ {{- end }}
{{- if .Values.global.enableSecurity }}
- name: security-config
configMap:
@@ -208,20 +214,33 @@ spec:
secretName: {{ template "seaweedfs.name" . }}-client-cert
{{- end }}
{{ tpl .Values.master.extraVolumes . | indent 8 | trim }}
+ {{- end }}
{{- if .Values.master.nodeSelector }}
nodeSelector:
{{ tpl .Values.master.nodeSelector . | indent 8 | trim }}
{{- end }}
-{{/* volumeClaimTemplates:*/}}
-{{/* - metadata:*/}}
-{{/* name: data-{{ .Release.Namespace }}*/}}
-{{/* spec:*/}}
-{{/* accessModes:*/}}
-{{/* - ReadWriteOnce*/}}
-{{/* resources:*/}}
-{{/* requests:*/}}
-{{/* storage: {{ .Values.master.storage }}*/}}
-{{/* {{- if .Values.master.storageClass }}*/}}
-{{/* storageClassName: {{ .Values.master.storageClass }}*/}}
-{{/* {{- end }}*/}}
+ {{- $pvc_exists := include "volume.pvc_exists" . -}}
+ {{- if $pvc_exists }}
+ volumeClaimTemplates:
+ {{- if eq .Values.master.data.type "persistentVolumeClaim"}}
+ - metadata:
+ name: data-{{ .Release.Namespace }}
+ spec:
+ accessModes: [ "ReadWriteOnce" ]
+ storageClassName: {{ .Values.master.data.storageClass }}
+ resources:
+ requests:
+ 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 }}
diff --git a/k8s/helm_charts2/values.yaml b/k8s/helm_charts2/values.yaml
index cd55cd8b6..560925b56 100644
--- a/k8s/helm_charts2/values.yaml
+++ b/k8s/helm_charts2/values.yaml
@@ -58,6 +58,21 @@ master:
# Disable http request, only gRpc operations are allowed
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: ""
extraVolumeMounts: ""