deployment.yaml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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" . }}
  8. labels:
  9. app: {{ template "common.names.name" . }}
  10. chart: {{ template "common.names.chart" . }}
  11. release: {{ .Release.Name }}
  12. heritage: {{ .Release.Service }}
  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. template:
  24. metadata:
  25. name: {{ template "common.names.fullname" . }}
  26. labels:
  27. app: {{ template "common.names.name" . }}
  28. release: {{ .Release.Name }}
  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 $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. volumeMounts: {{ include "common.storage.configureAppVolumeMountsInContainer" .Values | nindent 12 }}
  53. {{- include "minio.tlsKeysVolumeMount" . | nindent 12 }}
  54. {{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
  55. - name: extrappvolume-{{ $index }}
  56. mountPath: {{ $hostPathConfiguration.mountPath }}
  57. {{ end }}
  58. command:
  59. - "/bin/sh"
  60. - "-ce"
  61. - {{ include "minio.commandArgs" . }}
  62. ports:
  63. - name: api
  64. containerPort: {{ .Values.service.nodePort | int }}
  65. - name: console
  66. containerPort: {{ .Values.service.consolePort | int }}
  67. readinessProbe:
  68. httpGet:
  69. path: /minio/health/live
  70. port: {{ .Values.service.consolePort | int }}
  71. initialDelaySeconds: 10
  72. periodSeconds: 10
  73. timeoutSeconds: 5
  74. failureThreshold: 5
  75. successThreshold: 2
  76. livenessProbe:
  77. httpGet:
  78. path: /minio/health/live
  79. port: {{ .Values.service.consolePort | int }}
  80. initialDelaySeconds: 10
  81. periodSeconds: 10
  82. timeoutSeconds: 5
  83. failureThreshold: 5
  84. successThreshold: 1
  85. startupProbe:
  86. httpGet:
  87. path: /minio/health/live
  88. port: {{ .Values.service.consolePort | int }}
  89. initialDelaySeconds: 10
  90. periodSeconds: 5
  91. timeoutSeconds: 2
  92. failureThreshold: 60
  93. successThreshold: 1
  94. env:
  95. {{ $secretName := (include "minio.secretName" .) }}
  96. {{ $envList := (default list .Values.environmentVariables) }}
  97. {{ if and (eq (include "minio.certAvailable" .) "true") .Values.minioDomain }}
  98. {{ $envList = mustAppend $envList (dict "name" "MINIO_BROWSER_REDIRECT_URL" "value" (printf "%s://%s:%d" (include "minio.scheme" .) .Values.minioDomain (.Values.service.consolePort | int))) }}
  99. {{ $envList = mustAppend $envList (dict "name" "MINIO_SERVER_URL" "value" (printf "%s://%s:%d" (include "minio.scheme" .) .Values.minioDomain (.Values.service.nodePort | int))) }}
  100. {{ end }}
  101. {{ $envList = mustAppend $envList (dict "name" "MINIO_ROOT_USER" "valueFromSecret" true "secretName" $secretName "secretKey" "accesskey") }}
  102. {{ $envList = mustAppend $envList (dict "name" "MINIO_ROOT_PASSWORD" "valueFromSecret" true "secretName" $secretName "secretKey" "secretkey") }}
  103. {{ if .Values.logsearchapi.enabled }}
  104. {{/*
  105. We can put any ID we want here. Just make sure it's unique
  106. It can be rolled on each startup without problems, or se can set a static one.
  107. */}}
  108. {{ $webhookID := (printf "ix-%v" (randAlphaNum 5)) }}
  109. {{ $logsearchSecretName := (include "logsearchapi.secretName" .) }}
  110. {{ $envList = mustAppend $envList (dict "name" "MINIO_LOG_QUERY_AUTH_TOKEN" "valueFromSecret" true "secretName" $logsearchSecretName "secretKey" "queryToken") }}
  111. {{ $envList = mustAppend $envList (dict "name" "MINIO_LOG_QUERY_URL" "valueFromSecret" true "secretName" $logsearchSecretName "secretKey" "logQueryURL") }}
  112. {{ $envList = mustAppend $envList (dict "name" (printf "MINIO_AUDIT_WEBHOOK_ENDPOINT_%v" $webhookID) "valueFromSecret" true "secretName" $logsearchSecretName "secretKey" "webhookURL") }}
  113. {{ $envList = mustAppend $envList (dict "name" (printf "MINIO_AUDIT_WEBHOOK_ENABLE_%v" $webhookID) "value" "on") }}
  114. {{ end }}
  115. {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 12 }}
  116. {{ include "common.networking.dnsConfiguration" .Values | nindent 6 }}
  117. volumes: {{ include "common.storage.configureAppVolumes" .Values | nindent 8 }}
  118. {{- include "minio.tlsKeysVolume" . | nindent 8 }}
  119. {{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
  120. - name: extrappvolume-{{ $index }}
  121. hostPath:
  122. path: {{ $hostPathConfiguration.hostPath }}
  123. {{ end }}