deployment.yaml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. {{- /*
  2. Copyright VMware, Inc.
  3. SPDX-License-Identifier: APACHE-2.0
  4. */}}
  5. {{- if (eq .Values.mode "standalone") }}
  6. apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
  7. kind: Deployment
  8. metadata:
  9. name: {{ include "common.names.fullname" . }}
  10. namespace: {{ include "common.names.namespace" . | quote }}
  11. labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
  12. {{- if .Values.commonAnnotations }}
  13. annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  14. {{- end }}
  15. spec:
  16. {{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.podLabels .Values.commonLabels ) "context" . ) }}
  17. selector:
  18. matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
  19. {{- if .Values.deployment.updateStrategy }}
  20. strategy: {{- toYaml .Values.deployment.updateStrategy | nindent 4 }}
  21. {{- end }}
  22. template:
  23. metadata:
  24. labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }}
  25. {{- if or .Values.podAnnotations (include "minio.createSecret" .) }}
  26. annotations:
  27. {{- if (include "minio.createSecret" .) }}
  28. checksum/credentials-secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
  29. {{- end }}
  30. {{- if .Values.podAnnotations }}
  31. {{- include "common.tplvalues.render" ( dict "value" .Values.podAnnotations "context" $) | nindent 8 }}
  32. {{- end }}
  33. {{- end }}
  34. spec:
  35. {{- include "minio.imagePullSecrets" . | nindent 6 }}
  36. {{- if .Values.schedulerName }}
  37. schedulerName: {{ .Values.schedulerName }}
  38. {{- end }}
  39. serviceAccountName: {{ template "minio.serviceAccountName" . }}
  40. {{- if .Values.affinity }}
  41. affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }}
  42. {{- else }}
  43. affinity:
  44. podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "customLabels" $podLabels "context" $) | nindent 10 }}
  45. podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "customLabels" $podLabels "context" $) | nindent 10 }}
  46. nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }}
  47. {{- end }}
  48. {{- if .Values.nodeSelector }}
  49. nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }}
  50. {{- end }}
  51. {{- if .Values.tolerations }}
  52. tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }}
  53. {{- end }}
  54. {{- if .Values.topologySpreadConstraints }}
  55. topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.topologySpreadConstraints "context" $) | nindent 8 }}
  56. {{- end }}
  57. {{- if .Values.priorityClassName }}
  58. priorityClassName: {{ .Values.priorityClassName | quote }}
  59. {{- end }}
  60. automountServiceAccountToken: {{ .Values.automountServiceAccountToken }}
  61. {{- if .Values.hostAliases }}
  62. hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }}
  63. {{- end }}
  64. {{- if .Values.podSecurityContext.enabled }}
  65. securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }}
  66. {{- end }}
  67. {{- if .Values.terminationGracePeriodSeconds }}
  68. terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
  69. {{- end }}
  70. {{- if or .Values.initContainers (and .Values.volumePermissions.enabled .Values.persistence.enabled) }}
  71. initContainers:
  72. {{- if .Values.initContainers }}
  73. {{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }}
  74. {{- end }}
  75. {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }}
  76. - name: volume-permissions
  77. image: {{ template "minio.volumePermissions.image" . }}
  78. imagePullPolicy: {{ default "" .Values.volumePermissions.image.pullPolicy | quote }}
  79. command:
  80. - /bin/bash
  81. - -ec
  82. - |
  83. chown -R {{ .Values.containerSecurityContext.runAsUser }}:{{ .Values.podSecurityContext.fsGroup }} {{ .Values.persistence.mountPath }}
  84. securityContext: {{- .Values.volumePermissions.containerSecurityContext | toYaml | nindent 12 }}
  85. {{- if .Values.volumePermissions.resources }}
  86. resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
  87. {{- end }}
  88. volumeMounts:
  89. - name: data
  90. mountPath: {{ .Values.persistence.mountPath }}
  91. {{- end }}
  92. {{- end }}
  93. containers:
  94. - name: minio
  95. image: {{ include "minio.image" . }}
  96. imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
  97. {{- if .Values.containerSecurityContext.enabled }}
  98. securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
  99. {{- end }}
  100. {{- if .Values.command }}
  101. command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }}
  102. {{- end }}
  103. {{- if .Values.args }}
  104. args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }}
  105. {{- end }}
  106. env:
  107. - name: BITNAMI_DEBUG
  108. value: {{ ternary "true" "false" .Values.image.debug | quote }}
  109. - name: MINIO_SCHEME
  110. value: {{ ternary "https" "http" .Values.tls.enabled | quote }}
  111. - name: MINIO_FORCE_NEW_KEYS
  112. value: {{ ternary "yes" "no" .Values.auth.forceNewKeys | quote }}
  113. {{- if .Values.auth.useCredentialsFiles }}
  114. - name: MINIO_ROOT_USER_FILE
  115. value: "/opt/bitnami/minio/secrets/root-user"
  116. {{- else }}
  117. - name: MINIO_ROOT_USER
  118. valueFrom:
  119. secretKeyRef:
  120. name: {{ include "minio.secretName" . }}
  121. key: root-user
  122. {{- end }}
  123. {{- if .Values.auth.useCredentialsFiles }}
  124. - name: MINIO_ROOT_PASSWORD_FILE
  125. value: "/opt/bitnami/minio/secrets/root-password"
  126. {{- else }}
  127. - name: MINIO_ROOT_PASSWORD
  128. valueFrom:
  129. secretKeyRef:
  130. name: {{ include "minio.secretName" . }}
  131. key: root-password
  132. {{- end }}
  133. {{- if .Values.defaultBuckets }}
  134. - name: MINIO_DEFAULT_BUCKETS
  135. value: {{ .Values.defaultBuckets }}
  136. {{- end }}
  137. - name: MINIO_BROWSER
  138. value: {{ ternary "off" "on" .Values.disableWebUI | quote }}
  139. - name: MINIO_PROMETHEUS_AUTH_TYPE
  140. value: {{ .Values.metrics.prometheusAuthType | quote }}
  141. - name: MINIO_CONSOLE_PORT_NUMBER
  142. value: {{ .Values.containerPorts.console | quote }}
  143. {{- if .Values.tls.mountPath }}
  144. - name: MINIO_CERTS_DIR
  145. value: {{ .Values.tls.mountPath | quote }}
  146. {{- end }}
  147. {{- if .Values.extraEnvVars }}
  148. {{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }}
  149. {{- end }}
  150. envFrom:
  151. {{- if .Values.extraEnvVarsCM }}
  152. - configMapRef:
  153. name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsCM "context" $) }}
  154. {{- end }}
  155. {{- if .Values.extraEnvVarsSecret }}
  156. - secretRef:
  157. name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }}
  158. {{- end }}
  159. ports:
  160. - name: minio-api
  161. containerPort: {{ .Values.containerPorts.api }}
  162. protocol: TCP
  163. - name: minio-console
  164. containerPort: {{ .Values.containerPorts.console }}
  165. protocol: TCP
  166. {{- if .Values.customLivenessProbe }}
  167. livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }}
  168. {{- else if .Values.livenessProbe.enabled }}
  169. livenessProbe:
  170. httpGet:
  171. path: /minio/health/live
  172. port: minio-api
  173. scheme: {{ ternary "HTTPS" "HTTP" .Values.tls.enabled | quote }}
  174. initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
  175. periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
  176. timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
  177. successThreshold: {{ .Values.livenessProbe.successThreshold }}
  178. failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
  179. {{- end }}
  180. {{- if .Values.customReadinessProbe }}
  181. readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }}
  182. {{- else if .Values.readinessProbe.enabled }}
  183. readinessProbe:
  184. tcpSocket:
  185. port: minio-api
  186. initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
  187. periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
  188. timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
  189. successThreshold: {{ .Values.readinessProbe.successThreshold }}
  190. failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
  191. {{- end }}
  192. {{- if .Values.customStartupProbe }}
  193. startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customStartupProbe "context" $) | nindent 12 }}
  194. {{- else if .Values.startupProbe.enabled }}
  195. startupProbe:
  196. tcpSocket:
  197. port: minio-console
  198. initialDelaySeconds: {{ .Values.startupProbe.initialDelaySeconds }}
  199. periodSeconds: {{ .Values.startupProbe.periodSeconds }}
  200. timeoutSeconds: {{ .Values.startupProbe.timeoutSeconds }}
  201. successThreshold: {{ .Values.startupProbe.successThreshold }}
  202. failureThreshold: {{ .Values.startupProbe.failureThreshold }}
  203. {{- end }}
  204. {{- if .Values.resources }}
  205. resources: {{- toYaml .Values.resources | nindent 12 }}
  206. {{- end }}
  207. {{- if .Values.lifecycleHooks }}
  208. lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }}
  209. {{- end }}
  210. volumeMounts:
  211. {{- if .Values.auth.useCredentialsFiles }}
  212. - name: minio-credentials
  213. mountPath: /opt/bitnami/minio/secrets/
  214. {{- end }}
  215. - name: data
  216. mountPath: {{ .Values.persistence.mountPath }}
  217. {{- if .Values.tls.enabled }}
  218. - name: minio-certs
  219. mountPath: {{ default "/certs" .Values.tls.mountPath }}
  220. {{- end }}
  221. {{- if .Values.extraVolumeMounts }}
  222. {{- include "common.tplvalues.render" (dict "value" .Values.extraVolumeMounts "context" $) | nindent 12 }}
  223. {{- end }}
  224. {{- if .Values.sidecars }}
  225. {{- include "common.tplvalues.render" (dict "value" .Values.sidecars "context" $) | nindent 8 }}
  226. {{- end }}
  227. volumes:
  228. {{- if .Values.auth.useCredentialsFiles }}
  229. - name: minio-credentials
  230. secret:
  231. secretName: {{ include "minio.secretName" . }}
  232. {{- end }}
  233. - name: data
  234. {{- if .Values.persistence.enabled }}
  235. persistentVolumeClaim:
  236. claimName: {{ include "minio.claimName" . }}
  237. {{- else }}
  238. emptyDir: {}
  239. {{- end }}
  240. {{- if .Values.tls.enabled }}
  241. - name: minio-certs
  242. secret:
  243. secretName: {{ include "minio.tlsSecretName" . }}
  244. items:
  245. - key: tls.crt
  246. path: public.crt
  247. - key: tls.key
  248. path: private.key
  249. - key: ca.crt
  250. path: CAs/public.crt
  251. {{- end }}
  252. {{- if .Values.extraVolumes }}
  253. {{- include "common.tplvalues.render" (dict "value" .Values.extraVolumes "context" $) | nindent 8 }}
  254. {{- end }}
  255. {{- end }}