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.

198 lines
7.0 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. {{- if .Values.s3.metricsPort }}
  135. - containerPort: {{ .Values.s3.metricsPort }}
  136. name: "metrics"
  137. {{- end }}
  138. readinessProbe:
  139. httpGet:
  140. path: /status
  141. port: {{ .Values.s3.port }}
  142. scheme: HTTP
  143. initialDelaySeconds: 15
  144. periodSeconds: 15
  145. successThreshold: 1
  146. failureThreshold: 100
  147. timeoutSeconds: 10
  148. livenessProbe:
  149. httpGet:
  150. path: /status
  151. port: {{ .Values.s3.port }}
  152. scheme: HTTP
  153. initialDelaySeconds: 20
  154. periodSeconds: 60
  155. successThreshold: 1
  156. failureThreshold: 20
  157. timeoutSeconds: 10
  158. {{- if .Values.s3.resources }}
  159. resources:
  160. {{ tpl .Values.s3.resources . | nindent 12 | trim }}
  161. {{- end }}
  162. volumes:
  163. - name: config-users
  164. secret:
  165. defaultMode: 420
  166. secretName: seaweedfs-s3-secret
  167. {{- if eq .Values.s3.logs.type "hostPath" }}
  168. - name: logs
  169. hostPath:
  170. path: /storage/logs/seaweedfs/s3
  171. type: DirectoryOrCreate
  172. {{- end }}
  173. {{- if .Values.global.enableSecurity }}
  174. - name: security-config
  175. configMap:
  176. name: {{ template "seaweedfs.name" . }}-security-config
  177. - name: ca-cert
  178. secret:
  179. secretName: {{ template "seaweedfs.name" . }}-ca-cert
  180. - name: master-cert
  181. secret:
  182. secretName: {{ template "seaweedfs.name" . }}-master-cert
  183. - name: volume-cert
  184. secret:
  185. secretName: {{ template "seaweedfs.name" . }}-volume-cert
  186. - name: filer-cert
  187. secret:
  188. secretName: {{ template "seaweedfs.name" . }}-filer-cert
  189. - name: client-cert
  190. secret:
  191. secretName: {{ template "seaweedfs.name" . }}-client-cert
  192. {{- end }}
  193. {{ tpl .Values.s3.extraVolumes . | indent 8 | trim }}
  194. {{- if .Values.s3.nodeSelector }}
  195. nodeSelector:
  196. {{ tpl .Values.s3.nodeSelector . | indent 8 | trim }}
  197. {{- end }}
  198. {{- end }}