Cluster-api: Using clusterctl generate yaml for Windows NamedPipes causes backslashes to be stripped

Created on 12 Dec 2020  路  5Comments  路  Source: kubernetes-sigs/cluster-api

What steps did you take and what happened:
Windows have named pipes which have the format \\.\pipe\pipename. The yaml processor for clusterctl uses the https://github.com/drone/envsubst library which is treating the \\ as a escape sequence parsing it to \.

clusterctl generate yaml --from https://github.com/kubernetes-sigs/sig-windows-tools/blob/master/kubeadm/kube-proxy/kube-proxy.yml

#output truncated
      - hostPath:
          path: \.\pipe\rancher_wins
          type: null

What did you expect to happen:
The values outside the expansions don't get processed. This is how it works with envsubt locally:

curl -LO https://raw.githubusercontent.com/kubernetes-sigs/sig-windows-tools/master/kubeadm/kube-proxy/kube-proxy.yml
envsubst < kube-proxy.yml

#output truncated
   hostPath:
          path: \\.\pipe\rancher_wins 

Anything else you would like to add:
This seems like an issue with the drone/envsubst library escaping values outside the substitutions.

I initially ran into this through the e2e tests which use the clusterctl library to do expansion. I am working around it by adding additional escapes but this makes the template not usable directly and also causes issues during the tilt workflow.

https://github.com/kubernetes-sigs/cluster-api/blob/6a7adda9ab47588c182c117aada1b084837ef03a/test/framework/clusterctl/client.go#L129

Environment:

  • Cluster-api version: 0.3.11
  • Minikube/KIND version:
  • Kubernetes version: (use kubectl version):
  • OS (e.g. from /etc/os-release):

/kind bug
/area clusterctl
/area testing

areclusterctl aretesting kinbug

All 5 comments

@wfernandes is this a clusterctl issue or an issue in the envsubst library we are importing?

Hmm...yeah I believe it does have to do with the envsubst library we are using.

If I do cat kube-proxy.yml | ./hack/tools/bin/envsubst I can see that the escape sequence is evaluated.
But if I used the envsubst (/usr/local/opt/gettext/bin/envsubst) on my mac, it doesn't evaluate the escape sequence.

Well..this is unfortunate!

After looking at the parse_test.go and seeing the examples, I think it is meant to do proper parsing for substring replacement for example.

~Maybe we can open an issue on drone/envsubst and discuss a good course of action from there.~
@jsturtevant WDYT?

Nevermind, I just saw your referenced issue. 馃檪

I opened a PR demonstrating it as well: https://github.com/drone/envsubst/issues/27

I think it should only be escaped inside the replacement but wasn't sure.

/milestone v0.4.0

Was this page helpful?
0 / 5 - 0 ratings