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.

262 lines
9.8 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. {{- end }}
  153. -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 }}
  154. {{- if or (.Values.global.enableSecurity) (.Values.filer.extraVolumeMounts) }}
  155. volumeMounts:
  156. - name: seaweedfs-filer-log-volume
  157. mountPath: "/logs/"
  158. - mountPath: /etc/sw
  159. name: config-users
  160. readOnly: true
  161. {{- if .Values.global.enableSecurity }}
  162. - name: security-config
  163. readOnly: true
  164. mountPath: /etc/seaweedfs/security.toml
  165. subPath: security.toml
  166. - name: ca-cert
  167. readOnly: true
  168. mountPath: /usr/local/share/ca-certificates/ca/
  169. - name: master-cert
  170. readOnly: true
  171. mountPath: /usr/local/share/ca-certificates/master/
  172. - name: volume-cert
  173. readOnly: true
  174. mountPath: /usr/local/share/ca-certificates/volume/
  175. - name: filer-cert
  176. readOnly: true
  177. mountPath: /usr/local/share/ca-certificates/filer/
  178. - name: client-cert
  179. readOnly: true
  180. mountPath: /usr/local/share/ca-certificates/client/
  181. {{- end }}
  182. {{ tpl .Values.filer.extraVolumeMounts . | nindent 12 | trim }}
  183. {{- end }}
  184. ports:
  185. - containerPort: {{ .Values.filer.port }}
  186. name: swfs-filer
  187. - containerPort: {{ .Values.filer.grpcPort }}
  188. #name: swfs-filer-grpc
  189. readinessProbe:
  190. httpGet:
  191. path: /
  192. port: {{ .Values.filer.port }}
  193. scheme: HTTP
  194. initialDelaySeconds: 10
  195. periodSeconds: 15
  196. successThreshold: 1
  197. failureThreshold: 100
  198. timeoutSeconds: 10
  199. livenessProbe:
  200. httpGet:
  201. path: /
  202. port: {{ .Values.filer.port }}
  203. scheme: HTTP
  204. initialDelaySeconds: 20
  205. periodSeconds: 30
  206. successThreshold: 1
  207. failureThreshold: 5
  208. timeoutSeconds: 10
  209. {{- if .Values.filer.resources }}
  210. resources:
  211. {{ tpl .Values.filer.resources . | nindent 12 | trim }}
  212. {{- end }}
  213. volumes:
  214. - name: seaweedfs-filer-log-volume
  215. hostPath:
  216. path: /storage/logs/seaweedfs/filer
  217. type: DirectoryOrCreate
  218. - name: db-schema-config-volume
  219. configMap:
  220. name: seaweedfs-db-init-config
  221. - name: config-users
  222. secret:
  223. defaultMode: 420
  224. secretName: seaweedfs-s3-secret
  225. {{- if .Values.global.enableSecurity }}
  226. - name: security-config
  227. configMap:
  228. name: {{ template "seaweedfs.name" . }}-security-config
  229. - name: ca-cert
  230. secret:
  231. secretName: {{ template "seaweedfs.name" . }}-ca-cert
  232. - name: master-cert
  233. secret:
  234. secretName: {{ template "seaweedfs.name" . }}-master-cert
  235. - name: volume-cert
  236. secret:
  237. secretName: {{ template "seaweedfs.name" . }}-volume-cert
  238. - name: filer-cert
  239. secret:
  240. secretName: {{ template "seaweedfs.name" . }}-filer-cert
  241. - name: client-cert
  242. secret:
  243. secretName: {{ template "seaweedfs.name" . }}-client-cert
  244. {{- end }}
  245. {{ tpl .Values.filer.extraVolumes . | indent 8 | trim }}
  246. {{- if .Values.filer.nodeSelector }}
  247. nodeSelector:
  248. {{ tpl .Values.filer.nodeSelector . | indent 8 | trim }}
  249. {{- end }}
  250. {{/* volumeClaimTemplates:*/}}
  251. {{/* - metadata:*/}}
  252. {{/* name: data-{{ .Release.Namespace }}*/}}
  253. {{/* spec:*/}}
  254. {{/* accessModes:*/}}
  255. {{/* - ReadWriteOnce*/}}
  256. {{/* resources:*/}}
  257. {{/* requests:*/}}
  258. {{/* storage: {{ .Values.filer.storage }}*/}}
  259. {{/* {{- if .Values.filer.storageClass }}*/}}
  260. {{/* storageClassName: {{ .Values.filer.storageClass }}*/}}
  261. {{/* {{- end }}*/}}
  262. {{- end }}