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

Commit

Permalink
[kibana] Add subPath support to secretMounts
Browse files Browse the repository at this point in the history
Fixes: #229

This is needed in situation where you need to mount a specific secret as
a file in a directory that contains other files. This was added for the
Elasticsearch chart to make it possible to mount the keystore, the same
option is needed for Kibana too as seen in in #229.
  • Loading branch information
Crazybus committed Jul 22, 2019
1 parent e1583eb commit eee888a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
3 changes: 3 additions & 0 deletions kibana/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 31 additions & 1 deletion kibana/tests/kibana_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
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'
}

0 comments on commit eee888a

Please sign in to comment.