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

Commit

Permalink
[elasticsearch] Fix pvc annotations with multiple fields
Browse files Browse the repository at this point in the history
Fixes: #183

This worked just fine if there was only 1 annotation being added. When
adding multiple annotations the extra whitespace was causing it to
break.
  • Loading branch information
Crazybus committed Jun 24, 2019
1 parent 80845fc commit 2d309cb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion elasticsearch/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
name: {{ template "uname" . }}
{{- with .Values.persistence.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{ toYaml . | indent 8 }}
{{- end }}
spec:
{{ toYaml .Values.volumeClaimTemplate | indent 6 }}
Expand Down
15 changes: 14 additions & 1 deletion elasticsearch/tests/elasticsearch_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,20 @@ def test_adding_storageclass_annotation_to_volumeclaimtemplate():
'''
r = helm_template(config)
annotations = r['statefulset'][uname]['spec']['volumeClaimTemplates'][0]['metadata']['annotations']
assert {'volume.beta.kubernetes.io/storage-class': 'id'} == annotations
assert annotations['volume.beta.kubernetes.io/storage-class'] == 'id'

def test_adding_multiple_persistence_annotations():
config = '''
persistence:
annotations:
hello: world
world: hello
'''
r = helm_template(config)
annotations = r['statefulset'][uname]['spec']['volumeClaimTemplates'][0]['metadata']['annotations']

assert annotations['hello'] == 'world'
assert annotations['world'] == 'hello'


def test_adding_a_secret_mount():
Expand Down

0 comments on commit 2d309cb

Please sign in to comment.