Enable multiple disks per volume server. Also streamline the use of /logs & /idx (#5236)
* Enable multiple disks per volume server. Also streamline the use of /logs and /idx * missing file * add loop around volume mounts for initContainers * remove uneeded name for idx
This commit is contained in:
@@ -142,7 +142,7 @@ Inject extra environment vars in the format key:value, if populated
|
|||||||
|
|
||||||
{{/* 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.idx )) (not (empty .Values.volume.initContainers )) -}}
|
||||||
{{- printf "true" -}}
|
{{- printf "true" -}}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{- printf "" -}}
|
{{- printf "" -}}
|
||||||
|
|||||||
@@ -54,17 +54,19 @@ spec:
|
|||||||
{{- $initContainers_exists := include "volume.initContainers_exists" . -}}
|
{{- $initContainers_exists := include "volume.initContainers_exists" . -}}
|
||||||
{{- if $initContainers_exists }}
|
{{- if $initContainers_exists }}
|
||||||
initContainers:
|
initContainers:
|
||||||
{{- if .Values.volume.dir_idx }}
|
{{- if .Values.volume.idx }}
|
||||||
- name: seaweedfs-vol-move-idx
|
- name: seaweedfs-vol-move-idx
|
||||||
image: {{ template "volume.image" . }}
|
image: {{ template "volume.image" . }}
|
||||||
imagePullPolicy: {{ .Values.global.imagePullPolicy | 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: [ 'ls {{range $dir := .Values.volume.dataDirs }}/{{$dir.name}}/*.idx {{end}} && xargs -I {} mv {} /idx/' ]
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: idx
|
- name: idx
|
||||||
mountPath: {{ .Values.volume.dir_idx }}
|
mountPath: {{ .Values.volume.idx.name }}
|
||||||
- name: data
|
{{- range $dir := .Values.volume.dataDirs }}
|
||||||
mountPath: {{ .Values.volume.dir }}
|
- name: {{ $dir.name }}
|
||||||
|
mountPath: /{{ $dir.name }}
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.volume.initContainers }}
|
{{- if .Values.volume.initContainers }}
|
||||||
{{ tpl .Values.volume.initContainers . | nindent 8 | trim }}
|
{{ tpl .Values.volume.initContainers . | nindent 8 | trim }}
|
||||||
@@ -100,7 +102,7 @@ spec:
|
|||||||
- "-ec"
|
- "-ec"
|
||||||
- |
|
- |
|
||||||
exec /usr/bin/weed \
|
exec /usr/bin/weed \
|
||||||
{{- if eq .Values.volume.logs.type "hostPath" }}
|
{{- if .Values.volume.logs }}
|
||||||
-logdir=/logs \
|
-logdir=/logs \
|
||||||
{{- else }}
|
{{- else }}
|
||||||
-logtostderr=true \
|
-logtostderr=true \
|
||||||
@@ -115,11 +117,11 @@ spec:
|
|||||||
{{- if .Values.volume.metricsPort }}
|
{{- if .Values.volume.metricsPort }}
|
||||||
-metricsPort={{ .Values.volume.metricsPort }} \
|
-metricsPort={{ .Values.volume.metricsPort }} \
|
||||||
{{- end }}
|
{{- end }}
|
||||||
-dir={{ .Values.volume.dir }} \
|
-dir {{range $index, $dir := .Values.volume.dataDirs }}{{if ne $index 0}},{{end}}/{{$dir.name}}{{end}} \
|
||||||
{{- if .Values.volume.dir_idx }}
|
{{- if .Values.volume.idx }}
|
||||||
-dir.idx={{ .Values.volume.dir_idx }} \
|
-dir.idx= /idx \
|
||||||
{{- end }}
|
{{- end }}
|
||||||
-max={{ .Values.volume.maxVolumes }} \
|
-max {{range $index, $dir := .Values.volume.dataDirs }}{{if ne $index 0}},{{end}}{{$dir.maxVolumes}}{{end}} \
|
||||||
{{- if .Values.volume.rack }}
|
{{- if .Values.volume.rack }}
|
||||||
-rack={{ .Values.volume.rack }} \
|
-rack={{ .Values.volume.rack }} \
|
||||||
{{- end }}
|
{{- end }}
|
||||||
@@ -148,16 +150,18 @@ spec:
|
|||||||
-compactionMBps={{ .Values.volume.compactionMBps }} \
|
-compactionMBps={{ .Values.volume.compactionMBps }} \
|
||||||
-mserver={{ range $index := until (.Values.master.replicas | int) }}${SEAWEEDFS_FULLNAME}-master-{{ $index }}.${SEAWEEDFS_FULLNAME}-master.{{ $.Release.Namespace }}:{{ $.Values.master.port }}{{ if lt $index (sub ($.Values.master.replicas | int) 1) }},{{ end }}{{ end }}
|
-mserver={{ range $index := until (.Values.master.replicas | int) }}${SEAWEEDFS_FULLNAME}-master-{{ $index }}.${SEAWEEDFS_FULLNAME}-master.{{ $.Release.Namespace }}:{{ $.Values.master.port }}{{ if lt $index (sub ($.Values.master.replicas | int) 1) }},{{ end }}{{ end }}
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: data
|
{{- range $dir := .Values.volume.dataDirs }}
|
||||||
mountPath: "{{ .Values.volume.dir }}/"
|
- name: {{ $dir.name }}
|
||||||
{{- if .Values.volume.dir_idx }}
|
mountPath: "/{{ $dir.name }}/"
|
||||||
- name: idx
|
|
||||||
mountPath: "{{ .Values.volume.dir_idx }}/"
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .Values.volume.logs.type "hostPath" }}
|
{{- if .Values.volume.logs }}
|
||||||
- name: logs
|
- name: logs
|
||||||
mountPath: "/logs/"
|
mountPath: "/logs/"
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- if .Values.volume.idx }}
|
||||||
|
- name: idx
|
||||||
|
mountPath: "/idx/"
|
||||||
|
{{- end }}
|
||||||
{{- if .Values.global.enableSecurity }}
|
{{- if .Values.global.enableSecurity }}
|
||||||
- name: security-config
|
- name: security-config
|
||||||
readOnly: true
|
readOnly: true
|
||||||
@@ -221,18 +225,25 @@ spec:
|
|||||||
{{- include "common.tplvalues.render" (dict "value" .Values.volume.sidecars "context" $) | nindent 8 }}
|
{{- include "common.tplvalues.render" (dict "value" .Values.volume.sidecars "context" $) | nindent 8 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
volumes:
|
volumes:
|
||||||
{{- if eq .Values.volume.data.type "hostPath" }}
|
|
||||||
- name: data
|
{{- range $dir := .Values.volume.dataDirs }}
|
||||||
|
|
||||||
|
{{- if eq $dir.type "hostPath" }}
|
||||||
|
- name: {{ $dir.name }}
|
||||||
hostPath:
|
hostPath:
|
||||||
path: {{ .Values.volume.data.hostPathPrefix }}/object_store/
|
path: {{ $dir.hostPathPrefix }}/object_store/
|
||||||
type: DirectoryOrCreate
|
type: DirectoryOrCreate
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .Values.volume.data.type "existingClaim" }}
|
{{- if eq $dir.type "existingClaim" }}
|
||||||
- name: data
|
- name: {{ $dir.name }}
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: {{ .Values.volume.data.claimName }}
|
claimName: {{ $dir.claimName }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if and (eq .Values.volume.idx.type "hostPath") .Values.volume.dir_idx }}
|
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if .Values.volume.idx }}
|
||||||
|
{{- if eq .Values.volume.idx.type "hostPath" }}
|
||||||
- name: idx
|
- name: idx
|
||||||
hostPath:
|
hostPath:
|
||||||
path: {{ .Values.volume.idx.hostPathPrefix }}/seaweedfs-volume-idx/
|
path: {{ .Values.volume.idx.hostPathPrefix }}/seaweedfs-volume-idx/
|
||||||
@@ -243,6 +254,9 @@ spec:
|
|||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: {{ .Values.volume.idx.claimName }}
|
claimName: {{ .Values.volume.idx.claimName }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if .Values.volume.logs }}
|
||||||
{{- if eq .Values.volume.logs.type "hostPath" }}
|
{{- if eq .Values.volume.logs.type "hostPath" }}
|
||||||
- name: logs
|
- name: logs
|
||||||
hostPath:
|
hostPath:
|
||||||
@@ -252,7 +266,8 @@ spec:
|
|||||||
{{- if eq .Values.volume.logs.type "existingClaim" }}
|
{{- if eq .Values.volume.logs.type "existingClaim" }}
|
||||||
- name: logs
|
- name: logs
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: {{ .Values.volume.data.claimName }}
|
claimName: {{ .Values.volume.logs.claimName }}
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.global.enableSecurity }}
|
{{- if .Values.global.enableSecurity }}
|
||||||
- name: security-config
|
- name: security-config
|
||||||
@@ -281,24 +296,25 @@ spec:
|
|||||||
nodeSelector:
|
nodeSelector:
|
||||||
{{ tpl .Values.volume.nodeSelector . | indent 8 | trim }}
|
{{ tpl .Values.volume.nodeSelector . | indent 8 | trim }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $pvc_exists := include "volume.pvc_exists" . -}}
|
|
||||||
{{- if $pvc_exists }}
|
|
||||||
volumeClaimTemplates:
|
volumeClaimTemplates:
|
||||||
{{- if eq .Values.volume.data.type "persistentVolumeClaim"}}
|
{{- range $dir := .Values.volume.dataDirs }}
|
||||||
|
{{- if eq $dir.type "persistentVolumeClaim" }}
|
||||||
- metadata:
|
- metadata:
|
||||||
name: data
|
name: {{ $dir.name }}
|
||||||
{{- with .Values.volume.data.annotations }}
|
{{- with $dir.annotations }}
|
||||||
annotations:
|
annotations:
|
||||||
{{- toYaml . | nindent 10 }}
|
{{- toYaml . | nindent 10 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
accessModes: [ "ReadWriteOnce" ]
|
accessModes: [ "ReadWriteOnce" ]
|
||||||
storageClassName: {{ .Values.volume.data.storageClass }}
|
storageClassName: {{ $dir.storageClass }}
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
storage: {{ .Values.volume.data.size }}
|
storage: {{ $dir.size }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if and (eq .Values.volume.idx.type "persistentVolumeClaim") .Values.volume.dir_idx }}
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if and .Values.volume.idx (eq .Values.volume.idx.type "persistentVolumeClaim") }}
|
||||||
- metadata:
|
- metadata:
|
||||||
name: idx
|
name: idx
|
||||||
{{- with .Values.volume.idx.annotations }}
|
{{- with .Values.volume.idx.annotations }}
|
||||||
@@ -312,7 +328,7 @@ spec:
|
|||||||
requests:
|
requests:
|
||||||
storage: {{ .Values.volume.idx.size }}
|
storage: {{ .Values.volume.idx.size }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .Values.volume.logs.type "persistentVolumeClaim" }}
|
{{- if and .Values.volume.logs (eq .Values.volume.logs.type "persistentVolumeClaim") }}
|
||||||
- metadata:
|
- metadata:
|
||||||
name: logs
|
name: logs
|
||||||
{{- with .Values.volume.logs.annotations }}
|
{{- with .Values.volume.logs.annotations }}
|
||||||
@@ -327,4 +343,3 @@ spec:
|
|||||||
storage: {{ .Values.volume.logs.size }}
|
storage: {{ .Values.volume.logs.size }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
|
||||||
|
|||||||
@@ -89,7 +89,6 @@ master:
|
|||||||
# claimName: "my-pvc"
|
# claimName: "my-pvc"
|
||||||
data:
|
data:
|
||||||
type: "hostPath"
|
type: "hostPath"
|
||||||
size: ""
|
|
||||||
storageClass: ""
|
storageClass: ""
|
||||||
hostPathPrefix: /ssd
|
hostPathPrefix: /ssd
|
||||||
|
|
||||||
@@ -239,25 +238,36 @@ 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
|
||||||
|
|
||||||
# You may use ANY storage-class, example with local-path-provisioner
|
# For each data disk you may use ANY storage-class, example with local-path-provisioner
|
||||||
# Annotations are optional.
|
# Annotations are optional.
|
||||||
# data:
|
# dataDirs:
|
||||||
|
# - name: data:
|
||||||
# type: "persistentVolumeClaim"
|
# type: "persistentVolumeClaim"
|
||||||
# size: "24Ti"
|
# size: "24Ti"
|
||||||
# storageClass: "local-path-provisioner"
|
# storageClass: "local-path-provisioner"
|
||||||
# annotations:
|
# annotations:
|
||||||
# "key": "value"
|
# "key": "value"
|
||||||
|
# maxVolumes: 0
|
||||||
#
|
#
|
||||||
# You may also spacify an existing claim:
|
# You may also spacify an existing claim:
|
||||||
# data:
|
# - name: data
|
||||||
# type: "existingClaim"
|
# type: "existingClaim"
|
||||||
# claimName: "my-pvc"
|
# claimName: "my-pvc"
|
||||||
|
# maxVolumes: 0
|
||||||
|
|
||||||
data:
|
|
||||||
|
dataDirs:
|
||||||
|
- name: data1
|
||||||
type: "hostPath"
|
type: "hostPath"
|
||||||
size: ""
|
hostPathPrefix: /ssd
|
||||||
storageClass: ""
|
maxVolumes: 0 # If set to zero on non-windows OS, the limit will be auto configured. (default "7")
|
||||||
hostPathPrefix: /storage
|
|
||||||
|
#- name: data2
|
||||||
|
# type: "persistentVolumeClaim"
|
||||||
|
# storageClass: "yourClassNameOfChoice"
|
||||||
|
# size: "800Gi"
|
||||||
|
# maxVolumes: 0
|
||||||
|
|
||||||
|
|
||||||
idx:
|
idx:
|
||||||
type: "hostPath"
|
type: "hostPath"
|
||||||
@@ -265,6 +275,7 @@ volume:
|
|||||||
storageClass: ""
|
storageClass: ""
|
||||||
hostPathPrefix: /ssd
|
hostPathPrefix: /ssd
|
||||||
|
|
||||||
|
|
||||||
logs:
|
logs:
|
||||||
type: "hostPath"
|
type: "hostPath"
|
||||||
size: ""
|
size: ""
|
||||||
@@ -274,14 +285,6 @@ volume:
|
|||||||
# limit background compaction or copying speed in mega bytes per second
|
# limit background compaction or copying speed in mega bytes per second
|
||||||
compactionMBps: "50"
|
compactionMBps: "50"
|
||||||
|
|
||||||
# Directories to store data files. dir[,dir]... (default "/tmp")
|
|
||||||
dir: "/data"
|
|
||||||
# Directories to store index files. dir[,dir]... (default is the same as "dir")
|
|
||||||
dir_idx: null
|
|
||||||
|
|
||||||
# Maximum numbers of volumes, count[,count]...
|
|
||||||
# If set to zero on non-windows OS, the limit will be auto configured. (default "7")
|
|
||||||
maxVolumes: "0"
|
|
||||||
|
|
||||||
# Volume server's rack name
|
# Volume server's rack name
|
||||||
rack: null
|
rack: null
|
||||||
|
|||||||
Reference in New Issue
Block a user