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.

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