Update jsonpath.md

This commit is contained in:
Daniel Mendes
2020-08-18 19:59:10 +02:00
committed by GitHub
parent 5247eaccc3
commit 6262a5dae3
@@ -101,15 +101,14 @@ kubectl get pods -o=jsonpath="{range .items[*]}{.metadata.name}{\"\t\"}{.status.
{{< note >}} {{< note >}}
JSONPath regular expressions are not supported. If you want to match using regular expressions, you can use a tool such as `jq`. JSONPath regular expressions are not supported. If you want to match using regular expressions, you can use a tool such as `jq`.
Example currently not supported
```shell ```shell
# kubectl does not suport regular expressions # kubectl does not suport regular expressions
# The following command does not work # The following command does not work
kubectl get secrets -o jsonpath='{.items[?(@.metadata.name=~/^test$/)].metadata.name}' kubectl get pods -o jsonpath='{.items[?(@.metadata.name=~/^test$/)].metadata.name}'
# The following command achieves the same result # The following command achieves the same result
kubectl get secrets -o json | jq '[needs actual example code writing before merge]' kubectl get pods -o json | jq -r '.items[] | select(.metadata.name | test("test-")).spec.containers[].image'
``` ```
{{< /note >}} {{< /note >}}