diff --git a/kibana/templates/deployment.yaml b/kibana/templates/deployment.yaml index e31f5c6e5..39e947e93 100644 --- a/kibana/templates/deployment.yaml +++ b/kibana/templates/deployment.yaml @@ -109,6 +109,9 @@ spec: {{- range .Values.secretMounts }} - name: {{ .name }} mountPath: {{ .path }} + {{- if .subPath }} + subPath: {{ .subPath }} + {{- end }} {{- end }} {{- range $path, $config := .Values.kibanaConfig }} - name: kibanaconfig diff --git a/kibana/tests/kibana_test.py b/kibana/tests/kibana_test.py index b85315f4a..71548c3dc 100644 --- a/kibana/tests/kibana_test.py +++ b/kibana/tests/kibana_test.py @@ -355,4 +355,34 @@ def test_override_imagePullPolicy(): r = helm_template(config) c = r['deployment'][name]['spec']['template']['spec']['containers'][0] - assert c['imagePullPolicy'] == 'Always' \ No newline at end of file + assert c['imagePullPolicy'] == 'Always' + +def test_adding_a_secret_mount_with_subpath(): + config = ''' +secretMounts: + - name: elastic-certificates + secretName: elastic-certs + path: /usr/share/elasticsearch/config/certs + subPath: cert.crt +''' + r = helm_template(config) + d = r['deployment'][name]['spec']['template']['spec'] + assert d['containers'][0]['volumeMounts'][-1] == { + 'mountPath': '/usr/share/elasticsearch/config/certs', + 'subPath': 'cert.crt', + 'name': 'elastic-certificates' + } + +def test_adding_a_secret_mount_without_subpath(): + config = ''' +secretMounts: + - name: elastic-certificates + secretName: elastic-certs + path: /usr/share/elasticsearch/config/certs +''' + r = helm_template(config) + d = r['deployment'][name]['spec']['template']['spec'] + assert d['containers'][0]['volumeMounts'][-1] == { + 'mountPath': '/usr/share/elasticsearch/config/certs', + 'name': 'elastic-certificates' + }