我正在遵循https://helm.sh/docs/chart_template_guide/accessing_files/中提到的示例。
我可以在configmap中加载toml文件,但是当我使用rego文件时,我得到一个错误:
cat multiple_config.yamlapiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-configmap
data:
{{- $files := .Files }}
{{- range tuple "label-check.rego" }}
{{ . }}: |-
{{ $files.Get . }}
{{- end }}Error :-
Error: YAML parse error on opa/templates/multiple_config.yaml: error converting YAML to JSON: yaml: line 14: could not find expected ':'发布于 2020-08-01 13:36:15
您看到的错误是is a common issue?。这可能是您的rego文件中的缩进不一致。您可以在此示例中看到rego can perfectly be used in ConfigMaps。
你可以试试这个:
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-configmap
data:
{{- $files := .Files }}
{{- range tuple "label-check.rego" }}
{{ . }}: |-
{{ $files.Get . | indent 4 }}
{{- end }}✌️
https://stackoverflow.com/questions/63198785
复制相似问题