I have the following Template
apiVersion: v1
kind: Secret
metadata:
name: poc-secrets-secret-data-txt-{{ .Release.Namespace }}
type: Opaque
stringData:
myZipdata: {{ .Files.Get "secrets/base64.zip" }}
I get the following error when i do install helm
error converting YAML to JSON: yaml: control characters are not allowed
My use case is to send zip file only. Can anyone suggest ?
The YAML structure can only hold textual data. Similarly, within a Secret, stringData
specifically holds textual data. Neither channel can communicate a (binary) zip file.
However: if you use data
instead of stringData
, that's allowed to contain binary data, and the Helm b64enc
function can base64 encode arbitrary binary data into a valid YAML string. There's an example in the Helm documentation "Accessing Files Inside Templates" page. For your example, you can:
apiVersion: v1
kind: Secret
metadata:
name: poc-secrets-secret-data-txt-{{ .Release.Namespace }}
type: Opaque
data: # not stringData
myZipdata: {{ .Files.Get "secrets/base64.zip" | b64enc }} # add base64 encode