deployment.yaml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. {{ include "common.storage.hostPathValidate" .Values }}
  2. {{ $logsearchValues := (. | mustDeepCopy) }}
  3. {{ $_ := set $logsearchValues "common" (dict "nameSuffix" (include "logsearchapi.nameSuffix" .)) }}
  4. apiVersion: {{ template "common.capabilities.deployment.apiVersion" . }}
  5. kind: Deployment
  6. metadata:
  7. name: {{ template "common.names.fullname" . }}-minio
  8. labels:
  9. app: {{ template "common.names.name" . }}
  10. release: {{ .Release.Name }}
  11. app.kubernetes.io/name: {{ template "common.names.name" . }}
  12. app.kubernetes.io/instance: {{ .Release.Name }}
  13. annotations:
  14. rollme: {{ randAlphaNum 5 | quote }}
  15. spec:
  16. replicas: {{ (default 1 .Values.replicas) }}
  17. strategy:
  18. type: {{ (default "Recreate" .Values.updateStrategy ) }}
  19. selector:
  20. matchLabels:
  21. app: {{ template "common.names.name" . }}
  22. release: {{ .Release.Name }}
  23. app.kubernetes.io/name: {{ template "common.names.name" . }}
  24. app.kubernetes.io/instance: {{ .Release.Name }}
  25. template:
  26. metadata:
  27. name: {{ template "common.names.fullname" . }}
  28. labels:
  29. {{- include "common.labels.selectorLabels" . | nindent 8 }}
  30. annotations: {{ include "common.annotations" . | nindent 8 }}
  31. spec:
  32. securityContext:
  33. runAsUser: {{ .Values.runAsUser }}
  34. runAsGroup: {{ .Values.runAsGroup }}
  35. serviceAccountName: {{ include "common.names.serviceAccountName" . | quote }}
  36. hostNetwork: {{ include "minio.hostNetworking" . }}
  37. {{ if .Values.logsearchapi.enabled }}
  38. initContainers:
  39. - name: {{ .Chart.Name }}-waitapi
  40. image: alpine/curl
  41. imagePullPolicy: {{ .Values.image.pullPolicy }}
  42. env: {{ include "logsearchapiInit.envVariableConfiguration" $logsearchValues | nindent 10 }}
  43. command:
  44. - sh
  45. - -c
  46. - "until curl --silent $apiURL/status; do sleep 2; done"
  47. {{ end }}
  48. containers:
  49. - name: {{ .Chart.Name }}
  50. {{ include "common.resources.limitation" . | nindent 10 }}
  51. {{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
  52. {{ if hasKey .Values "appVolumeMounts" }}
  53. volumeMounts: {{ include "common.storage.configureAppVolumeMountsInContainer" .Values | nindent 12 }}
  54. {{ else }}
  55. volumeMounts:
  56. {{ end }}
  57. {{- include "minio.tlsKeysVolumeMount" . | nindent 12 }}
  58. {{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
  59. - name: extrappvolume-{{ $index }}
  60. mountPath: {{ $hostPathConfiguration.mountPath }}
  61. {{ end }}
  62. command:
  63. - "/bin/sh"
  64. - "-ce"
  65. - {{ include "minio.commandArgs" . }}
  66. ports:
  67. - name: api
  68. containerPort: {{ .Values.service.nodePort | int }}
  69. - name: console
  70. containerPort: {{ .Values.service.consolePort | int }}
  71. readinessProbe:
  72. httpGet:
  73. path: /minio/health/live
  74. port: {{ .Values.service.consolePort | int }}
  75. scheme: {{ include "minio.scheme" . | upper }}
  76. initialDelaySeconds: 10
  77. periodSeconds: 10
  78. timeoutSeconds: 5
  79. failureThreshold: 5
  80. successThreshold: 2
  81. livenessProbe:
  82. httpGet:
  83. path: /minio/health/live
  84. port: {{ .Values.service.consolePort | int }}
  85. scheme: {{ include "minio.scheme" . | upper }}
  86. initialDelaySeconds: 10
  87. periodSeconds: 10
  88. timeoutSeconds: 5
  89. failureThreshold: 5
  90. successThreshold: 1
  91. startupProbe:
  92. httpGet:
  93. path: /minio/health/live
  94. port: {{ .Values.service.consolePort | int }}
  95. scheme: {{ include "minio.scheme" . | upper }}
  96. initialDelaySeconds: 10
  97. periodSeconds: 5
  98. timeoutSeconds: 2
  99. failureThreshold: 60
  100. successThreshold: 1
  101. env:
  102. {{ $secretName := (include "minio.secretName" .) }}
  103. {{ $envList := (default list .Values.environmentVariables) }}
  104. {{ if and (eq (include "minio.certAvailable" .) "true") .Values.minioDomain }}
  105. {{ $envList = mustAppend $envList (dict "name" "MINIO_BROWSER_REDIRECT_URL" "value" (printf "%s://%s:%d" (include "minio.scheme" .) .Values.minioDomain (.Values.service.consolePort | int))) }}
  106. {{ $envList = mustAppend $envList (dict "name" "MINIO_SERVER_URL" "value" (printf "%s://%s:%d" (include "minio.scheme" .) .Values.minioDomain (.Values.service.nodePort | int))) }}
  107. {{ end }}
  108. {{ $envList = mustAppend $envList (dict "name" "MINIO_ROOT_USER" "valueFromSecret" true "secretName" $secretName "secretKey" "accesskey") }}
  109. {{ $envList = mustAppend $envList (dict "name" "MINIO_ROOT_PASSWORD" "valueFromSecret" true "secretName" $secretName "secretKey" "secretkey") }}
  110. {{ if .Values.logsearchapi.enabled }}
  111. {{/*
  112. We can put any ID we want here. Just make sure it's unique
  113. It can be rolled on each startup without problems, or se can set a static one.
  114. */}}
  115. {{ $webhookID := (printf "ix-%v" (randAlphaNum 5)) }}
  116. {{ $logsearchSecretName := (include "logsearchapi.secretName" .) }}
  117. {{ $envList = mustAppend $envList (dict "name" "MINIO_LOG_QUERY_AUTH_TOKEN" "valueFromSecret" true "secretName" $logsearchSecretName "secretKey" "queryToken") }}
  118. {{ $envList = mustAppend $envList (dict "name" "MINIO_LOG_QUERY_URL" "valueFromSecret" true "secretName" $logsearchSecretName "secretKey" "logQueryURL") }}
  119. {{ $envList = mustAppend $envList (dict "name" (printf "MINIO_AUDIT_WEBHOOK_ENDPOINT_%v" $webhookID) "valueFromSecret" true "secretName" $logsearchSecretName "secretKey" "webhookURL") }}
  120. {{ $envList = mustAppend $envList (dict "name" (printf "MINIO_AUDIT_WEBHOOK_ENABLE_%v" $webhookID) "value" "on") }}
  121. {{ end }}
  122. {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 12 }}
  123. {{ include "common.networking.dnsConfiguration" .Values | nindent 6 }}
  124. {{ if hasKey .Values "appVolumeMounts" }}
  125. volumes: {{ include "common.storage.configureAppVolumes" .Values | nindent 8 }}
  126. {{ else }}
  127. volumes:
  128. {{ end }}
  129. {{- include "minio.tlsKeysVolume" . | nindent 8 }}
  130. {{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
  131. - name: extrappvolume-{{ $index }}
  132. hostPath:
  133. path: {{ $hostPathConfiguration.hostPath }}
  134. {{ end }}