How to escape "{{" and "}}" in argo workflow
Asked Answered
P

2

7

I want to run one argo workflow in which a value is surrounded with double braces. Argo tries to resolve it but I don't want argo to resolve it.

Following is a fraction of katib studyjob workflow manifest.

workerSpec: 
  goTemplate: 
    rawTemplate: |-
        apiVersion: "kubeflow.org/v1beta1"
        kind: TFJob
        metadata:
          name: {{.WorkerID}}
          namespace: kubeflow

Here argo tries to resolve {{.WorkerID}}. But I don't want argo to resolve it.

How can I do this? How can I escape "{{" and "}}"?

Phenformin answered 28/5, 2019 at 11:46 Comment(2)
Did you find an answer? In helm, this should work: {{ "{{.WorkerID}}" }}, not sure about argo though but if it uses the same go template it might.Ningsia
Does this answer your question? How do I escape “{{” and “}}” delimiters in Go templates?Sandiesandifer
S
2

You'd use a template literal, assuming you're using Helm templates

name: {{ `{{.WorkerID}}` }}
Sandiesandifer answered 9/2, 2023 at 23:24 Comment(0)
S
1

Using the {% raw %} tag:

{% raw %} {{.WorkerID}} {% endraw %}

Jinja2 Reference

Scarbrough answered 22/8, 2019 at 15:38 Comment(1)
Kubernetes YAML doesn't use JinjaSandiesandifer

© 2022 - 2024 — McMap. All rights reserved.