September 14, 2023

Go Templating syntax is used everywhere in Kubernetes world. The most popular use case and a place you can find it are… Helm Charts. But other products such as Argo Workflows use it as well and that can sometimes become a problem – how can you properly escape… escaping syntax? Let’s see on the example.

Here I have an excerpt from WorkflowTemplate I use for OpenFaaS on my Kubernetes clusters:

apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
  name: openfaas
spec:
  arguments:
    parameters:
      - name: repoUrl
        value: "[email protected]:luktom-cloud/sample.git"

  # some parts removed for brevity [...]

  templates:
    - name: main
      dag:
        tasks:
          - name: faas-build
            inline:
              inputs:
                artifacts:
                  - name: sources
                    path: /data/src
                    git:
                      repo: "{{ workflow.parameters.repoUrl }}"
                      # [...]

This template (provided we put a full manifest for it, ofz) will work if you apply it to Kubernetes clusters, but if you move it to templates folder in Helm chart… that’s the different story:

~/t/test> helm template .
Error: parse error at (test/templates/pipeline-openfaas.yaml:44): function "workflow" not defined

Use --debug flag to render out invalid YAML

Helm thinks the escaping syntax using {{ is for templating, which is partially true as technically it’s a template, but… for Argo Workflows and we don’t want Helm to treat it as its own!

What we can do? Use template literal!

apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
  name: openfaas
spec:
  arguments:
    parameters:
      - name: repoUrl
        value: "[email protected]:luktom-cloud/sample.git"

  # some parts removed for brevity [...]

  templates:
    - name: main
      dag:
        tasks:
          - name: faas-build
            inline:
              inputs:
                artifacts:
                  - name: sources
                    path: /data/src
                    git:
                      repo: {{`"{{ workflow.parameters.repoUrl }}"`}}
                      # [...]

As you can see I surrounded my Argo Workflows template with {{` and `}} and it solves the issue!

If you have more Argo Workflow variables than Helm ones (or not have any of them), you can also surround whole file contents with {{` and `}} and it’ll do the job.

It’s not nice, I admit, but I think it’s better than dealing with post renderers in Helm, especially if you use GitOps approach with e.g. ArgoCD.

I hope that little trick save you a couple minutes of debugging!

Subscribe to my mailing list to get updated about new blog posts!

You may also find these posts interesting:

Escaping Argo Workflows templates in Helm

Go Templating syntax is used everywhere in Kubernetes world. The most popular

About the author - Łukasz Tomaszkiewicz

My name is Łukasz Tomaszkiewicz and I help developers and devops engineers to accelerate their career in public cloud.

For many years I've supported developer teams in delivering cloud based solutions - from design phase, through automation of deployment to monitoring and optimization as well as day-to-day operations.

In my professional life I'm mainly focused on AWS infrastructure, however - after hours - I like doing my own side projects as it helps me understanding the issues developers may have while using the cloud.

  • Interesting analysis! Seeing platforms like ph889 games prioritize RNG & quick onboarding (under 60s!) is key for building trust in the Philippines market. Transparency matters!

  • Interesting analysis! Seeing platforms like ph889 games prioritize RNG & quick onboarding (under 60s!) is key for building trust in the Philippines market. Transparency matters!

  • F68vip is the real deal! It’s where all the high rollers are playing. Join the VIP club and experience the difference. Check it out you won’t regret it!: f68vip

  • F68vip is the real deal! It’s where all the high rollers are playing. Join the VIP club and experience the difference. Check it out you won’t regret it!: f68vip

  • F68vip is the real deal! It’s where all the high rollers are playing. Join the VIP club and experience the difference. Check it out you won’t regret it!: f68vip

  • Yo guys, tried out ic79win recently. Its smooth, games are fun and its simple to get around. Check it out, maybe you’ll like it. Check them out here ic79win!

  • Yo guys, tried out ic79win recently. Its smooth, games are fun and its simple to get around. Check it out, maybe you’ll like it. Check them out here ic79win!

  • Yo guys, tried out ic79win recently. Its smooth, games are fun and its simple to get around. Check it out, maybe you’ll like it. Check them out here ic79win!

  • The live dealer tables are super engaging and the dealers are really friendly. I appreciate the fair gameplay and fast payouts. Definitely my go to for evening entertainment.

  • I have been following this site for a while and the improvements they keep making are clearly noticed. The match tracking feature is fantastic and I can place bets on my favorite leagues without any lag. It is easily the most reliable option I have tried recently. betwarriorperu

  • I have been following this site for a while and the improvements they keep making are clearly noticed. The match tracking feature is fantastic and I can place bets on my favorite leagues without any lag. It is easily the most reliable option I have tried recently. betwarriorperu

  • I have been following this site for a while and the improvements they keep making are clearly noticed. The match tracking feature is fantastic and I can place bets on my favorite leagues without any lag. It is easily the most reliable option I have tried recently. betwarriorperu

  • I have been exploring different betting platforms for a while now and this one really stands out from the crowd. The dashboard is super clean and the welcome offer matches exactly what they advertise. Support team responded quickly when I asked about my first deposit. Highly recommend giving it a shot if you want a hassle free experience. getwinbet

  • I have been exploring different betting platforms for a while now and this one really stands out from the crowd. The dashboard is super clean and the welcome offer matches exactly what they advertise. Support team responded quickly when I asked about my first deposit. Highly recommend giving it a shot if you want a hassle free experience. getwinbet

  • I have been searching for a reliable poker platform for months and finally found my go to spot. The interface is smooth and the community feels really welcoming. Every time I sit at a table I feel right at home. Check it out here 888pokeronline

  • I have been searching for a reliable poker platform for months and finally found my go to spot. The interface is smooth and the community feels really welcoming. Every time I sit at a table I feel right at home. Check it out here 888pokeronline

  • This platform has quickly become my daily go to for some relaxed gaming sessions. I really appreciate how smoothly it handles on older devices and how friendly the interface looks for everyone. It feels like a trusted companion that knows exactly what we need. Head over to sao789avim and experience it yourself.

  • This platform has quickly become my daily go to for some relaxed gaming sessions. I really appreciate how smoothly it handles on older devices and how friendly the interface looks for everyone. It feels like a trusted companion that knows exactly what we need. Head over to sao789avim and experience it yourself.

  • This platform has quickly become my daily go to for some relaxed gaming sessions. I really appreciate how smoothly it handles on older devices and how friendly the interface looks for everyone. It feels like a trusted companion that knows exactly what we need. Head over to sao789avim and experience it yourself.

  • Finding a betting app that actually works smoothly on Nigerian networks was always a pain until I tried this one. The login is instant and the live streaming feature keeps me glued during matches. Deposits via local banks go through in minutes and I have never dealt with such quick cashouts. My friends and I switched over completely and we keep sharing tips about the best parlays. helabettingapp

  • Finding a betting app that actually works smoothly on Nigerian networks was always a pain until I tried this one. The login is instant and the live streaming feature keeps me glued during matches. Deposits via local banks go through in minutes and I have never dealt with such quick cashouts. My friends and I switched over completely and we keep sharing tips about the best parlays. helabettingapp

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
    >