Add quotes to JSONPATH bash variable

The command was failing with

    error: error parsing jsonpath {range, unclosed action

We need to quote `$JSONPATH` so the full contents of the variable are
passed to `-o jsonpath=`.

Fixes #4258
This commit is contained in:
Iago López Galeiras
2017-09-08 13:14:21 +02:00
parent 15b57839b8
commit 02155b7b96
+1 -1
View File
@@ -128,7 +128,7 @@ $ echo $(kubectl get pods --selector=$sel --output=jsonpath={.items..metadata.na
# Check which nodes are ready
$ JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}' \
&& kubectl get nodes -o jsonpath=$JSONPATH | grep "Ready=True"
&& kubectl get nodes -o jsonpath="$JSONPATH" | grep "Ready=True"
# List all Secrets currently in use by a pod
$ kubectl get pods -o json | jq '.items[].spec.containers[].env[]?.valueFrom.secretKeyRef.name' | grep -v null | sort | uniq