1

This is my yaml file:

{{ if and (eq .Values.deploytest "true") (eq .Values-development.deploytest "false") }}
....

and i got the following error: bad character U+002D '-' Any idea?

Angel
  • 25
  • 6
  • Does this answer your question? [Helm templating doesn't let me use dash in names](https://stackoverflow.com/questions/63853679/helm-templating-doesnt-let-me-use-dash-in-names) – HiroCereal Apr 18 '23 at 17:04
  • Is `.Values-deployment` with the hyphen intentional, or should there be a `.` instead? `.Values.deployment` would be the `deployment` item from `values.yaml` or other configuration, but with the hyphen the name wouldn't normally be defined. – David Maze Apr 19 '23 at 10:29

1 Answers1

1

.Values-development is not a name helm will let you use this way.

There are a few workarounds.
You can remove the hyphen, either by just compounding the name to .Valuesdevelopment:

{{ if and (eq .Values.deploytest "true") (eq .Valuesdevelopment.deploytest "false") }}

or restructuring the tree to .Values.development:

{{ if and (eq .Values.deploytest "true") (eq .Values.development.deploytest "false") }}

or by using a lookup function such as index:

{{ $myChk := index . "Values-development" }}
{{ if and (eq .Values.deploytest "true") (eq $myChk.deploytest "false") }}

Typing these off the cuff; YMMV.

Paul Hodges
  • 13,382
  • 1
  • 17
  • 36