In values.yaml I have another yaml config encoded to base64. In a template I decode it with
{{ $config := b64dec .Values.config }}
and I need to access it like a map, so what is needed is a kind of analogue of file AsConfig but for string.
You can use Helm's fromYaml
function (haven't found any documentation besides this commit)
config.yaml which is encoded with cat config.yaml | base64
xxx: yyy
zzz: qqq
values.yaml
config: eHh4OiB5eXkKenp6OiBxcXEK
secret.yaml
{{ $config := (b64dec .Values.config) | fromYaml }}
apiVersion: v1
kind: Secret
metadata:
name: secret
type: Opaque
data:
test: {{ $config.xxx }}
helm template
/mnt/c/home/chart> helm template .
---
# Source: chart/templates/secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: secret
type: Opaque
data:
test: yyy
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With