| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442 |
- {{- if .Values.filer.enabled }}
- apiVersion: apps/v1
- kind: StatefulSet
- metadata:
- name: {{ template "seaweedfs.name" . }}-filer
- namespace: {{ .Release.Namespace }}
- labels:
- app.kubernetes.io/name: {{ template "seaweedfs.name" . }}
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- app.kubernetes.io/component: filer
- {{- if .Values.filer.annotations }}
- annotations:
- {{- toYaml .Values.filer.annotations | nindent 4 }}
- {{- end }}
- spec:
- serviceName: {{ template "seaweedfs.name" . }}-filer
- podManagementPolicy: {{ .Values.filer.podManagementPolicy }}
- replicas: {{ .Values.filer.replicas }}
- {{- if (gt (int .Values.filer.updatePartition) 0) }}
- updateStrategy:
- type: RollingUpdate
- rollingUpdate:
- partition: {{ .Values.filer.updatePartition }}
- {{- end }}
- selector:
- matchLabels:
- app.kubernetes.io/name: {{ template "seaweedfs.name" . }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- app.kubernetes.io/component: filer
- template:
- metadata:
- labels:
- app.kubernetes.io/name: {{ template "seaweedfs.name" . }}
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- app.kubernetes.io/component: filer
- {{- with .Values.podLabels }}
- {{- toYaml . | nindent 8 }}
- {{- end }}
- {{- with .Values.filer.podLabels }}
- {{- toYaml . | nindent 8 }}
- {{- end }}
- annotations:
- {{- with .Values.podAnnotations }}
- {{- toYaml . | nindent 8 }}
- {{- end }}
- {{- with .Values.filer.podAnnotations }}
- {{- toYaml . | nindent 8 }}
- {{- end }}
- {{- if .Values.filer.s3.existingConfigSecret }}
- {{- $configSecret := (lookup "v1" "Secret" .Release.Namespace .Values.filer.s3.existingConfigSecret) | default dict }}
- checksum/s3config: {{ $configSecret | toYaml | sha256sum }}
- {{- else }}
- checksum/s3config: {{ include (print .Template.BasePath "/s3/s3-secret.yaml") . | sha256sum }}
- {{- end }}
- spec:
- restartPolicy: {{ default .Values.global.restartPolicy .Values.filer.restartPolicy }}
- {{- if .Values.filer.affinity }}
- affinity:
- {{ tpl .Values.filer.affinity . | nindent 8 | trim }}
- {{- end }}
- {{- if .Values.filer.topologySpreadConstraints }}
- topologySpreadConstraints:
- {{ tpl .Values.filer.topologySpreadConstraints . | nindent 8 | trim }}
- {{- end }}
- {{- if .Values.filer.tolerations }}
- tolerations:
- {{ tpl .Values.filer.tolerations . | nindent 8 | trim }}
- {{- end }}
- {{- include "seaweedfs.imagePullSecrets" . | nindent 6 }}
- serviceAccountName: {{ .Values.filer.serviceAccountName | default .Values.global.serviceAccountName | quote }} # for deleting statefulset pods after migration
- terminationGracePeriodSeconds: 60
- {{- if .Values.filer.priorityClassName }}
- priorityClassName: {{ .Values.filer.priorityClassName | quote }}
- {{- end }}
- enableServiceLinks: false
- {{- if .Values.filer.initContainers }}
- initContainers:
- {{ tpl .Values.filer.initContainers . | nindent 8 | trim }}
- {{- end }}
- {{- if .Values.filer.podSecurityContext.enabled }}
- securityContext: {{- omit .Values.filer.podSecurityContext "enabled" | toYaml | nindent 8 }}
- {{- end }}
- containers:
- - name: seaweedfs
- image: {{ template "filer.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: WEED_MYSQL_USERNAME
- valueFrom:
- secretKeyRef:
- name: secret-seaweedfs-db
- key: user
- optional: true
- - name: WEED_MYSQL_PASSWORD
- valueFrom:
- secretKeyRef:
- name: secret-seaweedfs-db
- key: password
- optional: true
- - name: SEAWEEDFS_FULLNAME
- value: "{{ template "seaweedfs.name" . }}"
- {{- if .Values.filer.extraEnvironmentVars }}
- {{- range $key, $value := .Values.filer.extraEnvironmentVars }}
- - name: {{ $key }}
- {{- if kindIs "string" $value }}
- value: {{ $value | quote }}
- {{- else }}
- valueFrom:
- {{ toYaml $value | nindent 16 | trim }}
- {{- end -}}
- {{- end }}
- {{- end }}
- {{- if .Values.global.extraEnvironmentVars }}
- {{- range $key, $value := .Values.global.extraEnvironmentVars }}
- - name: {{ $key }}
- {{- if kindIs "string" $value }}
- value: {{ $value | quote }}
- {{- else }}
- valueFrom:
- {{ toYaml $value | nindent 16 | trim }}
- {{- end -}}
- {{- end }}
- {{- end }}
- {{- if .Values.filer.secretExtraEnvironmentVars }}
- {{- range $key, $value := .Values.filer.secretExtraEnvironmentVars }}
- - name: {{ $key }}
- valueFrom: {{ toYaml $value | nindent 16 }}
- {{- end }}
- {{- end }}
- command:
- - "/bin/sh"
- - "-ec"
- - |
- exec /usr/bin/weed \
- {{- if or (eq .Values.filer.logs.type "hostPath") (eq .Values.filer.logs.type "persistentVolumeClaim") (eq .Values.filer.logs.type "emptyDir") }}
- -logdir=/logs \
- {{- else }}
- -logtostderr=true \
- {{- end }}
- {{- if .Values.filer.loggingOverrideLevel }}
- -v={{ .Values.filer.loggingOverrideLevel }} \
- {{- else }}
- -v={{ .Values.global.loggingLevel }} \
- {{- end }}
- filer \
- -port={{ .Values.filer.port }} \
- {{- if .Values.filer.metricsPort }}
- -metricsPort={{ .Values.filer.metricsPort }} \
- {{- end }}
- {{- if .Values.filer.metricsIp }}
- -metricsIp={{ .Values.filer.metricsIp }} \
- {{- end }}
- {{- if .Values.filer.redirectOnRead }}
- -redirectOnRead \
- {{- end }}
- {{- if .Values.filer.disableHttp }}
- -disableHttp \
- {{- end }}
- {{- if .Values.filer.disableDirListing }}
- -disableDirListing \
- {{- end }}
- -dirListLimit={{ .Values.filer.dirListLimit }} \
- {{- if .Values.global.enableReplication }}
- -defaultReplicaPlacement={{ .Values.global.replicationPlacement }} \
- {{- else }}
- -defaultReplicaPlacement={{ .Values.filer.defaultReplicaPlacement }} \
- {{- end }}
- {{- if .Values.filer.disableDirListing }}
- -disableDirListing \
- {{- end }}
- {{- if .Values.filer.maxMB }}
- -maxMB={{ .Values.filer.maxMB }} \
- {{- end }}
- {{- if .Values.filer.encryptVolumeData }}
- -encryptVolumeData \
- {{- end }}
- -ip=${POD_IP} \
- -ip.bind={{ .Values.filer.ipBind }} \
- {{- if .Values.filer.filerGroup}}
- -filerGroup={{ .Values.filer.filerGroup}} \
- {{- end }}
- {{- if .Values.filer.rack }}
- -rack={{ .Values.filer.rack }} \
- {{- end }}
- {{- if .Values.filer.dataCenter }}
- -dataCenter={{ .Values.filer.dataCenter }} \
- {{- end }}
- {{- if .Values.filer.s3.enabled }}
- -s3 \
- -s3.port={{ .Values.filer.s3.port }} \
- {{- if .Values.filer.s3.domainName }}
- -s3.domainName={{ .Values.filer.s3.domainName }} \
- {{- end }}
- {{- if .Values.global.enableSecurity }}
- {{- if .Values.filer.s3.httpsPort }}
- -s3.port.https={{ .Values.filer.s3.httpsPort }} \
- {{- end }}
- -s3.cert.file=/usr/local/share/ca-certificates/client/tls.crt \
- -s3.key.file=/usr/local/share/ca-certificates/client/tls.key \
- {{- end }}
- {{- if eq (typeOf .Values.filer.s3.allowEmptyFolder) "bool" }}
- -s3.allowEmptyFolder={{ .Values.filer.s3.allowEmptyFolder }} \
- {{- end }}
- {{- if .Values.filer.s3.enableAuth }}
- -s3.config=/etc/sw/seaweedfs_s3_config \
- {{- end }}
- {{- if .Values.filer.s3.auditLogConfig }}
- -s3.auditLogConfig=/etc/sw/filer_s3_auditLogConfig.json \
- {{- end }}
- {{- end }}
- -master={{ if .Values.global.masterServer }}{{.Values.global.masterServer}}{{ else }}{{ 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 }}{{ end }} \
- {{- range .Values.filer.extraArgs }}
- {{ . }} \
- {{- end }}
- volumeMounts:
- {{- if (or (eq .Values.filer.logs.type "hostPath") (eq .Values.filer.logs.type "persistentVolumeClaim") (eq .Values.filer.logs.type "emptyDir")) }}
- - name: seaweedfs-filer-log-volume
- mountPath: "/logs/"
- {{- end }}
- {{- if .Values.filer.s3.enableAuth }}
- - name: config-users
- mountPath: /etc/sw
- readOnly: true
- {{- end }}
- {{- if (or .Values.filer.enablePVC (or (eq .Values.filer.data.type "hostPath") (eq .Values.filer.data.type "persistentVolumeClaim") (eq .Values.filer.data.type "emptyDir"))) }}
- - name: data-filer
- mountPath: /data
- {{- end }}
- {{- if .Values.filer.notificationConfig }}
- - name: notification-config
- readOnly: true
- mountPath: /etc/seaweedfs/notification.toml
- subPath: notification.toml
- {{- end }}
- {{- 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.filer.extraVolumeMounts . | nindent 12 | trim }}
- ports:
- - containerPort: {{ .Values.filer.port }}
- name: swfs-filer
- - containerPort: {{ .Values.filer.metricsPort }}
- name: metrics
- - containerPort: {{ .Values.filer.grpcPort }}
- #name: swfs-filer-grpc
- {{- if .Values.filer.s3.enabled }}
- - containerPort: {{ .Values.filer.s3.port }}
- name: swfs-s3
- {{- if .Values.filer.s3.httpsPort }}
- - containerPort: {{ .Values.filer.s3.httpsPort }}
- name: swfs-s3-tls
- {{- end }}
- {{- end }}
- {{- if .Values.filer.readinessProbe.enabled }}
- readinessProbe:
- httpGet:
- path: {{ .Values.filer.readinessProbe.httpGet.path }}
- port: {{ .Values.filer.port }}
- scheme: {{ .Values.filer.readinessProbe.scheme }}
- initialDelaySeconds: {{ .Values.filer.readinessProbe.initialDelaySeconds }}
- periodSeconds: {{ .Values.filer.readinessProbe.periodSeconds }}
- successThreshold: {{ .Values.filer.readinessProbe.successThreshold }}
- failureThreshold: {{ .Values.filer.readinessProbe.failureThreshold }}
- timeoutSeconds: {{ .Values.filer.readinessProbe.timeoutSeconds }}
- {{- end }}
- {{- if .Values.filer.livenessProbe.enabled }}
- livenessProbe:
- httpGet:
- path: {{ .Values.filer.livenessProbe.httpGet.path }}
- port: {{ .Values.filer.port }}
- scheme: {{ .Values.filer.livenessProbe.scheme }}
- initialDelaySeconds: {{ .Values.filer.livenessProbe.initialDelaySeconds }}
- periodSeconds: {{ .Values.filer.livenessProbe.periodSeconds }}
- successThreshold: {{ .Values.filer.livenessProbe.successThreshold }}
- failureThreshold: {{ .Values.filer.livenessProbe.failureThreshold }}
- timeoutSeconds: {{ .Values.filer.livenessProbe.timeoutSeconds }}
- {{- end }}
- {{- with .Values.filer.resources }}
- resources:
- {{- toYaml . | nindent 12 }}
- {{- end }}
- {{- if .Values.filer.containerSecurityContext.enabled }}
- securityContext: {{- omit .Values.filer.containerSecurityContext "enabled" | toYaml | nindent 12 }}
- {{- end }}
- {{- if .Values.filer.sidecars }}
- {{- include "common.tplvalues.render" (dict "value" .Values.filer.sidecars "context" $) | nindent 8 }}
- {{- end }}
- volumes:
- {{- if eq .Values.filer.logs.type "hostPath" }}
- - name: seaweedfs-filer-log-volume
- hostPath:
- path: {{ .Values.filer.logs.hostPathPrefix }}/logs/seaweedfs/filer
- type: DirectoryOrCreate
- {{- end }}
- {{- if eq .Values.filer.logs.type "existingClaim" }}
- - name: seaweedfs-filer-log-volume
- persistentVolumeClaim:
- claimName: {{ .Values.filer.logs.claimName }}
- {{- end }}
- {{- if eq .Values.filer.logs.type "emptyDir" }}
- - name: seaweedfs-filer-log-volume
- emptyDir: {}
- {{- end }}
- {{- if eq .Values.filer.data.type "hostPath" }}
- - name: data-filer
- hostPath:
- path: {{ .Values.filer.data.hostPathPrefix }}/filer_store
- type: DirectoryOrCreate
- {{- end }}
- {{- if eq .Values.filer.data.type "existingClaim" }}
- - name: data-filer
- persistentVolumeClaim:
- claimName: {{ .Values.filer.data.claimName }}
- {{- end }}
- {{- if eq .Values.filer.data.type "emptyDir" }}
- - name: data-filer
- emptyDir: {}
- {{- end }}
- - name: db-schema-config-volume
- configMap:
- name: seaweedfs-db-init-config
- {{- if and .Values.filer.s3.enabled .Values.filer.s3.enableAuth }}
- - name: config-users
- secret:
- defaultMode: 420
- {{- if .Values.filer.s3.existingConfigSecret }}
- secretName: {{ .Values.filer.s3.existingConfigSecret }}
- {{- else }}
- secretName: seaweedfs-s3-secret
- {{- end }}
- {{- end }}
- {{- if .Values.filer.notificationConfig }}
- - name: notification-config
- configMap:
- name: {{ template "seaweedfs.name" . }}-notification-config
- {{- end }}
- {{- 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.filer.extraVolumes . | indent 8 | trim }}
- {{- if .Values.filer.nodeSelector }}
- nodeSelector:
- {{ tpl .Values.filer.nodeSelector . | indent 8 | trim }}
- {{- end }}
- {{- if and (.Values.filer.enablePVC) (eq .Values.filer.data.type "persistentVolumeClaim") }}
- # DEPRECATION: Deprecate in favor of filer.data section below
- volumeClaimTemplates:
- - metadata:
- name: data-filer
- spec:
- accessModes:
- - ReadWriteOnce
- resources:
- requests:
- storage: {{ .Values.filer.storage }}
- {{- if .Values.filer.storageClass }}
- storageClassName: {{ .Values.filer.storageClass }}
- {{- end }}
- {{- end }}
- {{- $pvc_exists := include "filer.pvc_exists" . -}}
- {{- if $pvc_exists }}
- volumeClaimTemplates:
- {{- if eq .Values.filer.data.type "persistentVolumeClaim" }}
- - metadata:
- name: data-filer
- {{- with .Values.filer.data.annotations }}
- annotations:
- {{- toYaml . | nindent 10 }}
- {{- end }}
- spec:
- accessModes: [ "ReadWriteOnce" ]
- storageClassName: {{ .Values.filer.data.storageClass }}
- resources:
- requests:
- storage: {{ .Values.filer.data.size }}
- {{- end }}
- {{- if eq .Values.filer.logs.type "persistentVolumeClaim" }}
- - metadata:
- name: seaweedfs-filer-log-volume
- {{- with .Values.filer.logs.annotations }}
- annotations:
- {{- toYaml . | nindent 10 }}
- {{- end }}
- spec:
- accessModes: [ "ReadWriteOnce" ]
- storageClassName: {{ .Values.filer.logs.storageClass }}
- resources:
- requests:
- storage: {{ .Values.filer.logs.size }}
- {{- end }}
- {{- end }}
- {{- end }}
|