Sealed file secret feature; Will allow external files too once https://github.com/helm/helm/pull/8841 is merged
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"what": "this is a fixture"
|
||||
}
|
||||
@@ -71,7 +71,7 @@ spec:
|
||||
- name: {{ .name }}
|
||||
mountPath: {{ .path }}
|
||||
{{- end }}
|
||||
{{- range .Values.volumesFromSecretFiles }}
|
||||
{{- range .Values.sealedFileSecrets }}
|
||||
- name: {{ .name }}
|
||||
mountPath: {{ .path }}
|
||||
readOnly: true
|
||||
@@ -84,10 +84,10 @@ spec:
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ printf "%s-%s" $.Release.Name .name }}
|
||||
{{- end }}
|
||||
{{- range .Values.volumesFromSecretFiles }}
|
||||
{{- range .Values.sealedFileSecrets }}
|
||||
- name: {{ .name }}
|
||||
secret:
|
||||
secretName: {{ .name }}
|
||||
secretName: {{ printf "%s-%s" $.Release.Name .name }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
{{- range .Values.sealedFileSecrets }}
|
||||
---
|
||||
apiVersion: bitnami.com/v1alpha1
|
||||
kind: SealedSecret
|
||||
metadata:
|
||||
name: {{ printf "%s-%s" $.Release.Name .name }}
|
||||
namespace: {{ $.Release.Namespace }}
|
||||
annotations:
|
||||
sealedsecrets.bitnami.com/cluster-wide: "true"
|
||||
spec:
|
||||
encryptedData:
|
||||
{{- range $f := .filesToMount }}
|
||||
{{ $f.name }}: |-
|
||||
{{- $f.source | nindent 6 }}
|
||||
{{- /*
|
||||
{{- $.Files.Get $f.sourcePath | nindent 6 }}
|
||||
*/}}
|
||||
{{- end }}
|
||||
template:
|
||||
metadata:
|
||||
name: {{ printf "%s-%s" $.Release.Name .name }}
|
||||
namespace: {{ $.Release.Namespace }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,23 @@
|
||||
suite: test deployment
|
||||
templates:
|
||||
- sealed-file-secret.yaml
|
||||
tests:
|
||||
- it: Should generate a sealed secret with the file
|
||||
set: &values
|
||||
sealedFileSecrets:
|
||||
- name: google-account-key
|
||||
path: /google-account-key
|
||||
filesToMount:
|
||||
- name: key
|
||||
source: |-
|
||||
{
|
||||
"what": "this is a fixture"
|
||||
}
|
||||
# sourcePath: my-google-account-key.json
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.encryptedData.key
|
||||
value: |-
|
||||
{
|
||||
"what": "this is a fixture"
|
||||
}
|
||||
+4
-7
@@ -4,8 +4,8 @@ templates:
|
||||
- configmap.yaml
|
||||
tests:
|
||||
- it: Should mount volume
|
||||
set:
|
||||
volumesFromSecretFiles:
|
||||
set: &values
|
||||
sealedFileSecrets:
|
||||
- name: google-account-key
|
||||
path: /google-account-key
|
||||
filesToMount:
|
||||
@@ -19,14 +19,11 @@ tests:
|
||||
mountPath: /google-account-key
|
||||
readOnly: true
|
||||
- it: Should reference volume
|
||||
set:
|
||||
volumesFromSecretFiles:
|
||||
- name: google-account-key
|
||||
path: /google-account-key
|
||||
set: *values
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.volumes
|
||||
value:
|
||||
- name: google-account-key
|
||||
secret:
|
||||
secretName: google-account-key
|
||||
secretName: RELEASE-NAME-google-account-key
|
||||
Reference in New Issue
Block a user