s3-deployment.yaml 6.8 KB

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