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.

194 lines
6.9 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 -logdir=/logs \
  76. {{- if .Values.s3.loggingOverrideLevel }}
  77. -v={{ .Values.s3.loggingOverrideLevel }} \
  78. {{- else }}
  79. -v={{ .Values.global.loggingLevel }} \
  80. {{- end }}
  81. s3 \
  82. -port={{ .Values.s3.port }} \
  83. {{- if .Values.s3.metricsPort }}
  84. -metricsPort {{ .Values.s3.metricsPort }} \
  85. {{- end }}
  86. {{- if .Values.global.enableSecurity }}
  87. -cert.file=/usr/local/share/ca-certificates/client/tls.crt \
  88. -key.file=/usr/local/share/ca-certificates/client/tls.key \
  89. {{- end }}
  90. {{- if .Values.s3.domainName }}
  91. -domainName={{ .Values.s3.domainName }} \
  92. {{- end }}
  93. {{- if .Values.s3.allowEmptyFolder }}
  94. -allowEmptyFolder={{ .Values.s3.allowEmptyFolder }} \
  95. {{- end }}
  96. {{- if .Values.s3.enableAuth }}
  97. -config=/etc/sw/seaweedfs_s3_config \
  98. {{- end }}
  99. {{- if .Values.s3.auditLogConfig }}
  100. -auditLogConfig=/etc/sw/s3_auditLogConfig.json \
  101. {{- end }}
  102. -filer={{ template "seaweedfs.name" . }}-filer-client:{{ .Values.filer.port }}
  103. volumeMounts:
  104. - name: logs
  105. mountPath: "/logs/"
  106. - mountPath: /etc/sw
  107. name: config-users
  108. readOnly: true
  109. {{- if .Values.global.enableSecurity }}
  110. - name: security-config
  111. readOnly: true
  112. mountPath: /etc/seaweedfs/security.toml
  113. subPath: security.toml
  114. - name: ca-cert
  115. readOnly: true
  116. mountPath: /usr/local/share/ca-certificates/ca/
  117. - name: master-cert
  118. readOnly: true
  119. mountPath: /usr/local/share/ca-certificates/master/
  120. - name: volume-cert
  121. readOnly: true
  122. mountPath: /usr/local/share/ca-certificates/volume/
  123. - name: filer-cert
  124. readOnly: true
  125. mountPath: /usr/local/share/ca-certificates/filer/
  126. - name: client-cert
  127. readOnly: true
  128. mountPath: /usr/local/share/ca-certificates/client/
  129. {{- end }}
  130. {{ tpl .Values.s3.extraVolumeMounts . | nindent 12 | trim }}
  131. ports:
  132. - containerPort: {{ .Values.s3.port }}
  133. name: swfs-s3
  134. readinessProbe:
  135. httpGet:
  136. path: /status
  137. port: {{ .Values.s3.port }}
  138. scheme: HTTP
  139. initialDelaySeconds: 15
  140. periodSeconds: 15
  141. successThreshold: 1
  142. failureThreshold: 100
  143. timeoutSeconds: 10
  144. livenessProbe:
  145. httpGet:
  146. path: /status
  147. port: {{ .Values.s3.port }}
  148. scheme: HTTP
  149. initialDelaySeconds: 20
  150. periodSeconds: 60
  151. successThreshold: 1
  152. failureThreshold: 20
  153. timeoutSeconds: 10
  154. {{- if .Values.s3.resources }}
  155. resources:
  156. {{ tpl .Values.s3.resources . | nindent 12 | trim }}
  157. {{- end }}
  158. volumes:
  159. - name: config-users
  160. secret:
  161. defaultMode: 420
  162. secretName: seaweedfs-s3-secret
  163. {{- if eq .Values.s3.logs.type "hostPath" }}
  164. - name: logs
  165. hostPath:
  166. path: /storage/logs/seaweedfs/s3
  167. type: DirectoryOrCreate
  168. {{- end }}
  169. {{- if .Values.global.enableSecurity }}
  170. - name: security-config
  171. configMap:
  172. name: {{ template "seaweedfs.name" . }}-security-config
  173. - name: ca-cert
  174. secret:
  175. secretName: {{ template "seaweedfs.name" . }}-ca-cert
  176. - name: master-cert
  177. secret:
  178. secretName: {{ template "seaweedfs.name" . }}-master-cert
  179. - name: volume-cert
  180. secret:
  181. secretName: {{ template "seaweedfs.name" . }}-volume-cert
  182. - name: filer-cert
  183. secret:
  184. secretName: {{ template "seaweedfs.name" . }}-filer-cert
  185. - name: client-cert
  186. secret:
  187. secretName: {{ template "seaweedfs.name" . }}-client-cert
  188. {{- end }}
  189. {{ tpl .Values.s3.extraVolumes . | indent 8 | trim }}
  190. {{- if .Values.s3.nodeSelector }}
  191. nodeSelector:
  192. {{ tpl .Values.s3.nodeSelector . | indent 8 | trim }}
  193. {{- end }}
  194. {{- end }}