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.

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