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.

227 lines
8.6 KiB

  1. {{- if .Values.master.enabled }}
  2. apiVersion: apps/v1
  3. kind: StatefulSet
  4. metadata:
  5. name: {{ template "seaweedfs.name" . }}-master
  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" . }}-master
  14. podManagementPolicy: Parallel
  15. replicas: {{ .Values.master.replicas }}
  16. {{- if (gt (int .Values.master.updatePartition) 0) }}
  17. updateStrategy:
  18. type: RollingUpdate
  19. rollingUpdate:
  20. partition: {{ .Values.master.updatePartition }}
  21. {{- end }}
  22. selector:
  23. matchLabels:
  24. app: {{ template "seaweedfs.name" . }}
  25. chart: {{ template "seaweedfs.chart" . }}
  26. release: {{ .Release.Name }}
  27. component: master
  28. template:
  29. metadata:
  30. labels:
  31. app: {{ template "seaweedfs.name" . }}
  32. chart: {{ template "seaweedfs.chart" . }}
  33. release: {{ .Release.Name }}
  34. component: master
  35. spec:
  36. restartPolicy: {{ default .Values.global.restartPolicy .Values.master.restartPolicy }}
  37. {{- if .Values.master.affinity }}
  38. affinity:
  39. {{ tpl .Values.master.affinity . | nindent 8 | trim }}
  40. {{- end }}
  41. {{- if .Values.master.tolerations }}
  42. tolerations:
  43. {{ tpl .Values.master.tolerations . | nindent 8 | trim }}
  44. {{- end }}
  45. {{- if .Values.global.imagePullSecrets }}
  46. imagePullSecrets:
  47. - name: {{ .Values.global.imagePullSecrets }}
  48. {{- end }}
  49. terminationGracePeriodSeconds: 60
  50. {{- if .Values.master.priorityClassName }}
  51. priorityClassName: {{ .Values.master.priorityClassName | quote }}
  52. {{- end }}
  53. enableServiceLinks: false
  54. containers:
  55. - name: seaweedfs
  56. image: {{ template "master.image" . }}
  57. imagePullPolicy: {{ default "IfNotPresent" .Values.global.imagePullPolicy }}
  58. env:
  59. - name: POD_IP
  60. valueFrom:
  61. fieldRef:
  62. fieldPath: status.podIP
  63. - name: POD_NAME
  64. valueFrom:
  65. fieldRef:
  66. fieldPath: metadata.name
  67. - name: NAMESPACE
  68. valueFrom:
  69. fieldRef:
  70. fieldPath: metadata.namespace
  71. - name: SEAWEEDFS_FULLNAME
  72. value: "{{ template "seaweedfs.name" . }}"
  73. {{- if .Values.master.extraEnvironmentVars }}
  74. {{- range $key, $value := .Values.master.extraEnvironmentVars }}
  75. - name: {{ $key }}
  76. value: {{ $value | quote }}
  77. {{- end }}
  78. {{- end }}
  79. {{- if .Values.global.extraEnvironmentVars }}
  80. {{- range $key, $value := .Values.global.extraEnvironmentVars }}
  81. - name: {{ $key }}
  82. value: {{ $value | quote }}
  83. {{- end }}
  84. {{- end }}
  85. command:
  86. - "/bin/sh"
  87. - "-ec"
  88. - |
  89. exec /usr/bin/weed -logdir=/logs \
  90. {{- if .Values.master.loggingOverrideLevel }}
  91. -v={{ .Values.master.loggingOverrideLevel }} \
  92. {{- else }}
  93. -v={{ .Values.global.loggingLevel }} \
  94. {{- end }}
  95. master \
  96. -port={{ .Values.master.port }} \
  97. -mdir=/data \
  98. -ip.bind={{ .Values.master.ipBind }} \
  99. {{- if .Values.global.enableReplication }}
  100. -defaultReplication={{ .Values.global.replicationPlacment }} \
  101. {{- else }}
  102. -defaultReplication={{ .Values.master.defaultReplication }} \
  103. {{- end }}
  104. {{- if .Values.master.volumePreallocate }}
  105. -volumePreallocate \
  106. {{- end }}
  107. {{- if .Values.global.monitoring.enabled }}
  108. -metrics.address="{{ .Values.global.monitoring.gatewayHost }}:{{ .Values.global.monitoring.gatewayPort }}" \
  109. {{- end }}
  110. -volumeSizeLimitMB={{ .Values.master.volumeSizeLimitMB }} \
  111. {{- if .Values.master.disableHttp }}
  112. -disableHttp \
  113. {{- end }}
  114. {{- if .Values.master.pulseSeconds }}
  115. -pulseSeconds={{ .Values.master.pulseSeconds }} \
  116. {{- end }}
  117. {{- if .Values.master.garbageThreshold }}
  118. -garbageThreshold={{ .Values.master.garbageThreshold }} \
  119. {{- end }}
  120. {{- if .Values.master.metricsIntervalSec }}
  121. -metrics.intervalSeconds={{ .Values.master.metricsIntervalSec }} \
  122. {{- end }}
  123. -ip=${POD_NAME}.${SEAWEEDFS_FULLNAME}-master \
  124. -peers={{ 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 }}
  125. volumeMounts:
  126. - name : data-{{ .Release.Namespace }}
  127. mountPath: /data
  128. - name: seaweedfs-master-log-volume
  129. mountPath: "/logs/"
  130. {{- if .Values.global.enableSecurity }}
  131. - name: security-config
  132. readOnly: true
  133. mountPath: /etc/seaweedfs/security.toml
  134. subPath: security.toml
  135. - name: ca-cert
  136. readOnly: true
  137. mountPath: /usr/local/share/ca-certificates/ca/
  138. - name: master-cert
  139. readOnly: true
  140. mountPath: /usr/local/share/ca-certificates/master/
  141. - name: volume-cert
  142. readOnly: true
  143. mountPath: /usr/local/share/ca-certificates/volume/
  144. - name: filer-cert
  145. readOnly: true
  146. mountPath: /usr/local/share/ca-certificates/filer/
  147. - name: client-cert
  148. readOnly: true
  149. mountPath: /usr/local/share/ca-certificates/client/
  150. {{- end }}
  151. {{ tpl .Values.master.extraVolumeMounts . | nindent 12 | trim }}
  152. ports:
  153. - containerPort: {{ .Values.master.port }}
  154. name: swfs-master
  155. - containerPort: {{ .Values.master.grpcPort }}
  156. #name: swfs-master-grpc
  157. readinessProbe:
  158. httpGet:
  159. path: /cluster/status
  160. port: {{ .Values.master.port }}
  161. scheme: HTTP
  162. initialDelaySeconds: 10
  163. periodSeconds: 45
  164. successThreshold: 2
  165. failureThreshold: 100
  166. timeoutSeconds: 10
  167. livenessProbe:
  168. httpGet:
  169. path: /cluster/status
  170. port: {{ .Values.master.port }}
  171. scheme: HTTP
  172. initialDelaySeconds: 20
  173. periodSeconds: 30
  174. successThreshold: 1
  175. failureThreshold: 4
  176. timeoutSeconds: 10
  177. {{- if .Values.master.resources }}
  178. resources:
  179. {{ tpl .Values.master.resources . | nindent 12 | trim }}
  180. {{- end }}
  181. volumes:
  182. - name: seaweedfs-master-log-volume
  183. hostPath:
  184. path: /storage/logs/seaweedfs/master
  185. type: DirectoryOrCreate
  186. - name: data-{{ .Release.Namespace }}
  187. hostPath:
  188. path: /ssd/seaweed-master/
  189. type: DirectoryOrCreate
  190. {{- if .Values.global.enableSecurity }}
  191. - name: security-config
  192. configMap:
  193. name: {{ template "seaweedfs.name" . }}-security-config
  194. - name: ca-cert
  195. secret:
  196. secretName: {{ template "seaweedfs.name" . }}-ca-cert
  197. - name: master-cert
  198. secret:
  199. secretName: {{ template "seaweedfs.name" . }}-master-cert
  200. - name: volume-cert
  201. secret:
  202. secretName: {{ template "seaweedfs.name" . }}-volume-cert
  203. - name: filer-cert
  204. secret:
  205. secretName: {{ template "seaweedfs.name" . }}-filer-cert
  206. - name: client-cert
  207. secret:
  208. secretName: {{ template "seaweedfs.name" . }}-client-cert
  209. {{- end }}
  210. {{ tpl .Values.master.extraVolumes . | indent 8 | trim }}
  211. {{- if .Values.master.nodeSelector }}
  212. nodeSelector:
  213. {{ tpl .Values.master.nodeSelector . | indent 8 | trim }}
  214. {{- end }}
  215. {{/* volumeClaimTemplates:*/}}
  216. {{/* - metadata:*/}}
  217. {{/* name: data-{{ .Release.Namespace }}*/}}
  218. {{/* spec:*/}}
  219. {{/* accessModes:*/}}
  220. {{/* - ReadWriteOnce*/}}
  221. {{/* resources:*/}}
  222. {{/* requests:*/}}
  223. {{/* storage: {{ .Values.master.storage }}*/}}
  224. {{/* {{- if .Values.master.storageClass }}*/}}
  225. {{/* storageClassName: {{ .Values.master.storageClass }}*/}}
  226. {{/* {{- end }}*/}}
  227. {{- end }}