1

I am following example mentioned in https://helm.sh/docs/chart_template_guide/accessing_files/.

I am able to load toml files in configmap, but when I use rego files, I am getting an error:

cat multiple_config.yaml
apiVersion: 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 ':'
Will Beason
  • 3,417
  • 2
  • 28
  • 46
Shashank
  • 159
  • 1
  • 3
  • 6

1 Answers1

1

The error you are seeing is a common issue . It's probably an indentation inconsistency in your rego file. You can see in this example that rego can perfectly be used in ConfigMaps.

You could try this:

apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ .Release.Name }}-configmap
data:
  {{- $files := .Files }}
  {{- range tuple "label-check.rego" }}
  {{ . }}: |-
{{ $files.Get . | indent 4 }}
  {{- end }}

✌️

Rico
  • 58,485
  • 12
  • 111
  • 141