diff --git a/elasticsearch/templates/deployment-client.yaml b/elasticsearch/templates/deployment-client.yaml index d5bce131..b6501090 100644 --- a/elasticsearch/templates/deployment-client.yaml +++ b/elasticsearch/templates/deployment-client.yaml @@ -92,6 +92,21 @@ spec: - sysctl - -w - vm.max_map_count={{ .Values.conf.init.max_map_count }} +{{ if .Values.storage.filesystem_repository.enabled }} + - name: elasticsearch-repository-perms +{{ tuple $envAll "elasticsearch" | include "helm-toolkit.snippets.image" | indent 10 }} + securityContext: + runAsUser: 0 +{{ tuple $envAll $envAll.Values.pod.resources.client | include "helm-toolkit.snippets.kubernetes_resources" | indent 8 }} + command: + - chown + - -R + - "elasticsearch:" + - {{ .Values.conf.elasticsearch.repository.location }} + volumeMounts: + - name: storage + mountPath: {{ .Values.conf.elasticsearch.repository.location }} +{{ end }} containers: - name: elasticsearch-client securityContext: diff --git a/elasticsearch/templates/deployment-master.yaml b/elasticsearch/templates/deployment-master.yaml index 7564224f..727894ca 100644 --- a/elasticsearch/templates/deployment-master.yaml +++ b/elasticsearch/templates/deployment-master.yaml @@ -57,6 +57,21 @@ spec: - sysctl - -w - vm.max_map_count={{ .Values.conf.init.max_map_count }} +{{ if .Values.storage.filesystem_repository.enabled }} + - name: elasticsearch-repository-perms +{{ tuple $envAll "elasticsearch" | include "helm-toolkit.snippets.image" | indent 10 }} + securityContext: + runAsUser: 0 +{{ tuple $envAll $envAll.Values.pod.resources.client | include "helm-toolkit.snippets.kubernetes_resources" | indent 8 }} + command: + - chown + - -R + - "elasticsearch:" + - {{ .Values.conf.elasticsearch.repository.location }} + volumeMounts: + - name: storage + mountPath: {{ .Values.conf.elasticsearch.repository.location }} +{{ end }} containers: - name: elasticsearch-master securityContext: diff --git a/elasticsearch/templates/statefulset-data.yaml b/elasticsearch/templates/statefulset-data.yaml index 1ec2368e..5d62ef47 100644 --- a/elasticsearch/templates/statefulset-data.yaml +++ b/elasticsearch/templates/statefulset-data.yaml @@ -89,6 +89,21 @@ spec: - sysctl - -w - vm.max_map_count={{ .Values.conf.init.max_map_count }} +{{ if .Values.storage.filesystem_repository.enabled }} + - name: elasticsearch-repository-perms +{{ tuple $envAll "elasticsearch" | include "helm-toolkit.snippets.image" | indent 10 }} + securityContext: + runAsUser: 0 +{{ tuple $envAll $envAll.Values.pod.resources.client | include "helm-toolkit.snippets.kubernetes_resources" | indent 8 }} + command: + - chown + - -R + - "elasticsearch:" + - {{ .Values.conf.elasticsearch.repository.location }} + volumeMounts: + - name: storage + mountPath: {{ .Values.conf.elasticsearch.repository.location }} +{{ end }} containers: - name: elasticsearch-data securityContext: