kubectl JSONPath doesn't allow use of true
or false
keywords #28678
Closed
Description
kubectl
raises an error if you use the true
/false
keywords in a filter. e.g.,
$ kubectl get pods --all-namespaces -o 'jsonpath={.items[*].status.containerStatuses[?(@.ready==false)].name}'
Error executing template: unrecognized identifier false. Printing more information for debugging the template:
template was:
{.items[*].status.containerStatuses[?(@.ready==false)].name}
...
error executing jsonpath "{.items[*].status.containerStatuses[?(@.ready==false)].name}": unrecognized identifier false
You also can't use the !
operator (e.g., ?(!@.ready)
), so I can't see any way to check if a property is false.
I've never used JSONPath before this, but it appears to be a valid query when used on http://jsonpath.com/ (although I can't find any reference documentation for JSONPath filters, so I'm not sure).