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.

190 lines
6.7 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. containers:
  43. - name: seaweedfs
  44. image: {{ template "s3.image" . }}
  45. imagePullPolicy: {{ default "IfNotPresent" .Values.global.imagePullPolicy }}
  46. env:
  47. - name: POD_IP
  48. valueFrom:
  49. fieldRef:
  50. fieldPath: status.podIP
  51. - name: POD_NAME
  52. valueFrom:
  53. fieldRef:
  54. fieldPath: metadata.name
  55. - name: NAMESPACE
  56. valueFrom:
  57. fieldRef:
  58. fieldPath: metadata.namespace
  59. - name: SEAWEEDFS_FULLNAME
  60. value: "{{ template "seaweedfs.name" . }}"
  61. {{- if .Values.global.extraEnvironmentVars }}
  62. {{- range $key, $value := .Values.global.extraEnvironmentVars }}
  63. - name: {{ $key }}
  64. value: {{ $value | quote }}
  65. {{- end }}
  66. {{- end }}
  67. command:
  68. - "/bin/sh"
  69. - "-ec"
  70. - |
  71. exec /usr/bin/weed -logdir=/logs \
  72. {{- if .Values.s3.loggingOverrideLevel }}
  73. -v={{ .Values.s3.loggingOverrideLevel }} \
  74. {{- else }}
  75. -v={{ .Values.global.loggingLevel }} \
  76. {{- end }}
  77. s3 \
  78. -port={{ .Values.s3.port }} \
  79. {{- if .Values.s3.metricsPort }}
  80. -metricsPort {{ .Values.s3.metricsPort }} \
  81. {{- end }}
  82. {{- if .Values.global.enableSecurity }}
  83. -cert.file=/usr/local/share/ca-certificates/client/tls.crt \
  84. -key.file=/usr/local/share/ca-certificates/client/tls.key \
  85. {{- end }}
  86. {{- if .Values.s3.domainName }}
  87. -domainName={{ .Values.s3.domainName }} \
  88. {{- end }}
  89. {{- if .Values.s3.allowEmptyFolder }}
  90. -allowEmptyFolder={{ .Values.s3.allowEmptyFolder }} \
  91. {{- end }}
  92. {{- if .Values.s3.enableAuth }}
  93. -config=/etc/sw/seaweedfs_s3_config \
  94. {{- end }}
  95. {{- if .Values.s3.auditLogConfig }}
  96. -auditLogConfig=/etc/sw/s3_auditLogConfig.json \
  97. {{- end }}
  98. -filer={{ template "seaweedfs.name" . }}-filer-client:{{ .Values.filer.port }}
  99. volumeMounts:
  100. - name: logs
  101. mountPath: "/logs/"
  102. - mountPath: /etc/sw
  103. name: config-users
  104. readOnly: true
  105. {{- if .Values.global.enableSecurity }}
  106. - name: security-config
  107. readOnly: true
  108. mountPath: /etc/seaweedfs/security.toml
  109. subPath: security.toml
  110. - name: ca-cert
  111. readOnly: true
  112. mountPath: /usr/local/share/ca-certificates/ca/
  113. - name: master-cert
  114. readOnly: true
  115. mountPath: /usr/local/share/ca-certificates/master/
  116. - name: volume-cert
  117. readOnly: true
  118. mountPath: /usr/local/share/ca-certificates/volume/
  119. - name: filer-cert
  120. readOnly: true
  121. mountPath: /usr/local/share/ca-certificates/filer/
  122. - name: client-cert
  123. readOnly: true
  124. mountPath: /usr/local/share/ca-certificates/client/
  125. {{- end }}
  126. {{ tpl .Values.s3.extraVolumeMounts . | nindent 12 | trim }}
  127. ports:
  128. - containerPort: {{ .Values.s3.port }}
  129. name: swfs-s3
  130. readinessProbe:
  131. httpGet:
  132. path: /status
  133. port: {{ .Values.s3.port }}
  134. scheme: HTTP
  135. initialDelaySeconds: 15
  136. periodSeconds: 15
  137. successThreshold: 1
  138. failureThreshold: 100
  139. timeoutSeconds: 10
  140. livenessProbe:
  141. httpGet:
  142. path: /status
  143. port: {{ .Values.s3.port }}
  144. scheme: HTTP
  145. initialDelaySeconds: 20
  146. periodSeconds: 60
  147. successThreshold: 1
  148. failureThreshold: 20
  149. timeoutSeconds: 10
  150. {{- if .Values.s3.resources }}
  151. resources:
  152. {{ tpl .Values.s3.resources . | nindent 12 | trim }}
  153. {{- end }}
  154. volumes:
  155. - name: config-users
  156. secret:
  157. defaultMode: 420
  158. secretName: seaweedfs-s3-secret
  159. {{- if eq .Values.s3.logs.type "hostPath" }}
  160. - name: logs
  161. hostPath:
  162. path: /storage/logs/seaweedfs/s3
  163. type: DirectoryOrCreate
  164. {{- end }}
  165. {{- if .Values.global.enableSecurity }}
  166. - name: security-config
  167. configMap:
  168. name: {{ template "seaweedfs.name" . }}-security-config
  169. - name: ca-cert
  170. secret:
  171. secretName: {{ template "seaweedfs.name" . }}-ca-cert
  172. - name: master-cert
  173. secret:
  174. secretName: {{ template "seaweedfs.name" . }}-master-cert
  175. - name: volume-cert
  176. secret:
  177. secretName: {{ template "seaweedfs.name" . }}-volume-cert
  178. - name: filer-cert
  179. secret:
  180. secretName: {{ template "seaweedfs.name" . }}-filer-cert
  181. - name: client-cert
  182. secret:
  183. secretName: {{ template "seaweedfs.name" . }}-client-cert
  184. {{- end }}
  185. {{ tpl .Values.s3.extraVolumes . | indent 8 | trim }}
  186. {{- if .Values.s3.nodeSelector }}
  187. nodeSelector:
  188. {{ tpl .Values.s3.nodeSelector . | indent 8 | trim }}
  189. {{- end }}
  190. {{- end }}