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.

269 lines
9.9 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: seaweefds-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. - name: seaweedfs-filer-log-volume
  220. hostPath:
  221. path: /storage/logs/seaweedfs/filer
  222. type: DirectoryOrCreate
  223. - name: db-schema-config-volume
  224. configMap:
  225. name: seaweedfs-db-init-config
  226. - name: config-users
  227. secret:
  228. defaultMode: 420
  229. secretName: seaweedfs-s3-secret
  230. {{- if .Values.global.enableSecurity }}
  231. - name: security-config
  232. configMap:
  233. name: {{ template "seaweedfs.name" . }}-security-config
  234. - name: ca-cert
  235. secret:
  236. secretName: {{ template "seaweedfs.name" . }}-ca-cert
  237. - name: master-cert
  238. secret:
  239. secretName: {{ template "seaweedfs.name" . }}-master-cert
  240. - name: volume-cert
  241. secret:
  242. secretName: {{ template "seaweedfs.name" . }}-volume-cert
  243. - name: filer-cert
  244. secret:
  245. secretName: {{ template "seaweedfs.name" . }}-filer-cert
  246. - name: client-cert
  247. secret:
  248. secretName: {{ template "seaweedfs.name" . }}-client-cert
  249. {{- end }}
  250. {{ tpl .Values.filer.extraVolumes . | indent 8 | trim }}
  251. {{- if .Values.filer.nodeSelector }}
  252. nodeSelector:
  253. {{ tpl .Values.filer.nodeSelector . | indent 8 | trim }}
  254. {{- end }}
  255. {{- if .Values.filer.enablePVC }}
  256. volumeClaimTemplates:
  257. - metadata:
  258. name: data-filer
  259. spec:
  260. accessModes:
  261. - ReadWriteOnce
  262. resources:
  263. requests:
  264. storage: {{ .Values.filer.storage }}
  265. {{- if .Values.filer.storageClass }}
  266. storageClassName: {{ .Values.filer.storageClass }}
  267. {{- end }}
  268. {{- end }}
  269. {{- end }}