Skip to content
This repository was archived by the owner on Jul 26, 2022. It is now read-only.

Commit ac9b9e2

Browse files
PluiesFlydiverny
authored andcommitted
feat(chart): support mounting existing secrets as files (#213)
* Support mounting existing secrets as files
1 parent 9441216 commit ac9b9e2

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

charts/kubernetes-external-secrets/templates/deployment.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ spec:
4848
name: {{ $value.secretKeyRef | quote }}
4949
key: {{ $value.key | quote }}
5050
{{- end }}
51+
{{- with .Values.filesFromSecret }}
52+
volumeMounts:
53+
{{- range $key, $value := . }}
54+
- name: {{ $key }}
55+
mountPath: {{ $value.mountPath }}
56+
readOnly: true
57+
{{- end }}
58+
{{- end }}
5159
{{- with .Values.securityContext }}
5260
securityContext:
5361
{{- toYaml . | nindent 8 }}
@@ -64,3 +72,11 @@ spec:
6472
tolerations:
6573
{{- toYaml . | nindent 8 }}
6674
{{- end }}
75+
{{- with .Values.filesFromSecret }}
76+
volumes:
77+
{{- range $key, $value := . }}
78+
- name: {{ $key }}
79+
secret:
80+
secretName: {{ $value.secret }}
81+
{{- end }}
82+
{{- end }}

charts/kubernetes-external-secrets/values.yaml

+7-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ env:
1010
METRICS_PORT: 3001
1111
VAULT_ADDR: http://127.0.0.1:8200
1212

13-
# Create environment variables from exists k8s secrets
13+
# Create environment variables from existing k8s secrets
1414
# envVarsFromSecret:
1515
# AWS_ACCESS_KEY_ID:
1616
# secretKeyRef: aws-credentials
@@ -19,6 +19,12 @@ env:
1919
# secretKeyRef: aws-credentials
2020
# key: key
2121

22+
# Create files from existing k8s secrets
23+
# filesFromSecret:
24+
# examplefile:
25+
# secret: secretname
26+
# mountPath: /a/mount/point/
27+
2228
rbac:
2329
# Specifies whether RBAC resources should be created
2430
create: true

0 commit comments

Comments
 (0)