2020-03-03 07:56:39 +00:00
|
|
|
{{- if .Values.master.enabled }}
|
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: StatefulSet
|
|
|
|
metadata:
|
|
|
|
name: {{ template "seaweedfs.name" . }}-master
|
|
|
|
namespace: {{ .Release.Namespace }}
|
|
|
|
labels:
|
|
|
|
app: {{ template "seaweedfs.name" . }}
|
|
|
|
chart: {{ template "seaweedfs.chart" . }}
|
|
|
|
heritage: {{ .Release.Service }}
|
|
|
|
release: {{ .Release.Name }}
|
|
|
|
spec:
|
|
|
|
serviceName: {{ template "seaweedfs.name" . }}-master
|
|
|
|
podManagementPolicy: Parallel
|
|
|
|
replicas: {{ .Values.master.replicas }}
|
|
|
|
{{- if (gt (int .Values.master.updatePartition) 0) }}
|
|
|
|
updateStrategy:
|
|
|
|
type: RollingUpdate
|
|
|
|
rollingUpdate:
|
|
|
|
partition: {{ .Values.master.updatePartition }}
|
|
|
|
{{- end }}
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
app: {{ template "seaweedfs.name" . }}
|
|
|
|
chart: {{ template "seaweedfs.chart" . }}
|
|
|
|
release: {{ .Release.Name }}
|
|
|
|
component: master
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app: {{ template "seaweedfs.name" . }}
|
|
|
|
chart: {{ template "seaweedfs.chart" . }}
|
|
|
|
release: {{ .Release.Name }}
|
|
|
|
component: master
|
|
|
|
spec:
|
|
|
|
restartPolicy: {{ default .Values.global.restartPolicy .Values.master.restartPolicy }}
|
|
|
|
{{- if .Values.master.affinity }}
|
|
|
|
affinity:
|
|
|
|
{{ tpl .Values.master.affinity . | nindent 8 | trim }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.master.tolerations }}
|
|
|
|
tolerations:
|
|
|
|
{{ tpl .Values.master.tolerations . | nindent 8 | trim }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.global.imagePullSecrets }}
|
|
|
|
imagePullSecrets:
|
|
|
|
- name: {{ .Values.global.imagePullSecrets }}
|
|
|
|
{{- end }}
|
|
|
|
terminationGracePeriodSeconds: 60
|
|
|
|
{{- if .Values.master.priorityClassName }}
|
|
|
|
priorityClassName: {{ .Values.master.priorityClassName | quote }}
|
|
|
|
{{- end }}
|
|
|
|
enableServiceLinks: false
|
2022-08-03 19:21:36 +00:00
|
|
|
{{- if .Values.master.initContainers }}
|
|
|
|
initContainers:
|
|
|
|
{{ tpl .Values.master.initContainers . | nindent 8 | trim }}
|
|
|
|
{{- end }}
|
2020-03-03 07:56:39 +00:00
|
|
|
containers:
|
|
|
|
- name: seaweedfs
|
|
|
|
image: {{ template "master.image" . }}
|
|
|
|
imagePullPolicy: {{ default "IfNotPresent" .Values.global.imagePullPolicy }}
|
|
|
|
env:
|
|
|
|
- name: POD_IP
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: status.podIP
|
|
|
|
- name: POD_NAME
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: metadata.name
|
|
|
|
- name: NAMESPACE
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: metadata.namespace
|
|
|
|
- name: SEAWEEDFS_FULLNAME
|
|
|
|
value: "{{ template "seaweedfs.name" . }}"
|
2020-09-10 06:27:51 +00:00
|
|
|
{{- if .Values.master.extraEnvironmentVars }}
|
|
|
|
{{- range $key, $value := .Values.master.extraEnvironmentVars }}
|
|
|
|
- name: {{ $key }}
|
|
|
|
value: {{ $value | quote }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
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.master.loggingOverrideLevel }}
|
|
|
|
-v={{ .Values.master.loggingOverrideLevel }} \
|
|
|
|
{{- else }}
|
|
|
|
-v={{ .Values.global.loggingLevel }} \
|
|
|
|
{{- end }}
|
|
|
|
master \
|
|
|
|
-port={{ .Values.master.port }} \
|
|
|
|
-mdir=/data \
|
|
|
|
-ip.bind={{ .Values.master.ipBind }} \
|
2020-09-10 06:27:51 +00:00
|
|
|
{{- if .Values.global.enableReplication }}
|
|
|
|
-defaultReplication={{ .Values.global.replicationPlacment }} \
|
|
|
|
{{- else }}
|
|
|
|
-defaultReplication={{ .Values.master.defaultReplication }} \
|
|
|
|
{{- end }}
|
2020-03-03 07:56:39 +00:00
|
|
|
{{- if .Values.master.volumePreallocate }}
|
|
|
|
-volumePreallocate \
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.global.monitoring.enabled }}
|
2022-08-04 16:08:40 +00:00
|
|
|
{{- if and .Values.global.monitoring.gatewayHost .Values.global.monitoring.gatewayPort }}
|
2020-03-03 07:56:39 +00:00
|
|
|
-metrics.address="{{ .Values.global.monitoring.gatewayHost }}:{{ .Values.global.monitoring.gatewayPort }}" \
|
2022-08-04 16:08:40 +00:00
|
|
|
{{- if .Values.master.metricsIntervalSec }}
|
|
|
|
-metrics.intervalSeconds={{ .Values.master.metricsIntervalSec }} \
|
|
|
|
{{- end }}
|
|
|
|
{{- else if .Values.master.metricsPort }}
|
|
|
|
-metricsPort={{ .Values.master.metricsPort }} \
|
|
|
|
{{- end }}
|
2020-03-03 07:56:39 +00:00
|
|
|
{{- end }}
|
|
|
|
-volumeSizeLimitMB={{ .Values.master.volumeSizeLimitMB }} \
|
|
|
|
{{- if .Values.master.disableHttp }}
|
|
|
|
-disableHttp \
|
|
|
|
{{- end }}
|
2020-09-10 06:27:51 +00:00
|
|
|
{{- if .Values.master.pulseSeconds }}
|
|
|
|
-pulseSeconds={{ .Values.master.pulseSeconds }} \
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.master.garbageThreshold }}
|
|
|
|
-garbageThreshold={{ .Values.master.garbageThreshold }} \
|
|
|
|
{{- end }}
|
2020-03-03 07:56:39 +00:00
|
|
|
-ip=${POD_NAME}.${SEAWEEDFS_FULLNAME}-master \
|
|
|
|
-peers={{ 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:
|
|
|
|
- name : data-{{ .Release.Namespace }}
|
|
|
|
mountPath: /data
|
|
|
|
- name: seaweedfs-master-log-volume
|
|
|
|
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.master.extraVolumeMounts . | nindent 12 | trim }}
|
|
|
|
ports:
|
|
|
|
- containerPort: {{ .Values.master.port }}
|
|
|
|
name: swfs-master
|
2022-08-04 16:08:40 +00:00
|
|
|
{{- if and .Values.global.monitoring.enabled .Values.master.metricsPort }}
|
|
|
|
- containerPort: {{ .Values.master.metricsPort }}
|
|
|
|
name: metrics
|
|
|
|
{{- end }}
|
2020-03-03 07:56:39 +00:00
|
|
|
- containerPort: {{ .Values.master.grpcPort }}
|
|
|
|
#name: swfs-master-grpc
|
|
|
|
readinessProbe:
|
|
|
|
httpGet:
|
|
|
|
path: /cluster/status
|
|
|
|
port: {{ .Values.master.port }}
|
|
|
|
scheme: HTTP
|
2020-09-10 06:24:08 +00:00
|
|
|
initialDelaySeconds: 10
|
|
|
|
periodSeconds: 45
|
2020-03-03 07:56:39 +00:00
|
|
|
successThreshold: 2
|
|
|
|
failureThreshold: 100
|
2021-01-13 20:23:44 +00:00
|
|
|
timeoutSeconds: 10
|
2020-03-03 07:56:39 +00:00
|
|
|
livenessProbe:
|
|
|
|
httpGet:
|
|
|
|
path: /cluster/status
|
|
|
|
port: {{ .Values.master.port }}
|
|
|
|
scheme: HTTP
|
|
|
|
initialDelaySeconds: 20
|
2020-09-10 06:24:08 +00:00
|
|
|
periodSeconds: 30
|
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: 10
|
2020-03-03 07:56:39 +00:00
|
|
|
{{- if .Values.master.resources }}
|
|
|
|
resources:
|
|
|
|
{{ tpl .Values.master.resources . | nindent 12 | trim }}
|
|
|
|
{{- end }}
|
2022-07-26 10:27:41 +00:00
|
|
|
{{- $hostpath_exists := include "master.hostpath_exists" . -}}
|
|
|
|
{{- if $hostpath_exists }}
|
2020-03-03 07:56:39 +00:00
|
|
|
volumes:
|
2022-07-26 10:27:41 +00:00
|
|
|
{{- if eq .Values.master.logs.type "hostPath" }}
|
2020-03-03 07:56:39 +00:00
|
|
|
- name: seaweedfs-master-log-volume
|
|
|
|
hostPath:
|
|
|
|
path: /storage/logs/seaweedfs/master
|
|
|
|
type: DirectoryOrCreate
|
2022-07-26 10:27:41 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- if eq .Values.master.data.type "hostPath" }}
|
2020-03-03 07:56:39 +00:00
|
|
|
- name: data-{{ .Release.Namespace }}
|
|
|
|
hostPath:
|
|
|
|
path: /ssd/seaweed-master/
|
|
|
|
type: DirectoryOrCreate
|
2022-07-26 10:27:41 +00:00
|
|
|
{{- 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 }}
|
|
|
|
{{ tpl .Values.master.extraVolumes . | indent 8 | trim }}
|
2022-07-26 10:27:41 +00:00
|
|
|
{{- end }}
|
2020-03-03 07:56:39 +00:00
|
|
|
{{- if .Values.master.nodeSelector }}
|
|
|
|
nodeSelector:
|
|
|
|
{{ tpl .Values.master.nodeSelector . | indent 8 | trim }}
|
|
|
|
{{- end }}
|
2022-07-26 10:27:41 +00:00
|
|
|
{{- $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 }}
|
2020-03-03 07:56:39 +00:00
|
|
|
{{- end }}
|