You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

308 lines
11 KiB

  1. {{- if .Values.filer.enabled }}
  2. apiVersion: apps/v1
  3. kind: StatefulSet
  4. metadata:
  5. name: {{ template "seaweedfs.name" . }}-filer
  6. namespace: {{ .Release.Namespace }}
  7. labels:
  8. app: {{ template "seaweedfs.name" . }}
  9. chart: {{ template "seaweedfs.chart" . }}
  10. heritage: {{ .Release.Service }}
  11. release: {{ .Release.Name }}
  12. spec:
  13. serviceName: {{ template "seaweedfs.name" . }}-filer
  14. podManagementPolicy: Parallel
  15. replicas: {{ .Values.filer.replicas }}
  16. {{- if (gt (int .Values.filer.updatePartition) 0) }}
  17. updateStrategy:
  18. type: RollingUpdate
  19. rollingUpdate:
  20. partition: {{ .Values.filer.updatePartition }}
  21. {{- end }}
  22. selector:
  23. matchLabels:
  24. app: {{ template "seaweedfs.name" . }}
  25. chart: {{ template "seaweedfs.chart" . }}
  26. release: {{ .Release.Name }}
  27. component: filer
  28. template:
  29. metadata:
  30. labels:
  31. app: {{ template "seaweedfs.name" . }}
  32. chart: {{ template "seaweedfs.chart" . }}
  33. release: {{ .Release.Name }}
  34. component: filer
  35. spec:
  36. restartPolicy: {{ default .Values.global.restartPolicy .Values.filer.restartPolicy }}
  37. {{- if .Values.filer.affinity }}
  38. affinity:
  39. {{ tpl .Values.filer.affinity . | nindent 8 | trim }}
  40. {{- end }}
  41. {{- if .Values.filer.tolerations }}
  42. tolerations:
  43. {{ tpl .Values.filer.tolerations . | nindent 8 | trim }}
  44. {{- end }}
  45. {{- if .Values.global.imagePullSecrets }}
  46. imagePullSecrets:
  47. - name: {{ .Values.global.imagePullSecrets }}
  48. {{- end }}
  49. serviceAccountName: seaweedfs-rw-sa #hack for delete pod master after migration
  50. terminationGracePeriodSeconds: 60
  51. {{- if .Values.filer.priorityClassName }}
  52. priorityClassName: {{ .Values.filer.priorityClassName | quote }}
  53. {{- end }}
  54. enableServiceLinks: false
  55. {{- if .Values.filer.initContainers }}
  56. initContainers:
  57. {{ tpl .Values.filer.initContainers . | nindent 8 | trim }}
  58. {{- end }}
  59. containers:
  60. - name: seaweedfs
  61. image: {{ template "filer.image" . }}
  62. imagePullPolicy: {{ default "IfNotPresent" .Values.global.imagePullPolicy }}
  63. env:
  64. - name: POD_IP
  65. valueFrom:
  66. fieldRef:
  67. fieldPath: status.podIP
  68. - name: POD_NAME
  69. valueFrom:
  70. fieldRef:
  71. fieldPath: metadata.name
  72. - name: NAMESPACE
  73. valueFrom:
  74. fieldRef:
  75. fieldPath: metadata.namespace
  76. - name: WEED_MYSQL_USERNAME
  77. valueFrom:
  78. secretKeyRef:
  79. name: secret-seaweedfs-db
  80. key: user
  81. - name: WEED_MYSQL_PASSWORD
  82. valueFrom:
  83. secretKeyRef:
  84. name: secret-seaweedfs-db
  85. key: password
  86. - name: SEAWEEDFS_FULLNAME
  87. value: "{{ template "seaweedfs.name" . }}"
  88. {{- if .Values.filer.extraEnvironmentVars }}
  89. {{- range $key, $value := .Values.filer.extraEnvironmentVars }}
  90. - name: {{ $key }}
  91. value: {{ $value | quote }}
  92. {{- end }}
  93. {{- end }}
  94. {{- if .Values.global.extraEnvironmentVars }}
  95. {{- range $key, $value := .Values.global.extraEnvironmentVars }}
  96. - name: {{ $key }}
  97. value: {{ $value | quote }}
  98. {{- end }}
  99. {{- end }}
  100. command:
  101. - "/bin/sh"
  102. - "-ec"
  103. - |
  104. exec /usr/bin/weed -logdir=/logs \
  105. {{- if .Values.filer.loggingOverrideLevel }}
  106. -v={{ .Values.filer.loggingOverrideLevel }} \
  107. {{- else }}
  108. -v={{ .Values.global.loggingLevel }} \
  109. {{- end }}
  110. filer \
  111. -port={{ .Values.filer.port }} \
  112. {{- if .Values.filer.metricsPort }}
  113. -metricsPort={{ .Values.filer.metricsPort }} \
  114. {{- end }}
  115. {{- if .Values.filer.redirectOnRead }}
  116. -redirectOnRead \
  117. {{- end }}
  118. {{- if .Values.filer.disableHttp }}
  119. -disableHttp \
  120. {{- end }}
  121. {{- if .Values.filer.disableDirListing }}
  122. -disableDirListing \
  123. {{- end }}
  124. -dirListLimit={{ .Values.filer.dirListLimit }} \
  125. {{- if .Values.global.enableReplication }}
  126. -defaultReplicaPlacement={{ .Values.global.replicationPlacment }} \
  127. {{- else }}
  128. -defaultReplicaPlacement={{ .Values.filer.defaultReplicaPlacement }} \
  129. {{- end }}
  130. {{- if .Values.filer.disableDirListing }}
  131. -disableDirListing \
  132. {{- end }}
  133. {{- if .Values.filer.maxMB }}
  134. -maxMB={{ .Values.filer.maxMB }} \
  135. {{- end }}
  136. {{- if .Values.filer.encryptVolumeData }}
  137. -encryptVolumeData \
  138. {{- end }}
  139. -ip=${POD_IP} \
  140. {{- if .Values.filer.s3.enabled }}
  141. -s3 \
  142. -s3.port={{ .Values.filer.s3.port }} \
  143. {{- if .Values.filer.s3.domainName }}
  144. -s3.domainName={{ .Values.filer.s3.domainName }} \
  145. {{- end }}
  146. {{- if .Values.global.enableSecurity }}
  147. -s3.cert.file=/usr/local/share/ca-certificates/client/tls.crt \
  148. -s3.key.file=/usr/local/share/ca-certificates/client/tls.key \
  149. {{- end }}
  150. {{- if .Values.filer.s3.allowEmptyFolder }}
  151. -s3.allowEmptyFolder={{ .Values.filer.s3.allowEmptyFolder }} \
  152. {{- end }}
  153. {{- if .Values.filer.s3.enableAuth }}
  154. -s3.config=/etc/sw/seaweedfs_s3_config \
  155. {{- end }}
  156. {{- if .Values.filer.s3.auditLogConfig }}
  157. -s3.auditLogConfig=/etc/sw/filer_s3_auditLogConfig.json \
  158. {{- end }}
  159. {{- end }}
  160. -master={{ 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 }}
  161. volumeMounts:
  162. - name: seaweedfs-filer-log-volume
  163. mountPath: "/logs/"
  164. - mountPath: /etc/sw
  165. name: config-users
  166. readOnly: true
  167. {{- if .Values.filer.enablePVC }}
  168. - name: data-filer
  169. mountPath: /data
  170. {{- end }}
  171. {{- if .Values.global.enableSecurity }}
  172. - name: security-config
  173. readOnly: true
  174. mountPath: /etc/seaweedfs/security.toml
  175. subPath: security.toml
  176. - name: ca-cert
  177. readOnly: true
  178. mountPath: /usr/local/share/ca-certificates/ca/
  179. - name: master-cert
  180. readOnly: true
  181. mountPath: /usr/local/share/ca-certificates/master/
  182. - name: volume-cert
  183. readOnly: true
  184. mountPath: /usr/local/share/ca-certificates/volume/
  185. - name: filer-cert
  186. readOnly: true
  187. mountPath: /usr/local/share/ca-certificates/filer/
  188. - name: client-cert
  189. readOnly: true
  190. mountPath: /usr/local/share/ca-certificates/client/
  191. {{- end }}
  192. {{ tpl .Values.filer.extraVolumeMounts . | nindent 12 | trim }}
  193. ports:
  194. - containerPort: {{ .Values.filer.port }}
  195. name: swfs-filer
  196. - containerPort: {{ .Values.filer.metricsPort }}
  197. name: metrics
  198. - containerPort: {{ .Values.filer.grpcPort }}
  199. #name: swfs-filer-grpc
  200. readinessProbe:
  201. httpGet:
  202. path: /
  203. port: {{ .Values.filer.port }}
  204. scheme: HTTP
  205. initialDelaySeconds: 10
  206. periodSeconds: 15
  207. successThreshold: 1
  208. failureThreshold: 100
  209. timeoutSeconds: 10
  210. livenessProbe:
  211. httpGet:
  212. path: /
  213. port: {{ .Values.filer.port }}
  214. scheme: HTTP
  215. initialDelaySeconds: 20
  216. periodSeconds: 30
  217. successThreshold: 1
  218. failureThreshold: 5
  219. timeoutSeconds: 10
  220. {{- if .Values.filer.resources }}
  221. resources:
  222. {{ tpl .Values.filer.resources . | nindent 12 | trim }}
  223. {{- end }}
  224. volumes:
  225. {{- if eq .Values.filer.logs.type "hostPath" }}
  226. - name: seaweedfs-filer-log-volume
  227. hostPath:
  228. path: /storage/logs/seaweedfs/filer
  229. type: DirectoryOrCreate
  230. {{- end }}
  231. {{- if eq .Values.filer.data.type "hostPath" }}
  232. - name: data-filer
  233. hostPath:
  234. path: /storage/filer_store
  235. type: DirectoryOrCreate
  236. {{- end }}
  237. - name: db-schema-config-volume
  238. configMap:
  239. name: seaweedfs-db-init-config
  240. - name: config-users
  241. secret:
  242. defaultMode: 420
  243. secretName: seaweedfs-s3-secret
  244. {{- if .Values.global.enableSecurity }}
  245. - name: security-config
  246. configMap:
  247. name: {{ template "seaweedfs.name" . }}-security-config
  248. - name: ca-cert
  249. secret:
  250. secretName: {{ template "seaweedfs.name" . }}-ca-cert
  251. - name: master-cert
  252. secret:
  253. secretName: {{ template "seaweedfs.name" . }}-master-cert
  254. - name: volume-cert
  255. secret:
  256. secretName: {{ template "seaweedfs.name" . }}-volume-cert
  257. - name: filer-cert
  258. secret:
  259. secretName: {{ template "seaweedfs.name" . }}-filer-cert
  260. - name: client-cert
  261. secret:
  262. secretName: {{ template "seaweedfs.name" . }}-client-cert
  263. {{- end }}
  264. {{ tpl .Values.filer.extraVolumes . | indent 8 | trim }}
  265. {{- if .Values.filer.nodeSelector }}
  266. nodeSelector:
  267. {{ tpl .Values.filer.nodeSelector . | indent 8 | trim }}
  268. {{- end }}
  269. {{- if .Values.filer.enablePVC }}
  270. # DEPRECATION: Deprecate in favor of filer.data section below
  271. volumeClaimTemplates:
  272. - metadata:
  273. name: data-filer
  274. spec:
  275. accessModes:
  276. - ReadWriteOnce
  277. resources:
  278. requests:
  279. storage: {{ .Values.filer.storage }}
  280. {{- if .Values.filer.storageClass }}
  281. storageClassName: {{ .Values.filer.storageClass }}
  282. {{- end }}
  283. {{- end }}
  284. {{- $pvc_exists := include "filer.pvc_exists" . -}}
  285. {{- if $pvc_exists }}
  286. volumeClaimTemplates:
  287. {{- if eq .Values.filer.data.type "persistentVolumeClaim"}}
  288. - metadata:
  289. name: data-filer
  290. spec:
  291. accessModes: [ "ReadWriteOnce" ]
  292. storageClassName: {{ .Values.filer.data.storageClass }}
  293. resources:
  294. requests:
  295. storage: {{ .Values.filer.data.size }}
  296. {{- end }}
  297. {{- if eq .Values.filer.logs.type "persistentVolumeClaim"}}
  298. - metadata:
  299. name: seaweedfs-filer-log-volume
  300. spec:
  301. accessModes: [ "ReadWriteOnce" ]
  302. storageClassName: {{ .Values.filer.logs.storageClass }}
  303. resources:
  304. requests:
  305. storage: {{ .Values.filer.logs.size }}
  306. {{- end }}
  307. {{- end }}
  308. {{- end }}