|
1 | 1 | apiVersion: apps/v1 |
2 | 2 | kind: Deployment |
3 | 3 | metadata: |
4 | | - name: {{ template "elasticsearch.coordinating.fullname" . }} |
5 | | - labels: |
6 | | - app: {{ template "elasticsearch.name" . }} |
7 | | - chart: {{ template "elasticsearch.chart" . }} |
8 | | - heritage: {{ .Release.Service | quote }} |
9 | | - release: {{ .Release.Name | quote }} |
10 | | - role: "coordinating-only" |
| 4 | + name: {{ include "elasticsearch.coordinating.fullname" . }} |
| 5 | + labels: {{- include "elasticsearch.labels" . | nindent 4 }} |
| 6 | + role: coordinating-only |
11 | 7 | spec: |
12 | 8 | selector: |
13 | | - matchLabels: |
14 | | - app: {{ template "elasticsearch.name" . }} |
15 | | - release: {{ .Release.Name | quote }} |
16 | | - role: "coordinating-only" |
| 9 | + matchLabels: {{- include "elasticsearch.matchLabels" . | nindent 6 }} |
| 10 | + role: coordinating-only |
17 | 11 | replicas: {{ .Values.coordinating.replicas }} |
18 | 12 | template: |
19 | 13 | metadata: |
20 | | - labels: |
21 | | - app: {{ template "elasticsearch.name" . }} |
22 | | - release: {{ .Release.Name | quote }} |
23 | | - role: "coordinating-only" |
24 | | -{{- with .Values.coordinating.podAnnotations }} |
25 | | - annotations: |
26 | | -{{ toYaml . | indent 8 }} |
27 | | -{{- end }} |
| 14 | + labels: {{- include "elasticsearch.labels" . | nindent 8 }} |
| 15 | + role: coordinating-only |
| 16 | + {{- with .Values.coordinating.podAnnotations }} |
| 17 | + annotations: {{- toYaml . | nindent 10 }} |
| 18 | + {{- end }} |
28 | 19 | spec: |
29 | | - {{- if .Values.securityContext.enabled }} |
30 | | - securityContext: |
31 | | - fsGroup: {{ .Values.securityContext.fsGroup }} |
| 20 | +{{- include "elasticsearch.imagePullSecrets" . | nindent 6 }} |
| 21 | + {{- if .Values.coordinating.affinity }} |
| 22 | + affinity: {{- include "elasticsearch.tplValue" (dict "value" .Values.coordinating.affinity "context" $) | nindent 8 }} |
32 | 23 | {{- end }} |
33 | | - affinity: |
34 | | - {{- if eq .Values.coordinating.antiAffinity "hard" }} |
35 | | - podAntiAffinity: |
36 | | - requiredDuringSchedulingIgnoredDuringExecution: |
37 | | - - topologyKey: "kubernetes.io/hostname" |
38 | | - labelSelector: |
39 | | - matchLabels: |
40 | | - app: {{ template "elasticsearch.name" . }} |
41 | | - release: {{ .Release.Name | quote }} |
42 | | - role: "coordinating-only" |
43 | | - {{- else if eq .Values.coordinating.antiAffinity "soft" }} |
44 | | - podAntiAffinity: |
45 | | - preferredDuringSchedulingIgnoredDuringExecution: |
46 | | - - weight: 1 |
47 | | - podAffinityTerm: |
48 | | - topologyKey: kubernetes.io/hostname |
49 | | - labelSelector: |
50 | | - matchLabels: |
51 | | - app: {{ template "elasticsearch.name" . }} |
52 | | - release: {{ .Release.Name | quote }} |
53 | | - role: "coordinating-only" |
| 24 | + {{- if .Values.coordinating.nodeSelector }} |
| 25 | + nodeSelector: {{- include "elasticsearch.tplValue" (dict "value" .Values.coordinating.nodeSelector "context" $) | nindent 8 }} |
54 | 26 | {{- end }} |
55 | | - {{- if .Values.coordinating.nodeAffinity }} |
56 | | -{{ toYaml .Values.coordinating.nodeAffinity | indent 8 }} |
| 27 | + {{- if .Values.coordinating.tolerations }} |
| 28 | + tolerations: {{- include "elasticsearch.tplValue" (dict "value" .Values.coordinating.tolerations "context" $) | nindent 8 }} |
| 29 | + {{- end }} |
| 30 | + {{- if .Values.coordinating.securityContext.enabled }} |
| 31 | + securityContext: |
| 32 | + fsGroup: {{ .Values.coordinating.securityContext.fsGroup }} |
57 | 33 | {{- end }} |
58 | | - {{- include "elasticsearch.imagePullSecrets" . | nindent 6 }} |
59 | 34 | {{- if .Values.sysctlImage.enabled }} |
60 | 35 | ## Image that performs the sysctl operation to modify Kernel settings (needed sometimes to avoid boot errors) |
61 | 36 | initContainers: |
62 | | - - name: sysctl |
63 | | - image: {{ template "elasticsearch.sysctl.image" . }} |
64 | | - imagePullPolicy: {{ .Values.image.pullPolicy | quote }} |
65 | | - command: ['sh', '-c', 'install_packages procps && sysctl -w vm.max_map_count=262144 && sysctl -w fs.file-max=65536'] |
66 | | - securityContext: |
67 | | - privileged: true |
| 37 | + - name: sysctl |
| 38 | + image: {{ include "elasticsearch.sysctl.image" . }} |
| 39 | + imagePullPolicy: {{ .Values.image.pullPolicy | quote }} |
| 40 | + command: |
| 41 | + - /bin/bash |
| 42 | + - -ec |
| 43 | + - | |
| 44 | + install_packages procps |
| 45 | + sysctl -w vm.max_map_count=262144 && sysctl -w fs.file-max=65536 |
| 46 | + securityContext: |
| 47 | + privileged: true |
68 | 48 | {{- end }} |
69 | 49 | containers: |
70 | | - - name: "elasticsearch" |
71 | | - {{- if .Values.securityContext.enabled }} |
72 | | - securityContext: |
73 | | - runAsUser: {{ .Values.securityContext.runAsUser }} |
74 | | - {{- end }} |
75 | | - image: {{ template "elasticsearch.image" . }} |
76 | | - imagePullPolicy: {{ .Values.image.pullPolicy | quote }} |
77 | | - env: |
78 | | - - name: ELASTICSEARCH_CLUSTER_NAME |
79 | | - value: {{ .Values.name | quote }} |
80 | | - - name: ELASTICSEARCH_CLUSTER_HOSTS |
81 | | - value: {{ template "elasticsearch.discovery.fullname" . }} |
82 | | - {{- if .Values.plugins }} |
83 | | - - name: ELASTICSEARCH_PLUGINS |
84 | | - value: {{ .Values.plugins | quote }} |
85 | | - {{- end }} |
86 | | - - name: ELASTICSEARCH_HEAP_SIZE |
87 | | - value: {{ .Values.coordinating.heapSize | quote }} |
88 | | - - name: ELASTICSEARCH_IS_DEDICATED_NODE |
89 | | - value: "yes" |
90 | | - - name: ELASTICSEARCH_NODE_TYPE |
91 | | - value: "coordinating" |
92 | | - ports: |
93 | | - - name: http |
94 | | - containerPort: 9200 |
95 | | - - name: transport |
96 | | - containerPort: 9300 |
97 | | - {{- if .Values.coordinating.livenessProbe.enabled }} |
98 | | - livenessProbe: |
99 | | - initialDelaySeconds: {{ .Values.coordinating.livenessProbe.initialDelaySeconds }} |
100 | | - periodSeconds: {{ .Values.coordinating.livenessProbe.periodSeconds }} |
101 | | - timeoutSeconds: {{ .Values.coordinating.livenessProbe.timeoutSeconds }} |
102 | | - successThreshold: {{ .Values.coordinating.livenessProbe.successThreshold }} |
103 | | - failureThreshold: {{ .Values.coordinating.livenessProbe.failureThreshold }} |
104 | | - httpGet: |
105 | | - path: /_cluster/health?local=true |
106 | | - port: http |
107 | | - {{- end }} |
108 | | - {{- if .Values.coordinating.readinessProbe.enabled}} |
109 | | - readinessProbe: |
110 | | - initialDelaySeconds: {{ .Values.coordinating.readinessProbe.initialDelaySeconds }} |
111 | | - periodSeconds: {{ .Values.coordinating.readinessProbe.periodSeconds }} |
112 | | - timeoutSeconds: {{ .Values.coordinating.readinessProbe.timeoutSeconds }} |
113 | | - successThreshold: {{ .Values.coordinating.readinessProbe.successThreshold }} |
114 | | - failureThreshold: {{ .Values.coordinating.readinessProbe.failureThreshold }} |
115 | | - httpGet: |
116 | | - path: /_cluster/health?local=true |
117 | | - port: http |
118 | | - {{- end }} |
119 | | - resources: |
120 | | -{{ toYaml .Values.coordinating.resources | indent 10 }} |
121 | | - volumeMounts: |
| 50 | + - name: elasticsearch |
| 51 | + image: {{ include "elasticsearch.image" . }} |
| 52 | + {{- if .Values.coordinating.securityContext.enabled }} |
| 53 | + imagePullPolicy: {{ .Values.image.pullPolicy | quote }} |
| 54 | + securityContext: |
| 55 | + runAsUser: {{ .Values.coordinating.securityContext.runAsUser }} |
| 56 | + {{- end }} |
| 57 | + env: |
| 58 | + - name: BITNAMI_DEBUG |
| 59 | + value: {{ ternary "true" "false" .Values.image.debug | quote }} |
| 60 | + - name: ELASTICSEARCH_CLUSTER_NAME |
| 61 | + value: {{ .Values.name | quote }} |
| 62 | + - name: ELASTICSEARCH_CLUSTER_HOSTS |
| 63 | + value: {{ template "elasticsearch.discovery.fullname" . }} |
| 64 | + {{- if .Values.plugins }} |
| 65 | + - name: ELASTICSEARCH_PLUGINS |
| 66 | + value: {{ .Values.plugins | quote }} |
| 67 | + {{- end }} |
| 68 | + - name: ELASTICSEARCH_HEAP_SIZE |
| 69 | + value: {{ .Values.coordinating.heapSize | quote }} |
| 70 | + - name: ELASTICSEARCH_IS_DEDICATED_NODE |
| 71 | + value: "yes" |
| 72 | + - name: ELASTICSEARCH_NODE_TYPE |
| 73 | + value: "coordinating" |
| 74 | + ports: |
| 75 | + - name: http |
| 76 | + containerPort: 9200 |
| 77 | + - name: transport |
| 78 | + containerPort: 9300 |
| 79 | + {{- if .Values.coordinating.livenessProbe.enabled }} |
| 80 | + livenessProbe: |
| 81 | + initialDelaySeconds: {{ .Values.coordinating.livenessProbe.initialDelaySeconds }} |
| 82 | + periodSeconds: {{ .Values.coordinating.livenessProbe.periodSeconds }} |
| 83 | + timeoutSeconds: {{ .Values.coordinating.livenessProbe.timeoutSeconds }} |
| 84 | + successThreshold: {{ .Values.coordinating.livenessProbe.successThreshold }} |
| 85 | + failureThreshold: {{ .Values.coordinating.livenessProbe.failureThreshold }} |
| 86 | + httpGet: |
| 87 | + path: /_cluster/health?local=true |
| 88 | + port: http |
| 89 | + {{- end }} |
| 90 | + {{- if .Values.coordinating.readinessProbe.enabled}} |
| 91 | + readinessProbe: |
| 92 | + initialDelaySeconds: {{ .Values.coordinating.readinessProbe.initialDelaySeconds }} |
| 93 | + periodSeconds: {{ .Values.coordinating.readinessProbe.periodSeconds }} |
| 94 | + timeoutSeconds: {{ .Values.coordinating.readinessProbe.timeoutSeconds }} |
| 95 | + successThreshold: {{ .Values.coordinating.readinessProbe.successThreshold }} |
| 96 | + failureThreshold: {{ .Values.coordinating.readinessProbe.failureThreshold }} |
| 97 | + httpGet: |
| 98 | + path: /_cluster/health?local=true |
| 99 | + port: http |
| 100 | + {{- end }} |
| 101 | + {{- if .Values.coordinating.resources }} |
| 102 | + resources: {{- toYaml .Values.coordinating.resources | nindent 12 }} |
| 103 | + {{- end}} |
| 104 | + volumeMounts: |
| 105 | + {{- if .Values.config }} |
| 106 | + - mountPath: /opt/bitnami/elasticsearch/config/elasticsearch.yml |
| 107 | + name: config |
| 108 | + subPath: elasticsearch.yml |
| 109 | + {{- end }} |
| 110 | + - name: data |
| 111 | + mountPath: "/bitnami/elasticsearch/data/" |
| 112 | + {{- if .Values.extraVolumeMounts }} |
| 113 | + {{- toYaml .Values.extraVolumeMounts | nindent 12 }} |
| 114 | + {{- end }} |
| 115 | + volumes: |
122 | 116 | {{- if .Values.config }} |
123 | | - - mountPath: /opt/bitnami/elasticsearch/config/elasticsearch.yml |
124 | | - name: "config" |
125 | | - subPath: elasticsearch.yml |
| 117 | + - name: config |
| 118 | + configMap: |
| 119 | + name: {{ include "elasticsearch.fullname" . }} |
| 120 | + {{- end }} |
| 121 | + - name: data |
| 122 | + emptyDir: {} |
| 123 | + {{- if .Values.extraVolumes }} |
| 124 | + {{- toYaml .Values.extraVolumes | nindent 8 }} |
126 | 125 | {{- end }} |
127 | | - - name: "data" |
128 | | - mountPath: "/bitnami/elasticsearch/data/" |
129 | | - {{- if .Values.extraVolumeMounts }} |
130 | | - {{ toYaml .Values.extraVolumeMounts | indent 8 }} |
131 | | - {{ end }} |
132 | | - volumes: |
133 | | - {{- if .Values.config }} |
134 | | - - name: "config" |
135 | | - configMap: |
136 | | - name: {{ template "elasticsearch.fullname" . }} |
137 | | - {{- end }} |
138 | | - - name: "data" |
139 | | - emptyDir: {} |
140 | | - {{- if .Values.extraVolumes }} |
141 | | - {{- toYaml .Values.extraVolumes | nindent 6 }} |
142 | | - {{- end }} |
0 commit comments