Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
Elasticsearch secret mountmode (#596)
Browse files Browse the repository at this point in the history
* Add ability to set the file permissions when mounting a secret

* Added test for defaultMode on secret mount
  • Loading branch information
domgoodwin authored May 28, 2020
1 parent 5525142 commit 4ece77d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions elasticsearch/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ spec:
- name: {{ .name }}
secret:
secretName: {{ .secretName }}
{{- if .defaultMode }}
defaultMode: {{ .defaultMode }}
{{- end }}
{{- end }}
{{- if .Values.esConfig }}
- name: esconfig
Expand Down
18 changes: 18 additions & 0 deletions elasticsearch/tests/elasticsearch_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,24 @@ def test_adding_a_secret_mount_with_subpath():
}


def test_adding_a_secret_mount_with_default_mode():
config = """
secretMounts:
- name: elastic-certificates
secretName: elastic-certs
path: /usr/share/elasticsearch/config/certs
subPath: cert.crt
defaultMode: 0755
"""
r = helm_template(config)
s = r["statefulset"][uname]["spec"]["template"]["spec"]
assert s["containers"][0]["volumeMounts"][-1] == {
"mountPath": "/usr/share/elasticsearch/config/certs",
"subPath": "cert.crt",
"name": "elastic-certificates",
}


def test_adding_image_pull_secrets():
config = """
imagePullSecrets:
Expand Down
1 change: 1 addition & 0 deletions elasticsearch/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ secretMounts: []
# - name: elastic-certificates
# secretName: elastic-certificates
# path: /usr/share/elasticsearch/config/certs
# defaultMode: 0755

image: "docker.elastic.co/elasticsearch/elasticsearch"
imageTag: "7.7.0"
Expand Down

0 comments on commit 4ece77d

Please sign in to comment.