2020-03-03 07:56:39 +00:00
|
|
|
{{- if .Values.volume.enabled }}
|
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: StatefulSet
|
|
|
|
metadata:
|
|
|
|
name: {{ template "seaweedfs.name" . }}-volume
|
|
|
|
namespace: {{ .Release.Namespace }}
|
|
|
|
labels:
|
|
|
|
app: {{ template "seaweedfs.name" . }}
|
|
|
|
chart: {{ template "seaweedfs.chart" . }}
|
|
|
|
heritage: {{ .Release.Service }}
|
|
|
|
release: {{ .Release.Name }}
|
|
|
|
spec:
|
|
|
|
serviceName: {{ template "seaweedfs.name" . }}-volume
|
|
|
|
replicas: {{ .Values.volume.replicas }}
|
2020-09-10 06:19:49 +00:00
|
|
|
podManagementPolicy: Parallel
|
2020-03-03 07:56:39 +00:00
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
app: {{ template "seaweedfs.name" . }}
|
|
|
|
chart: {{ template "seaweedfs.chart" . }}
|
|
|
|
release: {{ .Release.Name }}
|
|
|
|
component: volume
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app: {{ template "seaweedfs.name" . }}
|
|
|
|
chart: {{ template "seaweedfs.chart" . }}
|
|
|
|
release: {{ .Release.Name }}
|
|
|
|
component: volume
|
|
|
|
spec:
|
|
|
|
{{- if .Values.volume.affinity }}
|
|
|
|
affinity:
|
|
|
|
{{ tpl .Values.volume.affinity . | nindent 8 | trim }}
|
|
|
|
{{- end }}
|
|
|
|
restartPolicy: {{ default .Values.global.restartPolicy .Values.volume.restartPolicy }}
|
|
|
|
{{- if .Values.volume.tolerations }}
|
|
|
|
tolerations:
|
2022-10-26 06:30:37 +00:00
|
|
|
{{ tpl .Values.volume.tolerations . | nindent 8 | trim }}
|
2020-03-03 07:56:39 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.global.imagePullSecrets }}
|
|
|
|
imagePullSecrets:
|
|
|
|
- name: {{ .Values.global.imagePullSecrets }}
|
|
|
|
{{- end }}
|
2022-02-08 08:07:28 +00:00
|
|
|
terminationGracePeriodSeconds: 150
|
2020-03-03 07:56:39 +00:00
|
|
|
{{- if .Values.volume.priorityClassName }}
|
|
|
|
priorityClassName: {{ .Values.volume.priorityClassName | quote }}
|
|
|
|
{{- end }}
|
|
|
|
enableServiceLinks: false
|
2022-08-03 19:21:36 +00:00
|
|
|
{{- $initContainers_exists := include "volume.initContainers_exists" . -}}
|
|
|
|
{{- if $initContainers_exists }}
|
2021-02-24 08:25:11 +00:00
|
|
|
initContainers:
|
2022-08-03 19:21:36 +00:00
|
|
|
{{- if .Values.volume.dir_idx }}
|
2021-02-24 08:25:11 +00:00
|
|
|
- name: seaweedfs-vol-move-idx
|
|
|
|
image: {{ template "volume.image" . }}
|
2022-08-03 19:21:36 +00:00
|
|
|
imagePullPolicy: {{ .Values.global.imagePullPolicy | default "IfNotPresent" }}
|
2021-02-24 08:25:11 +00:00
|
|
|
command: [ '/bin/sh', '-c' ]
|
2022-08-03 19:21:36 +00:00
|
|
|
args: [ 'if ls {{ .Values.volume.dir }}/*.idx >/dev/null 2>&1; then mv {{ .Values.volume.dir }}/*.idx {{ .Values.volume.dir_idx }}/; fi;' ]
|
2021-02-24 08:25:11 +00:00
|
|
|
volumeMounts:
|
2022-08-03 19:21:36 +00:00
|
|
|
- name: idx
|
|
|
|
mountPath: {{ .Values.volume.dir_idx }}
|
|
|
|
- name: data
|
|
|
|
mountPath: {{ .Values.volume.dir }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.volume.initContainers }}
|
|
|
|
{{ tpl .Values.volume.initContainers . | nindent 8 | trim }}
|
|
|
|
{{- end }}
|
2021-02-24 08:25:11 +00:00
|
|
|
{{- end }}
|
2020-03-03 07:56:39 +00:00
|
|
|
containers:
|
|
|
|
- name: seaweedfs
|
|
|
|
image: {{ template "volume.image" . }}
|
|
|
|
imagePullPolicy: {{ default "IfNotPresent" .Values.global.imagePullPolicy }}
|
|
|
|
env:
|
|
|
|
- name: POD_NAME
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: metadata.name
|
|
|
|
- name: NAMESPACE
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: metadata.namespace
|
|
|
|
- name: HOST_IP
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: status.hostIP
|
|
|
|
- name: SEAWEEDFS_FULLNAME
|
2020-09-10 06:19:49 +00:00
|
|
|
value: "{{ template "seaweedfs.name" . }}"
|
2021-01-13 20:15:47 +00:00
|
|
|
{{- if .Values.global.extraEnvironmentVars }}
|
|
|
|
{{- range $key, $value := .Values.global.extraEnvironmentVars }}
|
|
|
|
- name: {{ $key }}
|
|
|
|
value: {{ $value | quote }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
2020-03-03 07:56:39 +00:00
|
|
|
command:
|
|
|
|
- "/bin/sh"
|
|
|
|
- "-ec"
|
|
|
|
- |
|
|
|
|
exec /usr/bin/weed -logdir=/logs \
|
|
|
|
{{- if .Values.volume.loggingOverrideLevel }}
|
|
|
|
-v={{ .Values.volume.loggingOverrideLevel }} \
|
|
|
|
{{- else }}
|
|
|
|
-v={{ .Values.global.loggingLevel }} \
|
|
|
|
{{- end }}
|
|
|
|
volume \
|
|
|
|
-port={{ .Values.volume.port }} \
|
2020-10-15 13:10:22 +00:00
|
|
|
{{- if .Values.volume.metricsPort }}
|
2022-08-04 16:08:40 +00:00
|
|
|
-metricsPort={{ .Values.volume.metricsPort }} \
|
2020-11-08 00:07:16 +00:00
|
|
|
{{- end }}
|
2020-03-03 07:56:39 +00:00
|
|
|
-dir={{ .Values.volume.dir }} \
|
2021-01-13 20:16:39 +00:00
|
|
|
{{- if .Values.volume.dir_idx }}
|
|
|
|
-dir.idx={{ .Values.volume.dir_idx }} \
|
|
|
|
{{- end }}
|
2020-03-03 07:56:39 +00:00
|
|
|
-max={{ .Values.volume.maxVolumes }} \
|
|
|
|
{{- if .Values.volume.rack }}
|
|
|
|
-rack={{ .Values.volume.rack }} \
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.volume.dataCenter }}
|
|
|
|
-dataCenter={{ .Values.volume.dataCenter }} \
|
|
|
|
{{- end }}
|
|
|
|
-ip.bind={{ .Values.volume.ipBind }} \
|
2021-07-03 22:55:56 +00:00
|
|
|
-readMode={{ .Values.volume.readMode }} \
|
2020-03-03 07:56:39 +00:00
|
|
|
{{- if .Values.volume.whiteList }}
|
|
|
|
-whiteList={{ .Values.volume.whiteList }} \
|
|
|
|
{{- end }}
|
2020-07-10 02:08:36 +00:00
|
|
|
{{- if .Values.volume.imagesFixOrientation }}
|
|
|
|
-images.fix.orientation \
|
|
|
|
{{- end }}
|
2020-09-10 06:21:09 +00:00
|
|
|
{{- if .Values.volume.pulseSeconds }}
|
|
|
|
-pulseSeconds={{ .Values.volume.pulseSeconds }} \
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.volume.index }}
|
|
|
|
-index={{ .Values.volume.index }} \
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.volume.fileSizeLimitMB }}
|
|
|
|
-fileSizeLimitMB={{ .Values.volume.fileSizeLimitMB }} \
|
|
|
|
{{- end }}
|
|
|
|
-minFreeSpacePercent={{ .Values.volume.minFreeSpacePercent }} \
|
2020-03-03 07:56:39 +00:00
|
|
|
-ip=${POD_NAME}.${SEAWEEDFS_FULLNAME}-volume \
|
|
|
|
-compactionMBps={{ .Values.volume.compactionMBps }} \
|
|
|
|
-mserver={{ range $index := until (.Values.master.replicas | int) }}${SEAWEEDFS_FULLNAME}-master-{{ $index }}.${SEAWEEDFS_FULLNAME}-master:{{ $.Values.master.port }}{{ if lt $index (sub ($.Values.master.replicas | int) 1) }},{{ end }}{{ end }}
|
|
|
|
volumeMounts:
|
2021-02-24 08:25:11 +00:00
|
|
|
- name: data
|
|
|
|
mountPath: "{{ .Values.volume.dir }}/"
|
|
|
|
{{- if .Values.volume.dir_idx }}
|
|
|
|
- name: idx
|
|
|
|
mountPath: "{{ .Values.volume.dir_idx }}/"
|
|
|
|
{{- end }}
|
|
|
|
- name: logs
|
2020-03-03 07:56:39 +00:00
|
|
|
mountPath: "/logs/"
|
|
|
|
{{- if .Values.global.enableSecurity }}
|
|
|
|
- name: security-config
|
|
|
|
readOnly: true
|
|
|
|
mountPath: /etc/seaweedfs/security.toml
|
|
|
|
subPath: security.toml
|
|
|
|
- name: ca-cert
|
|
|
|
readOnly: true
|
|
|
|
mountPath: /usr/local/share/ca-certificates/ca/
|
|
|
|
- name: master-cert
|
|
|
|
readOnly: true
|
|
|
|
mountPath: /usr/local/share/ca-certificates/master/
|
|
|
|
- name: volume-cert
|
|
|
|
readOnly: true
|
|
|
|
mountPath: /usr/local/share/ca-certificates/volume/
|
|
|
|
- name: filer-cert
|
|
|
|
readOnly: true
|
|
|
|
mountPath: /usr/local/share/ca-certificates/filer/
|
|
|
|
- name: client-cert
|
|
|
|
readOnly: true
|
|
|
|
mountPath: /usr/local/share/ca-certificates/client/
|
|
|
|
{{- end }}
|
|
|
|
{{ tpl .Values.volume.extraVolumeMounts . | nindent 12 | trim }}
|
|
|
|
ports:
|
|
|
|
- containerPort: {{ .Values.volume.port }}
|
|
|
|
name: swfs-vol
|
2022-08-04 16:08:40 +00:00
|
|
|
{{- if .Values.volume.metricsPort }}
|
|
|
|
- containerPort: {{ .Values.filer.metricsPort }}
|
|
|
|
name: metrics
|
|
|
|
{{- end }}
|
2020-03-03 07:56:39 +00:00
|
|
|
- containerPort: {{ .Values.volume.grpcPort }}
|
2022-08-04 16:08:40 +00:00
|
|
|
name: swfs-vol-grpc
|
2020-03-03 07:56:39 +00:00
|
|
|
readinessProbe:
|
|
|
|
httpGet:
|
|
|
|
path: /status
|
|
|
|
port: {{ .Values.volume.port }}
|
|
|
|
scheme: HTTP
|
2020-09-10 06:24:08 +00:00
|
|
|
initialDelaySeconds: 15
|
|
|
|
periodSeconds: 90
|
2020-03-03 07:56:39 +00:00
|
|
|
successThreshold: 1
|
|
|
|
failureThreshold: 100
|
2021-01-13 20:23:44 +00:00
|
|
|
timeoutSeconds: 30
|
2020-03-03 07:56:39 +00:00
|
|
|
livenessProbe:
|
|
|
|
httpGet:
|
|
|
|
path: /status
|
|
|
|
port: {{ .Values.volume.port }}
|
|
|
|
scheme: HTTP
|
|
|
|
initialDelaySeconds: 20
|
2020-09-10 06:24:08 +00:00
|
|
|
periodSeconds: 90
|
2020-03-03 07:56:39 +00:00
|
|
|
successThreshold: 1
|
2020-09-10 06:24:08 +00:00
|
|
|
failureThreshold: 4
|
2021-01-13 20:23:44 +00:00
|
|
|
timeoutSeconds: 30
|
2020-03-03 07:56:39 +00:00
|
|
|
{{- if .Values.volume.resources }}
|
|
|
|
resources:
|
|
|
|
{{ tpl .Values.volume.resources . | nindent 12 | trim }}
|
|
|
|
{{- end }}
|
2021-02-24 08:25:11 +00:00
|
|
|
{{- $hostpath_exists := include "volume.hostpath_exists" . -}}
|
|
|
|
{{- if $hostpath_exists }}
|
2020-03-03 07:56:39 +00:00
|
|
|
volumes:
|
2021-02-24 08:25:11 +00:00
|
|
|
{{- if eq .Values.volume.data.type "hostPath" }}
|
|
|
|
- name: data
|
2020-03-03 07:56:39 +00:00
|
|
|
hostPath:
|
2021-02-24 08:25:11 +00:00
|
|
|
path: /storage/object_store/
|
2020-03-03 07:56:39 +00:00
|
|
|
type: DirectoryOrCreate
|
2021-02-24 08:25:11 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- if and (eq .Values.volume.idx.type "hostPath") .Values.volume.dir_idx }}
|
|
|
|
- name: idx
|
2020-03-03 07:56:39 +00:00
|
|
|
hostPath:
|
2021-02-24 08:25:11 +00:00
|
|
|
path: /ssd/seaweedfs-volume-idx/
|
2020-03-03 07:56:39 +00:00
|
|
|
type: DirectoryOrCreate
|
2021-02-24 08:25:11 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- if eq .Values.volume.logs.type "hostPath" }}
|
|
|
|
- name: logs
|
|
|
|
hostPath:
|
|
|
|
path: /storage/logs/seaweedfs/volume
|
|
|
|
type: DirectoryOrCreate
|
|
|
|
{{- end }}
|
2020-03-03 07:56:39 +00:00
|
|
|
{{- if .Values.global.enableSecurity }}
|
|
|
|
- name: security-config
|
|
|
|
configMap:
|
|
|
|
name: {{ template "seaweedfs.name" . }}-security-config
|
|
|
|
- name: ca-cert
|
|
|
|
secret:
|
|
|
|
secretName: {{ template "seaweedfs.name" . }}-ca-cert
|
|
|
|
- name: master-cert
|
|
|
|
secret:
|
|
|
|
secretName: {{ template "seaweedfs.name" . }}-master-cert
|
|
|
|
- name: volume-cert
|
|
|
|
secret:
|
|
|
|
secretName: {{ template "seaweedfs.name" . }}-volume-cert
|
|
|
|
- name: filer-cert
|
|
|
|
secret:
|
|
|
|
secretName: {{ template "seaweedfs.name" . }}-filer-cert
|
|
|
|
- name: client-cert
|
|
|
|
secret:
|
|
|
|
secretName: {{ template "seaweedfs.name" . }}-client-cert
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.volume.extraVolumes }}
|
|
|
|
{{ tpl .Values.volume.extraVolumes . | indent 8 | trim }}
|
|
|
|
{{- end }}
|
2021-02-24 08:25:11 +00:00
|
|
|
{{- end }}
|
2020-03-03 07:56:39 +00:00
|
|
|
{{- if .Values.volume.nodeSelector }}
|
|
|
|
nodeSelector:
|
|
|
|
{{ tpl .Values.volume.nodeSelector . | indent 8 | trim }}
|
|
|
|
{{- end }}
|
2021-02-24 08:25:11 +00:00
|
|
|
{{- $pvc_exists := include "volume.pvc_exists" . -}}
|
|
|
|
{{- if $pvc_exists }}
|
|
|
|
volumeClaimTemplates:
|
|
|
|
{{- if eq .Values.volume.data.type "persistentVolumeClaim"}}
|
|
|
|
- metadata:
|
|
|
|
name: data
|
|
|
|
spec:
|
|
|
|
accessModes: [ "ReadWriteOnce" ]
|
|
|
|
storageClassName: {{ .Values.volume.data.storageClass }}
|
|
|
|
resources:
|
|
|
|
requests:
|
|
|
|
storage: {{ .Values.volume.data.size }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if and (eq .Values.volume.idx.type "persistentVolumeClaim") .Values.volume.dir_idx }}
|
|
|
|
- metadata:
|
|
|
|
name: idx
|
|
|
|
spec:
|
|
|
|
accessModes: [ "ReadWriteOnce" ]
|
|
|
|
storageClassName: {{ .Values.volume.idx.storageClass }}
|
|
|
|
resources:
|
|
|
|
requests:
|
|
|
|
storage: {{ .Values.volume.idx.size }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if eq .Values.volume.logs.type "persistentVolumeClaim" }}
|
|
|
|
- metadata:
|
|
|
|
name: logs
|
|
|
|
spec:
|
|
|
|
accessModes: [ "ReadWriteOnce" ]
|
|
|
|
storageClassName: {{ .Values.volume.logs.storageClass }}
|
|
|
|
resources:
|
|
|
|
requests:
|
|
|
|
storage: {{ .Values.volume.logs.size }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
2020-03-03 07:56:39 +00:00
|
|
|
{{- end }}
|