我正试图直接从values.yaml中构建ConfigMap数据
我的Values.yaml
myconfiguration: |-
key1: >
{ "Project" : "This is config1 test"
}
key2 : >
{
"Project" : "This is config2 test"
}
还有configMap
apiVersion: v1
kind: ConfigMap
metadata:
name: poc-secrets-configmap-{{ .Release.Namespace }}
data:
{{.Values.myconfiguration | indent 1}}
但是在Pod上检查时,数据为空
Name: poc-secrets-configmap-xxx
Namespace: xxx
Labels: app.kubernetes.io/managed-by=Helm
Annotations: meta.helm.sh/release-name: poc-secret-xxx
meta.helm.sh/release-namespace: xxx
Data
====
Events: <none>
任何人都可以建议
答案 0 :(得分:0)
您在 values.yaml 文件中缺少缩进,请选中YAML Multiline
myconfiguration: |-
key1: >
{ "Project" : "This is config1 test"
}
key2 : >
{
"Project" : "This is config2 test"
}
此外,YAML文件的建议语法是使用2个空格进行缩进,因此您可能需要将configmap更改为{{.Values.myconfiguration | indent 2}}