Skip to content

Commit

Permalink
Adding ability to use additional fields for volume mounts (#97)
Browse files Browse the repository at this point in the history
* Allow ability to have custom values for volume mounts

* fixing syntax and indentation

* Add tests
  • Loading branch information
trahim authored Aug 15, 2024
1 parent 05d9d58 commit 39d8be4
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 4 deletions.
6 changes: 2 additions & 4 deletions templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,8 @@ spec:
mountPath: "/benthos.yaml"
subPath: "benthos.yaml"
readOnly: true
{{- range .Values.extraVolumeMounts }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
readOnly: {{ .readOnly }}
{{- if .Values.extraVolumeMounts }}
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
{{- end }}
{{- if and .Values.streams.enabled .Values.streams.streamsConfigMap }}
- name: streams
Expand Down
47 changes: 47 additions & 0 deletions tests/deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,50 @@ tests:
- configMap:
name: my-config-map
name: streams

- it: should allow custom volume mounts
set:
deployment:
rolloutConfigMap: false
streams:
enabled: true
api:
enable: false
streamsConfigMap: "my-config-map"
extraVolumeMounts:
- mountPath: /testing
name: test
readOnly: true
subPath: testPath
asserts:
- equal:
path: spec.template.spec.containers[0].args
value:
- -c
- /benthos.yaml
- streams
- --no-api
- /streams/*.yaml
- equal:
path: spec.template.spec.containers[0].volumeMounts
value:
- mountPath: /benthos.yaml
name: config
readOnly: true
subPath: benthos.yaml
- mountPath: /testing
name: test
readOnly: true
subPath: testPath
- mountPath: /streams
name: streams
readOnly: true
- equal:
path: spec.template.spec.volumes
value:
- configMap:
name: RELEASE-NAME-benthos-config
name: config
- configMap:
name: my-config-map
name: streams

0 comments on commit 39d8be4

Please sign in to comment.