Description of problem: When parsing a list with jsonpath a extra empty item is included. Version-Release number of selected component (if applicable): 4.6.4 How reproducible: Always Steps to Reproduce: $ openshift-client-linux-4.6.4 get -n openshift-oauth-apiserver po -o jsonpath='{range .items[?(.status.phase=="Running")]}{.metadata.name}{" is Running\n"}' apiserver-655f678dd-6s2lt is Running apiserver-655f678dd-7krvg is Running apiserver-655f678dd-pzvph is Running is Running Expected results: No last line with empty .metadata.name Additional info: This doesn't happen with 4.5 client: $ openshift-client-linux-4.5.19 get -n openshift-oauth-apiserver po -o jsonpath='{range .items[?(.status.phase=="Running")]}{.metadata.name}{" is Running\n"}' apiserver-655f678dd-6s2lt is Running apiserver-655f678dd-7krvg is Running apiserver-655f678dd-pzvph is Running Confirmed every single 4.6.z version of oc and kubectl packed in the download tgz from mirror.openshift.com. For more information, I've noticed that there's one dependency related with json that has been upgraded in the change from oc-4.5-kubernetes-1.18.8 to oc-4.6-kubernetes-1.19 in openshift/kubernetes-kubectl. The dependency is github.com/json-iterator/go which has been upgraded from rev v1.1.18 to v1.1.10. Not sure if the issue comes from there, but I haven't found any other hint in our code.
Iām adding UpcomingSprint, because I was occupied by fixing bugs with higher priority/severity, developing new features with higher priority, or developing new features to improve stability at a macro level. I will revisit this bug next sprint.
A(In reply to Robin Cernin from comment #2) > I proposed a PR upstream https://github.com/kubernetes/kubernetes/pull/98057 Awesome, I'll have a look at it sometime soon-ish :-) Thanks!
I'm hoping to get to this sometime next week.
Merged upstream in https://github.com/kubernetes/kubernetes/pull/98057
We should get it along with k8s 1.22 bump, in that case.
the original problem doesn't seem like a bug because it is using incorrect jsonpath syntax. It is missing the {end} element. Please see https://kubernetes.io/docs/reference/kubectl/jsonpath/. The fix for this however caused a bug in one of our tests: https://bugzilla.redhat.com/show_bug.cgi?id=1989505. I have posted a PR for reverting the original fix: https://github.com/kubernetes/kubernetes/pull/104172 I propose closing this bug as not a bug.
Based on previous comment I'm closing this as not a bug. The original problem was that the jsonpath statement was missing {end}.