Skip to content

Commit 1efbf70

Browse files
author
juan131
committed
[bitnami/elasticsearch] Lint chart
Signed-off-by: juan131 <juan@bitnami.com>
1 parent 49ce626 commit 1efbf70

23 files changed

+1434
-1238
lines changed

bitnami/elasticsearch/Chart.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
apiVersion: v1
22
name: elasticsearch
3-
version: 8.2.4
3+
version: 8.2.5
44
appVersion: 7.4.2
55
description: A highly scalable open-source full-text search and analytics engine
66
keywords:
7-
- elasticsearch
7+
- elasticsearch
88
home: https://www.elastic.co/products/elasticsearch
99
sources:
10-
- https://github.com/bitnami/bitnami-docker-elasticsearch
10+
- https://github.com/bitnami/bitnami-docker-elasticsearch
1111
maintainers:
12-
- name: Bitnami
13-
email: containers@bitnami.com
12+
- name: Bitnami
13+
email: containers@bitnami.com
1414
engine: gotpl
1515
icon: https://bitnami.com/assets/stacks/elasticsearch/img/elasticsearch-stack-110x117.png

bitnami/elasticsearch/README.md

Lines changed: 187 additions & 177 deletions
Large diffs are not rendered by default.

bitnami/elasticsearch/templates/_helpers.tpl

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,24 @@ Create chart name and version as used by the chart label.
3030
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
3131
{{- end -}}
3232

33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "elasticsearch.labels" -}}
37+
app: {{ include "elasticsearch.name" . }}
38+
chart: {{ include "elasticsearch.chart" . }}
39+
release: {{ .Release.Name }}
40+
heritage: {{ .Release.Service }}
41+
{{- end -}}
42+
43+
{{/*
44+
Labels to use on deploy.spec.selector.matchLabels and svc.spec.selector
45+
*/}}
46+
{{- define "elasticsearch.matchLabels" -}}
47+
app: {{ include "elasticsearch.name" . }}
48+
release: {{ .Release.Name }}
49+
{{- end -}}
50+
3351
{{/*
3452
Return the proper ES image name
3553
*/}}
@@ -312,3 +330,16 @@ Also, we can't use a single if because lazy evaluation is not an option
312330
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
313331
{{- end -}}
314332
{{- end -}}
333+
334+
{{/*
335+
Renders a value that contains template.
336+
Usage:
337+
{{ include "elasticsearch.tplValue" ( dict "value" .Values.path.to.the.Value "context" $) }}
338+
*/}}
339+
{{- define "elasticsearch.tplValue" -}}
340+
{{- if typeIs "string" .value }}
341+
{{- tpl .value .context }}
342+
{{- else }}
343+
{{- tpl (.value | toYaml) .context }}
344+
{{- end }}
345+
{{- end -}}

bitnami/elasticsearch/templates/configmap-curator.yaml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@
22
apiVersion: v1
33
kind: ConfigMap
44
metadata:
5-
name: {{ template "elasticsearch.curator.fullname" . }}
6-
labels:
7-
app: {{ template "elasticsearch.name" . }}
8-
chart: {{ template "elasticsearch.chart" . }}
9-
heritage: {{ .Release.Service | quote }}
10-
release: {{ .Release.Name | quote }}
11-
role: "curator"
5+
name: {{ include "elasticsearch.curator.fullname" . }}
6+
labels: {{- include "elasticsearch.labels" . | nindent 4 }}
7+
role: curator
128
data:
139
action_file.yml: {{ required "A valid .Values.curator.configMaps.action_file_yml entry is required!" (toYaml .Values.curator.configMaps.action_file_yml | indent 2) }}
1410
config.yml: {{ required "A valid .Values.curator.configMaps.config_yml entry is required!" (tpl (toYaml .Values.curator.configMaps.config_yml | indent 2) $) }}

bitnami/elasticsearch/templates/configmap-es.yaml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@
22
apiVersion: v1
33
kind: ConfigMap
44
metadata:
5-
name: {{ template "elasticsearch.fullname" . }}
6-
labels:
7-
app: {{ template "elasticsearch.name" . }}
8-
chart: {{ template "elasticsearch.chart" . }}
9-
heritage: {{ .Release.Service | quote }}
10-
release: {{ .Release.Name | quote }}
5+
name: {{ include "elasticsearch.fullname" . }}
6+
labels: {{- include "elasticsearch.labels" . | nindent 4 }}
117
data:
12-
elasticsearch.yml: |-
13-
{{ toYaml .Values.config | indent 4 }}
8+
elasticsearch.yml: |- {{- toYaml .Values.config | nindent 4 }}
149
{{- end }}
Lines changed: 106 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -1,142 +1,125 @@
11
apiVersion: apps/v1
22
kind: Deployment
33
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
117
spec:
128
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
1711
replicas: {{ .Values.coordinating.replicas }}
1812
template:
1913
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 }}
2819
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 }}
3223
{{- 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 }}
5426
{{- 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 }}
5733
{{- end }}
58-
{{- include "elasticsearch.imagePullSecrets" . | nindent 6 }}
5934
{{- if .Values.sysctlImage.enabled }}
6035
## Image that performs the sysctl operation to modify Kernel settings (needed sometimes to avoid boot errors)
6136
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
6848
{{- end }}
6949
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:
122116
{{- 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 }}
126125
{{- 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 }}
Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,23 @@
11
apiVersion: v1
22
kind: Service
33
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"
11-
{{- with .Values.coordinating.service.annotations }}
12-
annotations:
13-
{{ toYaml . | indent 4 }}
14-
{{- end }}
4+
name: {{ include "elasticsearch.coordinating.fullname" . }}
5+
labels: {{- include "elasticsearch.labels" . | nindent 4 }}
6+
role: coordinating-only
7+
annotations: {{ include "elasticsearch.tplValue" ( dict "value" .Values.coordinating.service.annotations "context" $) | nindent 4 }}
158
spec:
169
type: {{ .Values.coordinating.service.type | quote }}
17-
{{- if and (eq .Values.coordinating.service.type "LoadBalancer") .Values.coordinating.service.loadBalancerIP }}
10+
{{- if and (eq .Values.coordinating.service.type "LoadBalancer") (not (empty .Values.coordinating.service.loadBalancerIP)) }}
1811
loadBalancerIP: {{ .Values.coordinating.service.loadBalancerIP }}
1912
{{- end }}
2013
ports:
21-
- name: http
22-
port: {{ .Values.coordinating.service.port }}
23-
targetPort: http
24-
{{- if .Values.coordinating.service.nodePort }}
25-
nodePort: {{ .Values.coordinating.service.nodePort }}
26-
{{- end }}
27-
selector:
28-
app: {{ template "elasticsearch.name" . }}
29-
release: {{ .Release.Name | quote }}
30-
role: "coordinating-only"
14+
- name: http
15+
port: {{ .Values.coordinating.service.port }}
16+
targetPort: http
17+
{{- if and (or (eq .Values.coordinating.service.type "NodePort") (eq .Values.coordinating.service.type "LoadBalancer")) (not (empty .Values.coordinating.service.nodePort)) }}
18+
nodePort: {{ .Values.coordinating.service.nodePort }}
19+
{{- else if eq .Values.coordinating.service.type "ClusterIP" }}
20+
nodePort: null
21+
{{- end }}
22+
selector: {{- include "elasticsearch.matchLabels" . | nindent 4 }}
23+
role: coordinating-only

0 commit comments

Comments
 (0)