deployment.yaml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. env:
  68. {{ $secretName := (include "minio.secretName" .) }}
  69. {{ $envList := (default list .Values.environmentVariables) }}
  70. {{ if and (eq (include "minio.certAvailable" .) "true") .Values.minioDomain }}
  71. {{ $envList = mustAppend $envList (dict "name" "MINIO_BROWSER_REDIRECT_URL" "value" (printf "%s://%s:%d" (include "minio.scheme" .) .Values.minioDomain (.Values.service.consolePort | int))) }}
  72. {{ $envList = mustAppend $envList (dict "name" "MINIO_SERVER_URL" "value" (printf "%s://%s:%d" (include "minio.scheme" .) .Values.minioDomain (.Values.service.nodePort | int))) }}
  73. {{ end }}
  74. {{ $envList = mustAppend $envList (dict "name" "MINIO_ROOT_USER" "valueFromSecret" true "secretName" $secretName "secretKey" "accesskey") }}
  75. {{ $envList = mustAppend $envList (dict "name" "MINIO_ROOT_PASSWORD" "valueFromSecret" true "secretName" $secretName "secretKey" "secretkey") }}
  76. {{ if .Values.logsearchapi.enabled }}
  77. {{/*
  78. We can put any ID we want here. Just make sure it's unique
  79. It can be rolled on each startup without problems, or se can set a static one.
  80. */}}
  81. {{ $webhookID := (printf "ix-%v" (randAlphaNum 5)) }}
  82. {{ $logsearchSecretName := (include "logsearchapi.secretName" .) }}
  83. {{ $envList = mustAppend $envList (dict "name" "MINIO_LOG_QUERY_AUTH_TOKEN" "valueFromSecret" true "secretName" $logsearchSecretName "secretKey" "queryToken") }}
  84. {{ $envList = mustAppend $envList (dict "name" "MINIO_LOG_QUERY_URL" "valueFromSecret" true "secretName" $logsearchSecretName "secretKey" "logQueryURL") }}
  85. {{ $envList = mustAppend $envList (dict "name" (printf "MINIO_AUDIT_WEBHOOK_ENDPOINT_%v" $webhookID) "valueFromSecret" true "secretName" $logsearchSecretName "secretKey" "webhookURL") }}
  86. {{ $envList = mustAppend $envList (dict "name" (printf "MINIO_AUDIT_WEBHOOK_ENABLE_%v" $webhookID) "value" "on") }}
  87. {{ end }}
  88. {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 12 }}
  89. {{ include "common.networking.dnsConfiguration" .Values | nindent 6 }}
  90. volumes: {{ include "common.storage.configureAppVolumes" .Values | nindent 8 }}
  91. {{- include "minio.tlsKeysVolume" . | nindent 8 }}
  92. {{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
  93. - name: extrappvolume-{{ $index }}
  94. hostPath:
  95. path: {{ $hostPathConfiguration.hostPath }}
  96. {{ end }}