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 "}}"?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
shabbir
  • 121
  • 2
  • 6
  • 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. – Dan Aug 09 '19 at 13:24
  • Does this answer your question? [How do I escape “{{” and “}}” delimiters in Go templates?](https://stackoverflow.com/questions/17641887/how-do-i-escape-and-delimiters-in-go-templates) – OneCricketeer Feb 09 '23 at 23:24

2 Answers2

2

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

name: {{ `{{.WorkerID}}` }}
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
1

Using the {% raw %} tag:

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

Jinja2 Reference

Azza292
  • 41
  • 5