Jakub Latusek | 3659d9f | 2020-09-14 16:21:55 +0200 | [diff] [blame] | 1 | {{/* |
Alexander Dehn | ab86ec1 | 2020-02-05 14:38:54 +0000 | [diff] [blame] | 2 | # Copyright © 2020 Bitnami, AT&T, Amdocs, Bell Canada, highstreet technologies |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
Jakub Latusek | 3659d9f | 2020-09-14 16:21:55 +0200 | [diff] [blame] | 15 | */}} |
Alexander Dehn | ab86ec1 | 2020-02-05 14:38:54 +0000 | [diff] [blame] | 16 | apiVersion: apps/v1 |
| 17 | kind: Deployment |
| 18 | {{ $role := "coordinating-only" -}} |
| 19 | {{ $suffix := $role -}} |
| 20 | {{ $labels := (dict "role" $role "discovery" (include "elasticsearch.clustername" .)) -}} |
| 21 | metadata: {{- include "common.resourceMetadata" (dict "suffix" $suffix "labels" $labels "dot" . )| nindent 2 }} |
| 22 | spec: |
| 23 | strategy: |
| 24 | type: {{ .Values.updateStrategy.type }} |
| 25 | {{- if (eq "Recreate" .Values.updateStrategy.type) }} |
| 26 | rollingUpdate: null |
| 27 | {{- end }} |
| 28 | selector: {{- include "common.selectors" (dict "matchLabels" $labels "dot" .) | nindent 4 }} |
| 29 | replicas: {{ .Values.replicaCount }} |
| 30 | template: |
| 31 | metadata: {{- include "common.templateMetadata" (dict "labels" $labels "dot" .) | nindent 6 }} |
| 32 | spec: |
Sylvain Desbureaux | 829344b | 2020-11-19 17:07:26 +0100 | [diff] [blame] | 33 | imagePullSecrets: |
| 34 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |
Alexander Dehn | ab86ec1 | 2020-02-05 14:38:54 +0000 | [diff] [blame] | 35 | {{- if .Values.affinity }} |
| 36 | affinity: {{- include "common.tplValue" (dict "value" .Values.affinity "context" $) | nindent 8 }} |
| 37 | {{- end }} |
| 38 | {{- if .Values.nodeSelector }} |
| 39 | nodeSelector: {{- include "common.tplValue" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }} |
| 40 | {{- end }} |
| 41 | {{- if .Values.tolerations }} |
| 42 | tolerations: {{- include "common.tplValue" (dict "value" .Values.tolerations "context" $) | nindent 8 }} |
| 43 | {{- end }} |
| 44 | serviceAccountName: {{ template "elasticsearch.serviceAccountName" . }} |
| 45 | {{- if .Values.securityContext.enabled }} |
| 46 | securityContext: |
| 47 | fsGroup: {{ .Values.securityContext.fsGroup }} |
| 48 | {{- end }} |
| 49 | |
| 50 | ## Image that performs the sysctl operation to modify Kernel settings (needed sometimes to avoid boot errors) |
| 51 | initContainers: |
| 52 | {{- if .Values.sysctlImage.enabled }} |
| 53 | - name: sysctl |
Sylvain Desbureaux | 829344b | 2020-11-19 17:07:26 +0100 | [diff] [blame] | 54 | image: {{ include "repositoryGenerator.image.busybox" . }} |
Alexander Dehn | ab86ec1 | 2020-02-05 14:38:54 +0000 | [diff] [blame] | 55 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 56 | command: |
| 57 | - /bin/sh |
| 58 | - -c |
| 59 | - | |
| 60 | set -o errexit |
| 61 | set -o pipefail |
| 62 | set -o nounset |
| 63 | sysctl -w vm.max_map_count=262144 && sysctl -w fs.file-max=65536 |
| 64 | securityContext: |
| 65 | privileged: true |
| 66 | {{- end }} |
Alexander Dehn | ab86ec1 | 2020-02-05 14:38:54 +0000 | [diff] [blame] | 67 | |
| 68 | containers: |
| 69 | - name: {{ include "common.name" . }}-nginx |
Sylvain Desbureaux | 829344b | 2020-11-19 17:07:26 +0100 | [diff] [blame] | 70 | image: {{ include "repositoryGenerator.image.nginx" . }} |
Alexander Dehn | ab86ec1 | 2020-02-05 14:38:54 +0000 | [diff] [blame] | 71 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.nginx.pullPolicy | quote }} |
| 72 | ports: {{- include "common.containerPorts" . | indent 12 -}} |
| 73 | {{- if .Values.nginx.livenessProbe }} |
| 74 | livenessProbe: {{- toYaml .Values.nginx.livenessProbe | nindent 12 }} |
| 75 | {{- end }} |
| 76 | {{- if .Values.nginx.readinessProbe }} |
| 77 | readinessProbe: {{- toYaml .Values.nginx.readinessProbe | nindent 12 }} |
| 78 | {{- end }} |
| 79 | {{- if .Values.nginx.resources }} |
| 80 | resources: {{- toYaml .Values.nginx.resources | nindent 12 }} |
| 81 | {{- end }} |
| 82 | volumeMounts: |
| 83 | {{- if .Values.nginx.serverBlock }} |
| 84 | - name: nginx-server-block |
| 85 | mountPath: /opt/bitnami/nginx/conf/server_blocks |
| 86 | {{- end }} |
Alexander Dehn | ab86ec1 | 2020-02-05 14:38:54 +0000 | [diff] [blame] | 87 | |
| 88 | - name: {{ include "common.name" . }}-elasticsearch |
Sylvain Desbureaux | 829344b | 2020-11-19 17:07:26 +0100 | [diff] [blame] | 89 | image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.image }} |
Alexander Dehn | ab86ec1 | 2020-02-05 14:38:54 +0000 | [diff] [blame] | 90 | {{- if .Values.securityContext.enabled }} |
| 91 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 92 | securityContext: |
| 93 | runAsUser: {{ .Values.securityContext.runAsUser }} |
| 94 | {{- end }} |
| 95 | env: |
| 96 | - name: BITNAMI_DEBUG |
Alexander Dehn | c2a3686 | 2020-09-02 11:48:20 +0000 | [diff] [blame] | 97 | value: {{ ternary "true" "false" .Values.debug | quote }} |
Alexander Dehn | ab86ec1 | 2020-02-05 14:38:54 +0000 | [diff] [blame] | 98 | - name: ELASTICSEARCH_CLUSTER_NAME |
| 99 | value: {{ include "elasticsearch.clustername" .}} |
| 100 | - name: ELASTICSEARCH_CLUSTER_HOSTS |
| 101 | value: {{ include "common.name" . }}-discovery |
| 102 | {{- if .Values.plugins }} |
| 103 | - name: ELASTICSEARCH_PLUGINS |
| 104 | value: {{ .Values.plugins | quote }} |
| 105 | {{- end }} |
| 106 | - name: ELASTICSEARCH_HEAP_SIZE |
| 107 | value: {{ .Values.heapSize | quote }} |
| 108 | - name: ELASTICSEARCH_IS_DEDICATED_NODE |
| 109 | value: "yes" |
| 110 | - name: ELASTICSEARCH_NODE_TYPE |
| 111 | value: "coordinating" |
| 112 | - name: ELASTICSEARCH_PORT_NUMBER |
| 113 | value: "9000" |
Radoslaw Chmiel | 13a9368 | 2022-06-02 19:06:16 +0200 | [diff] [blame] | 114 | - name: network.bind_host |
| 115 | value: 127.0.0.1 |
| 116 | - name: network.publish_host |
| 117 | valueFrom: |
| 118 | fieldRef: |
| 119 | fieldPath: status.podIP |
Alexander Dehn | ab86ec1 | 2020-02-05 14:38:54 +0000 | [diff] [blame] | 120 | {{/*ports: {{- include "common.containerPorts" . | indent 12 -}} */}} |
| 121 | {{- if .Values.livenessProbe.enabled }} |
| 122 | livenessProbe: |
| 123 | initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} |
| 124 | periodSeconds: {{ .Values.livenessProbe.periodSeconds }} |
| 125 | timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} |
| 126 | successThreshold: {{ .Values.livenessProbe.successThreshold }} |
| 127 | failureThreshold: {{ .Values.livenessProbe.failureThreshold }} |
| 128 | httpGet: |
| 129 | path: /_cluster/health?local=true |
| 130 | port: http |
| 131 | {{- end }} |
| 132 | {{- if .Values.readinessProbe.enabled}} |
| 133 | readinessProbe: |
| 134 | initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} |
| 135 | periodSeconds: {{ .Values.readinessProbe.periodSeconds }} |
| 136 | timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} |
| 137 | successThreshold: {{ .Values.readinessProbe.successThreshold }} |
| 138 | failureThreshold: {{ .Values.readinessProbe.failureThreshold }} |
| 139 | httpGet: |
| 140 | path: /_cluster/health?local=true |
| 141 | port: http |
| 142 | {{- end }} |
| 143 | {{- if .Values.resources }} |
| 144 | resources: {{- toYaml .Values.resources | nindent 12 }} |
| 145 | {{- end}} |
| 146 | volumeMounts: |
| 147 | {{- if .Values.config }} |
| 148 | - mountPath: /opt/bitnami/elasticsearch/config/elasticsearch.yml |
| 149 | name: config |
| 150 | subPath: elasticsearch.yml |
| 151 | {{- end }} |
| 152 | - name: data |
| 153 | mountPath: "/bitnami/elasticsearch/data/" |
| 154 | {{- if .Values.extraVolumeMounts }} |
| 155 | {{- toYaml .Values.extraVolumeMounts | nindent 12 }} |
| 156 | {{- end }} |
| 157 | volumes: |
| 158 | {{- if .Values.config }} |
| 159 | - name: config |
| 160 | configMap: |
| 161 | name: {{ include "common.fullname" . }} |
| 162 | {{- end }} |
| 163 | - name: data |
| 164 | emptyDir: {} |
| 165 | {{- if .Values.extraVolumes }} |
| 166 | {{- toYaml .Values.extraVolumes | nindent 8 }} |
| 167 | {{- end }} |
| 168 | {{- if .Values.nginx.serverBlock }} |
| 169 | - name: nginx-server-block |
| 170 | configMap: |
| 171 | name: {{ include "common.fullname" . }}-nginx-server-block |
| 172 | {{- end }} |