cosi-deployment.yaml 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. {{- if .Values.cosi.enabled }}
  2. apiVersion: apps/v1
  3. kind: Deployment
  4. metadata:
  5. name: {{ template "seaweedfs.name" . }}-objectstorage-provisioner
  6. namespace: {{ .Release.Namespace }}
  7. labels:
  8. app.kubernetes.io/name: {{ template "seaweedfs.name" . }}
  9. helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
  10. app.kubernetes.io/managed-by: {{ .Release.Service }}
  11. app.kubernetes.io/instance: {{ .Release.Name }}
  12. app.kubernetes.io/component: objectstorage-provisioner
  13. spec:
  14. replicas: {{ .Values.cosi.replicas }}
  15. selector:
  16. matchLabels:
  17. app.kubernetes.io/name: {{ template "seaweedfs.name" . }}
  18. app.kubernetes.io/instance: {{ .Release.Name }}
  19. app.kubernetes.io/component: objectstorage-provisioner
  20. template:
  21. metadata:
  22. labels:
  23. app.kubernetes.io/name: {{ template "seaweedfs.name" . }}
  24. helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
  25. app.kubernetes.io/instance: {{ .Release.Name }}
  26. app.kubernetes.io/component: objectstorage-provisioner
  27. {{ with .Values.podLabels }}
  28. {{- toYaml . | nindent 8 }}
  29. {{- end }}
  30. {{- with .Values.cosi.podLabels }}
  31. {{- toYaml . | nindent 8 }}
  32. {{- end }}
  33. annotations:
  34. {{ with .Values.podAnnotations }}
  35. {{- toYaml . | nindent 8 }}
  36. {{- end }}
  37. {{- with .Values.cosi.podAnnotations }}
  38. {{- toYaml . | nindent 8 }}
  39. {{- end }}
  40. spec:
  41. restartPolicy: {{ default .Values.global.restartPolicy .Values.cosi.restartPolicy }}
  42. {{- if .Values.cosi.affinity }}
  43. affinity:
  44. {{ tpl .Values.cosi.affinity . | nindent 8 | trim }}
  45. {{- end }}
  46. {{- if .Values.cosi.topologySpreadConstraints }}
  47. topologySpreadConstraints:
  48. {{ tpl .Values.cosi.topologySpreadConstraint . | nindent 8 | trim }}
  49. {{- end }}
  50. {{- if .Values.cosi.tolerations }}
  51. tolerations:
  52. {{ tpl .Values.cosi.tolerations . | nindent 8 | trim }}
  53. {{- end }}
  54. {{- include "seaweedfs.imagePullSecrets" . | nindent 6 }}
  55. terminationGracePeriodSeconds: 10
  56. {{- if .Values.cosi.priorityClassName }}
  57. priorityClassName: {{ .Values.cosi.priorityClassName | quote }}
  58. {{- end }}
  59. enableServiceLinks: false
  60. serviceAccountName: {{ .Values.global.serviceAccountName }}-objectstorage-provisioner
  61. {{- if .Values.cosi.initContainers }}
  62. initContainers:
  63. {{ tpl .Values.cosi.initContainers . | nindent 8 | trim }}
  64. {{- end }}
  65. {{- if .Values.cosi.podSecurityContext.enabled }}
  66. securityContext: {{- omit .Values.cosi.podSecurityContext "enabled" | toYaml | nindent 8 }}
  67. {{- end }}
  68. containers:
  69. - name: seaweedfs-cosi-driver
  70. image: "{{ .Values.cosi.image }}"
  71. imagePullPolicy: {{ default "IfNotPresent" .Values.global.imagePullPolicy }}
  72. env:
  73. - name: DRIVERNAME
  74. value: "{{ .Values.cosi.driverName }}"
  75. - name: ENDPOINT
  76. {{- if .Values.cosi.endpoint }}
  77. value: "{{ .Values.cosi.endpoint }}"
  78. {{- else if .Values.s3.ingress.enabled }}
  79. value: "{{ printf "https://%s" .Values.s3.ingress.host }}"
  80. {{- else if .Values.s3.enabled }}
  81. value: "{{ printf "https://%s-s3.%s.svc" (include "seaweedfs.name" .) .Release.Namespace }}"
  82. {{- else }}
  83. value: "{{ printf "https://%s-filer.%s.svc" (include "seaweedfs.name" .) .Release.Namespace }}"
  84. {{- end }}
  85. {{- with .Values.cosi.region }}
  86. - name: REGION
  87. value: "{{ . }}"
  88. {{- end }}
  89. - name: SEAWEEDFS_FILER
  90. value: "{{ template "seaweedfs.name" . }}-filer:{{ .Values.filer.grpcPort }}"
  91. {{- if .Values.global.enableSecurity }}
  92. - name: WEED_GRPC_CLIENT_KEY
  93. value: /usr/local/share/ca-certificates/client/tls.key
  94. - name: WEED_GRPC_CLIENT_CERT
  95. value: /usr/local/share/ca-certificates/client/tls.crt
  96. - name: WEED_GRPC_CA
  97. value: /usr/local/share/ca-certificates/client/ca.crt
  98. {{- end }}
  99. {{- if .Values.cosi.extraEnvironmentVars }}
  100. {{- range $key, $value := .Values.cosi.extraEnvironmentVars }}
  101. - name: {{ $key }}
  102. {{- if kindIs "string" $value }}
  103. value: {{ $value | quote }}
  104. {{- else }}
  105. valueFrom:
  106. {{ toYaml $value | nindent 16 | trim }}
  107. {{- end -}}
  108. {{- end }}
  109. {{- end }}
  110. {{- if .Values.global.extraEnvironmentVars }}
  111. {{- range $key, $value := .Values.global.extraEnvironmentVars }}
  112. - name: {{ $key }}
  113. {{- if kindIs "string" $value }}
  114. value: {{ $value | quote }}
  115. {{- else }}
  116. valueFrom:
  117. {{ toYaml $value | nindent 16 | trim }}
  118. {{- end -}}
  119. {{- end }}
  120. {{- end }}
  121. volumeMounts:
  122. - mountPath: /var/lib/cosi
  123. name: socket
  124. {{- if .Values.cosi.enableAuth }}
  125. - mountPath: /etc/sw
  126. name: config-users
  127. readOnly: true
  128. {{- end }}
  129. {{- if .Values.global.enableSecurity }}
  130. - name: security-config
  131. readOnly: true
  132. mountPath: /etc/seaweedfs/security.toml
  133. subPath: security.toml
  134. - name: ca-cert
  135. readOnly: true
  136. mountPath: /usr/local/share/ca-certificates/ca/
  137. - name: master-cert
  138. readOnly: true
  139. mountPath: /usr/local/share/ca-certificates/master/
  140. - name: volume-cert
  141. readOnly: true
  142. mountPath: /usr/local/share/ca-certificates/volume/
  143. - name: filer-cert
  144. readOnly: true
  145. mountPath: /usr/local/share/ca-certificates/filer/
  146. - name: client-cert
  147. readOnly: true
  148. mountPath: /usr/local/share/ca-certificates/client/
  149. {{- end }}
  150. {{ tpl .Values.cosi.extraVolumeMounts . | nindent 12 | trim }}
  151. {{- with .Values.cosi.resources }}
  152. resources:
  153. {{- toYaml . | nindent 12 }}
  154. {{- end }}
  155. - name: seaweedfs-cosi-sidecar
  156. image: "{{ .Values.cosi.sidecar.image }}"
  157. imagePullPolicy: {{ default "IfNotPresent" .Values.global.imagePullPolicy }}
  158. args:
  159. - {{ printf "--v=%s" (default "5" .Values.cosi.sidecar.logLevel) }}
  160. env:
  161. - name: POD_NAMESPACE
  162. valueFrom:
  163. fieldRef:
  164. fieldPath: metadata.namespace
  165. volumeMounts:
  166. - mountPath: /var/lib/cosi
  167. name: socket
  168. {{- with .Values.cosi.sidecar.resources }}
  169. resources:
  170. {{- toYaml . | nindent 12 }}
  171. {{- end }}
  172. {{- if .Values.cosi.containerSecurityContext.enabled }}
  173. securityContext: {{- omit .Values.cosi.containerSecurityContext "enabled" | toYaml | nindent 12 }}
  174. {{- end }}
  175. {{- if .Values.cosi.sidecars }}
  176. {{- include "common.tplvalues.render" (dict "value" .Values.cosi.sidecars "context" $) | nindent 8 }}
  177. {{- end }}
  178. volumes:
  179. - name: socket
  180. emptyDir: {}
  181. {{- if .Values.cosi.enableAuth }}
  182. - name: config-users
  183. secret:
  184. defaultMode: 420
  185. {{- if .Values.cosi.existingConfigSecret }}
  186. secretName: {{ .Values.cosi.existingConfigSecret }}
  187. {{- else }}
  188. secretName: seaweedfs-s3-secret
  189. {{- end }}
  190. {{- end }}
  191. {{- if .Values.global.enableSecurity }}
  192. - name: security-config
  193. configMap:
  194. name: {{ template "seaweedfs.name" . }}-security-config
  195. - name: ca-cert
  196. secret:
  197. secretName: {{ template "seaweedfs.name" . }}-ca-cert
  198. - name: master-cert
  199. secret:
  200. secretName: {{ template "seaweedfs.name" . }}-master-cert
  201. - name: volume-cert
  202. secret:
  203. secretName: {{ template "seaweedfs.name" . }}-volume-cert
  204. - name: filer-cert
  205. secret:
  206. secretName: {{ template "seaweedfs.name" . }}-filer-cert
  207. - name: client-cert
  208. secret:
  209. secretName: {{ template "seaweedfs.name" . }}-client-cert
  210. {{- end }}
  211. {{ tpl .Values.cosi.extraVolumes . | indent 8 | trim }}
  212. {{- if .Values.cosi.nodeSelector }}
  213. nodeSelector:
  214. {{ tpl .Values.cosi.nodeSelector . | indent 8 | trim }}
  215. {{- end }}
  216. {{- end }}