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!
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, Cardtime login was a breeze. Glad I found this, quick access and no fuss. Definitely makes my life easier. Check it out cardtime.
Yo, Cardtime login was a breeze. Glad I found this, quick access and no fuss. Definitely makes my life easier. Check it out cardtime.
Yo, Cardtime login was a breeze. Glad I found this, quick access and no fuss. Definitely makes my life easier. Check it out cardtime.