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.

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