patch from variable in script not working

6/21/2021

Why is this not working from script?

kubectl patch configmap/config-domain \
 --namespace knative-serving \
 --type merge \
 --patch "{"data":{"${DOMAIN_NAME}":""}}"

This expands into this:

kubectl patch configmap/config-domain \
 --namespace knative-serving \
 --type merge \
 --patch "{"data":{"MyDomain.com":""}}"

But nothing gets patched/merged?

If I manually do this then it works with using " ' ". Note: '{"data":{"MyDomain.com":""}}':

kubectl patch configmap/config-domain \
 --namespace knative-serving \
 --type merge \
 --patch '{"data":{"MyDomain.com":""}}'
-- Chris G.
kubectl
kubernetes

0 Answers