I am a very beginner in helm so maybe this is a very trivial quiestion. I using a toll which need a yaml file for configuration. I using some variable in the yaml file which variable comes from the values .yaml file. The problem come up when I try to use helm install because that saying: 'Error: unable to decode "": Object 'Kind' is missing in'. I think it tries to use as a kubernetes yaml file. How can I skip this file to not use as a kubernetes config but include into the package because it used in a secret file with: '{{.Files.Get "config.yaml" | b64enc}}'.
Anything under templates/
inside your chart is being interpreted as a k8s resource by helm. Try placing your static non-k8s files under another path, like files/service/config.yaml
. Then you can use {{.Files.Get "files/service/config.yaml" | b64enc}}
to place it inside your secret map.
In case you want to use templating inside that file, you have to take another approach and still place it under templates/
, but define it inside a block via {{- define "my_custom_block" -}}
:
templates/service/config.yaml:
{{- define "my_conf" -}}
Content ..
{{- end -}}
templates/secret.yaml:
---
apiVersion: v1
kind: Secret
metadata:
name: secret-map
type: Opaque
data:
config.yaml: |
{{ include "my_conf" . | b64enc | indent 4 }}
Here some documentation about the include
statement.