openshift document says we can use the below to get pod by name:
curl -k \
-H "Authorization: Bearer $TOKEN" \
-H 'Accept: application/json' \
https://$ENDPOINT/api/v1/namespaces/$NAMESPACE/pods/$NAME
I want to get a pod that starts with a certain string with a * wild card in the end.
Example:
curl -k \
-H "Authorization: Bearer $TOKEN" \
-H 'Accept: application/json' \
https://$ENDPOINT/api/v1/namespaces/$NAMESPACE/pods/mypod*
but this does not work.
how do i achieve what i needed?
Of cause it depends on use cases of rest api but in bash environment you have jq to match objects:
curl -k -H "Authorization: Bearer $TOKEN" -H 'Accept: application/json' https://master.lab1.example.com:8443/api/v1/namespaces/test/pods | jq '.items[] | select(.metadata.name | match("^test"))'