From 942b0a75971587c7d756f39ab6863a249c5e7768 Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 15 May 2019 12:22:45 +1200 Subject: [PATCH 1/3] Make init container conditional https://github.com/helm/charts/blob/master/stable/elasticsearch/templates/master-statefulset.yaml#L69 --- elasticsearch/templates/statefulset.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/elasticsearch/templates/statefulset.yaml b/elasticsearch/templates/statefulset.yaml index 993af76d6..b7ca06332 100644 --- a/elasticsearch/templates/statefulset.yaml +++ b/elasticsearch/templates/statefulset.yaml @@ -104,6 +104,7 @@ spec: imagePullSecrets: {{ toYaml .Values.imagePullSecrets | indent 8 }} {{- end }} +{{- if .Values.sysctlInitContainer.enabled }} initContainers: - name: configure-sysctl securityContext: @@ -116,6 +117,7 @@ spec: {{- if .Values.extraInitContainers }} {{ tpl .Values.extraInitContainers . | indent 6 }} {{- end }} +{{- end }} containers: - name: "{{ template "name" . }}" image: "{{ .Values.image }}:{{ .Values.imageTag }}" From fa030c1285edccd230b73efe3dff6210a2bf49ee Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 15 May 2019 12:24:30 +1200 Subject: [PATCH 2/3] Default init container to disabled Not everyone has privileged access --- elasticsearch/values.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/elasticsearch/values.yaml b/elasticsearch/values.yaml index 8a9caf010..ac6b03fc9 100755 --- a/elasticsearch/values.yaml +++ b/elasticsearch/values.yaml @@ -159,3 +159,6 @@ ingress: nameOverride: "" fullnameOverride: "" + +sysctlInitContainer: + enabled: false From c453fefb8fe0778dd3bb752012ecb3da5b82a6cb Mon Sep 17 00:00:00 2001 From: NickLarsenNZ Date: Wed, 15 May 2019 12:58:46 +1200 Subject: [PATCH 3/3] Added sysctlInitContainer.enabled=true variable to test so the Init Container test doesn't fail. --- elasticsearch/tests/elasticsearch_test.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/elasticsearch/tests/elasticsearch_test.py b/elasticsearch/tests/elasticsearch_test.py index 5e04b9de1..71f7c4592 100755 --- a/elasticsearch/tests/elasticsearch_test.py +++ b/elasticsearch/tests/elasticsearch_test.py @@ -82,6 +82,10 @@ def test_defaults(): 'name': 'node.ingest', 'value': 'true' }, + { + 'name': 'sysctlInitContainer.enabled', + 'value': 'true' + }, ] c = r['statefulset'][uname]['spec']['template']['spec']['containers'][0]