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.

204 lines
7.3 KiB

  1. {{- if .Values.s3.enabled }}
  2. apiVersion: apps/v1
  3. kind: Deployment
  4. metadata:
  5. name: {{ template "seaweedfs.name" . }}-s3
  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. replicas: {{ .Values.s3.replicas }}
  14. selector:
  15. matchLabels:
  16. app: {{ template "seaweedfs.name" . }}
  17. chart: {{ template "seaweedfs.chart" . }}
  18. release: {{ .Release.Name }}
  19. component: s3
  20. template:
  21. metadata:
  22. labels:
  23. app: {{ template "seaweedfs.name" . }}
  24. chart: {{ template "seaweedfs.chart" . }}
  25. release: {{ .Release.Name }}
  26. component: s3
  27. spec:
  28. restartPolicy: {{ default .Values.global.restartPolicy .Values.s3.restartPolicy }}
  29. {{- if .Values.s3.tolerations }}
  30. tolerations:
  31. {{ tpl .Values.s3.tolerations . | nindent 8 | trim }}
  32. {{- end }}
  33. {{- if .Values.global.imagePullSecrets }}
  34. imagePullSecrets:
  35. - name: {{ .Values.global.imagePullSecrets }}
  36. {{- end }}
  37. terminationGracePeriodSeconds: 10
  38. {{- if .Values.s3.priorityClassName }}
  39. priorityClassName: {{ .Values.s3.priorityClassName | quote }}
  40. {{- end }}
  41. enableServiceLinks: false
  42. {{- if .Values.s3.initContainers }}
  43. initContainers:
  44. {{ tpl .Values.s3.initContainers . | nindent 8 | trim }}
  45. {{- end }}
  46. containers:
  47. - name: seaweedfs
  48. image: {{ template "s3.image" . }}
  49. imagePullPolicy: {{ default "IfNotPresent" .Values.global.imagePullPolicy }}
  50. env:
  51. - name: POD_IP
  52. valueFrom:
  53. fieldRef:
  54. fieldPath: status.podIP
  55. - name: POD_NAME
  56. valueFrom:
  57. fieldRef:
  58. fieldPath: metadata.name
  59. - name: NAMESPACE
  60. valueFrom:
  61. fieldRef:
  62. fieldPath: metadata.namespace
  63. - name: SEAWEEDFS_FULLNAME
  64. value: "{{ template "seaweedfs.name" . }}"
  65. {{- if .Values.global.extraEnvironmentVars }}
  66. {{- range $key, $value := .Values.global.extraEnvironmentVars }}
  67. - name: {{ $key }}
  68. value: {{ $value | quote }}
  69. {{- end }}
  70. {{- end }}
  71. command:
  72. - "/bin/sh"
  73. - "-ec"
  74. - |
  75. exec /usr/bin/weed \
  76. {{- if eq .Values.s3.logs.type "hostPath" }}
  77. -logdir=/logs \
  78. {{- else }}
  79. -logtostderr=true \
  80. {{- end }}
  81. {{- if .Values.s3.loggingOverrideLevel }}
  82. -v={{ .Values.s3.loggingOverrideLevel }} \
  83. {{- else }}
  84. -v={{ .Values.global.loggingLevel }} \
  85. {{- end }}
  86. s3 \
  87. -ip.bind={{ .Values.s3.bindAddress }} \
  88. -port={{ .Values.s3.port }} \
  89. {{- if .Values.s3.metricsPort }}
  90. -metricsPort {{ .Values.s3.metricsPort }} \
  91. {{- end }}
  92. {{- if .Values.global.enableSecurity }}
  93. -cert.file=/usr/local/share/ca-certificates/client/tls.crt \
  94. -key.file=/usr/local/share/ca-certificates/client/tls.key \
  95. {{- end }}
  96. {{- if .Values.s3.domainName }}
  97. -domainName={{ .Values.s3.domainName }} \
  98. {{- end }}
  99. {{- if .Values.s3.allowEmptyFolder }}
  100. -allowEmptyFolder={{ .Values.s3.allowEmptyFolder }} \
  101. {{- end }}
  102. {{- if .Values.s3.enableAuth }}
  103. -config=/etc/sw/seaweedfs_s3_config \
  104. {{- end }}
  105. {{- if .Values.s3.auditLogConfig }}
  106. -auditLogConfig=/etc/sw/s3_auditLogConfig.json \
  107. {{- end }}
  108. -filer={{ template "seaweedfs.name" . }}-filer-client:{{ .Values.filer.port }}
  109. volumeMounts:
  110. - name: logs
  111. mountPath: "/logs/"
  112. - mountPath: /etc/sw
  113. name: config-users
  114. readOnly: true
  115. {{- if .Values.global.enableSecurity }}
  116. - name: security-config
  117. readOnly: true
  118. mountPath: /etc/seaweedfs/security.toml
  119. subPath: security.toml
  120. - name: ca-cert
  121. readOnly: true
  122. mountPath: /usr/local/share/ca-certificates/ca/
  123. - name: master-cert
  124. readOnly: true
  125. mountPath: /usr/local/share/ca-certificates/master/
  126. - name: volume-cert
  127. readOnly: true
  128. mountPath: /usr/local/share/ca-certificates/volume/
  129. - name: filer-cert
  130. readOnly: true
  131. mountPath: /usr/local/share/ca-certificates/filer/
  132. - name: client-cert
  133. readOnly: true
  134. mountPath: /usr/local/share/ca-certificates/client/
  135. {{- end }}
  136. {{ tpl .Values.s3.extraVolumeMounts . | nindent 12 | trim }}
  137. ports:
  138. - containerPort: {{ .Values.s3.port }}
  139. name: swfs-s3
  140. {{- if .Values.s3.metricsPort }}
  141. - containerPort: {{ .Values.s3.metricsPort }}
  142. name: "metrics"
  143. {{- end }}
  144. readinessProbe:
  145. httpGet:
  146. path: /status
  147. port: {{ .Values.s3.port }}
  148. scheme: HTTP
  149. initialDelaySeconds: 15
  150. periodSeconds: 15
  151. successThreshold: 1
  152. failureThreshold: 100
  153. timeoutSeconds: 10
  154. livenessProbe:
  155. httpGet:
  156. path: /status
  157. port: {{ .Values.s3.port }}
  158. scheme: HTTP
  159. initialDelaySeconds: 20
  160. periodSeconds: 60
  161. successThreshold: 1
  162. failureThreshold: 20
  163. timeoutSeconds: 10
  164. {{- if .Values.s3.resources }}
  165. resources:
  166. {{ tpl .Values.s3.resources . | nindent 12 | trim }}
  167. {{- end }}
  168. volumes:
  169. - name: config-users
  170. secret:
  171. defaultMode: 420
  172. secretName: seaweedfs-s3-secret
  173. {{- if eq .Values.s3.logs.type "hostPath" }}
  174. - name: logs
  175. hostPath:
  176. path: {{ .Values.s3.logs.hostPathPrefix }}/logs/seaweedfs/s3
  177. type: DirectoryOrCreate
  178. {{- end }}
  179. {{- if .Values.global.enableSecurity }}
  180. - name: security-config
  181. configMap:
  182. name: {{ template "seaweedfs.name" . }}-security-config
  183. - name: ca-cert
  184. secret:
  185. secretName: {{ template "seaweedfs.name" . }}-ca-cert
  186. - name: master-cert
  187. secret:
  188. secretName: {{ template "seaweedfs.name" . }}-master-cert
  189. - name: volume-cert
  190. secret:
  191. secretName: {{ template "seaweedfs.name" . }}-volume-cert
  192. - name: filer-cert
  193. secret:
  194. secretName: {{ template "seaweedfs.name" . }}-filer-cert
  195. - name: client-cert
  196. secret:
  197. secretName: {{ template "seaweedfs.name" . }}-client-cert
  198. {{- end }}
  199. {{ tpl .Values.s3.extraVolumes . | indent 8 | trim }}
  200. {{- if .Values.s3.nodeSelector }}
  201. nodeSelector:
  202. {{ tpl .Values.s3.nodeSelector . | indent 8 | trim }}
  203. {{- end }}
  204. {{- end }}