Draft for secret file mount

This commit is contained in:
Laszlo Fogas
2021-02-09 13:56:12 +01:00
parent 32a18c7ca9
commit 086b83fe62
3 changed files with 43 additions and 1 deletions
+10
View File
@@ -71,6 +71,11 @@ spec:
- name: {{ .name }}
mountPath: {{ .path }}
{{- end }}
{{- range .Values.volumesFromSecretFiles }}
- name: {{ .name }}
mountPath: {{ .path }}
readOnly: true
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
@@ -79,6 +84,11 @@ spec:
persistentVolumeClaim:
claimName: {{ printf "%s-%s" $.Release.Name .name }}
{{- end }}
{{- range .Values.volumesFromSecretFiles }}
- name: {{ .name }}
secret:
secretName: {{ .name }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
@@ -0,0 +1,32 @@
suite: test deployment
templates:
- deployment.yaml
- configmap.yaml
tests:
- it: Should mount volume
set:
volumesFromSecretFiles:
- name: google-account-key
path: /google-account-key
filesToMount:
- name: key.json
sourcePath: my-google-acoount-key.json
asserts:
- equal:
path: spec.template.spec.containers[0].volumeMounts
value:
- name: google-account-key
mountPath: /google-account-key
readOnly: true
- it: Should reference volume
set:
volumesFromSecretFiles:
- name: google-account-key
path: /google-account-key
asserts:
- equal:
path: spec.template.spec.volumes
value:
- name: google-account-key
secret:
secretName: google-account-key