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.

267 lines
10 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.enable_peers }}
  137. {{- if gt (.Values.filer.replicas | int) 1 }}
  138. -peers=$(echo -n "{{ range $index := until (.Values.filer.replicas | int) }}${SEAWEEDFS_FULLNAME}-filer-{{ $index }}.${SEAWEEDFS_FULLNAME}-filer:{{ $.Values.filer.port }}{{ if lt $index (sub ($.Values.filer.replicas | int) 1) }},{{ end }}{{ end }}" | sed "s/$HOSTNAME.${SEAWEEDFS_FULLNAME}-filer:{{ $.Values.filer.port }}//" | sed 's/,$//; 's/^,//'; s/,,/,/;' ) \
  139. {{- end }}
  140. {{- end }}
  141. {{- if .Values.filer.s3.enabled }}
  142. -s3 \
  143. -s3.port={{ .Values.filer.s3.port }} \
  144. {{- if .Values.filer.s3.domainName }}
  145. -s3.domainName={{ .Values.filer.s3.domainName }} \
  146. {{- end }}
  147. {{- if .Values.global.enableSecurity }}
  148. -s3.cert.file=/usr/local/share/ca-certificates/client/tls.crt \
  149. -s3.key.file=/usr/local/share/ca-certificates/client/tls.key \
  150. {{- end }}
  151. {{- if .Values.filer.s3.allowEmptyFolder }}
  152. -s3.allowEmptyFolder={{ .Values.filer.s3.allowEmptyFolder }} \
  153. {{- end }}
  154. {{- if .Values.filer.s3.enableAuth }}
  155. -s3.config=/etc/sw/seaweedfs_s3_config \
  156. {{- end }}
  157. {{- end }}
  158. -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 }}
  159. {{- if or (.Values.global.enableSecurity) (.Values.filer.extraVolumeMounts) }}
  160. volumeMounts:
  161. - name: seaweedfs-filer-log-volume
  162. mountPath: "/logs/"
  163. - mountPath: /etc/sw
  164. name: config-users
  165. readOnly: true
  166. {{- if .Values.global.enableSecurity }}
  167. - name: security-config
  168. readOnly: true
  169. mountPath: /etc/seaweedfs/security.toml
  170. subPath: security.toml
  171. - name: ca-cert
  172. readOnly: true
  173. mountPath: /usr/local/share/ca-certificates/ca/
  174. - name: master-cert
  175. readOnly: true
  176. mountPath: /usr/local/share/ca-certificates/master/
  177. - name: volume-cert
  178. readOnly: true
  179. mountPath: /usr/local/share/ca-certificates/volume/
  180. - name: filer-cert
  181. readOnly: true
  182. mountPath: /usr/local/share/ca-certificates/filer/
  183. - name: client-cert
  184. readOnly: true
  185. mountPath: /usr/local/share/ca-certificates/client/
  186. {{- end }}
  187. {{ tpl .Values.filer.extraVolumeMounts . | nindent 12 | trim }}
  188. {{- end }}
  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. {{/* volumeClaimTemplates:*/}}
  256. {{/* - metadata:*/}}
  257. {{/* name: data-{{ .Release.Namespace }}*/}}
  258. {{/* spec:*/}}
  259. {{/* accessModes:*/}}
  260. {{/* - ReadWriteOnce*/}}
  261. {{/* resources:*/}}
  262. {{/* requests:*/}}
  263. {{/* storage: {{ .Values.filer.storage }}*/}}
  264. {{/* {{- if .Values.filer.storageClass }}*/}}
  265. {{/* storageClassName: {{ .Values.filer.storageClass }}*/}}
  266. {{/* {{- end }}*/}}
  267. {{- end }}