Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use variables with forward slash in kubernetes chart?

I defined the following parameters in values.yaml

resources:
  nvidia.com/gpu: 1

and in templates, I'd like to add following logic in templates/deployment.yaml

{{- if .Values.resources.nvidia.com/gpu }}
 ****
{{- end}}

But it's failed, please help me to know how to use it in templates/deployment.yaml.

like image 547
che yang Avatar asked May 25 '18 16:05

che yang


1 Answers

You can always use the function index:

  {{- if index .Values.resources "nvidia.com/gpu" }}
    x: {{ index .Values.resources "nvidia.com/gpu" }}
  {{- end}}
like image 102
Ignacio Millán Avatar answered Nov 04 '22 18:11

Ignacio Millán