You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(Firstly, credit to the people on the Kubernetes slack who helped me with this!)
So I have been trying to craft a query with jsonpath to find all pods with a certain annotation.
kubectl get pod --all-namespaces -o jsonpath='{range .items[?(@.metadata.annotations.prometheus\.io/scrape=="true")]}{.metadata.name}{"\n"}{end}'
the following line prevents exectution of the above as it appears to strips out the quotes in my command function kubectl() { echo "+ kubectl $@">&2; command kubectl $@; }
changing the function to the following does work - adding quotes around the shell variables (although what it echoes still removes the quotes). function kubectl() { echo "+ kubectl $@">&2; command kubectl "$@"; }
The text was updated successfully, but these errors were encountered:
stozinho
changed the title
Echo command does not work with jsonpath
function kubectl() does not work with jsonpath
Oct 6, 2020
(Firstly, credit to the people on the Kubernetes slack who helped me with this!)
So I have been trying to craft a query with jsonpath to find all pods with a certain annotation.
kubectl get pod --all-namespaces -o jsonpath='{range .items[?(@.metadata.annotations.prometheus\.io/scrape=="true")]}{.metadata.name}{"\n"}{end}'
the following line prevents exectution of the above as it appears to strips out the quotes in my command
function kubectl() { echo "+ kubectl $@">&2; command kubectl $@; }
changing the function to the following does work - adding quotes around the shell variables (although what it echoes still removes the quotes).
function kubectl() { echo "+ kubectl $@">&2; command kubectl "$@"; }
The text was updated successfully, but these errors were encountered: