Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubectl wait-for cannot handle JSON path filter expressions like ?(@.x==y) #1448

Closed
andreaskaris opened this issue Jul 10, 2023 · 5 comments · Fixed by kubernetes/kubernetes#118748
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. sig/cli Categorizes an issue or PR as relevant to SIG CLI.

Comments

@andreaskaris
Copy link
Contributor

andreaskaris commented Jul 10, 2023

What happened?

kubectl wait-for cannot handle JSON path filter expressions like ?(@.x==y)

See #1224 (comment)

Even without ||, using ?(x==y) fails to parse, due to this split on =:

Line 208 in [838ae9f](https://github.com/kubernetes/kubectl/commit/838ae9fd9ec21c92d9ad690a902bbbd459f98ee4)
 splitStr := strings.Split(condition, "=")

What did you expect to happen?

Do not split the string on '==' and only on '=' so that JSON path filter expressions are handled correctly

How can we reproduce it (as minimally and precisely as possible)?

The following will fail, yet it should work:

kubectl wait --for='jsonpath={.status.conditions[?(@.type=="Ready")].status}=True' pod/busybox1

Anything else we need to know?

No response

Kubernetes version

$ kubectl version
# paste output here

Cloud provider

OS version

# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here

Install tools

Container runtime (CRI) and version (if applicable)

Related plugins (CNI, CSI, ...) and versions (if applicable)

@andreaskaris andreaskaris added the kind/bug Categorizes issue or PR as related to a bug. label Jul 10, 2023
@k8s-ci-robot k8s-ci-robot added needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jul 10, 2023
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@andreaskaris andreaskaris changed the title kubectl wait-for cannot handle JSON path filter expressions like ?(x==y) kubectl wait-for cannot handle JSON path filter expressions like ?(@.x==y) Jul 10, 2023
@andreaskaris
Copy link
Contributor Author

/sig cli

@k8s-ci-robot k8s-ci-robot added sig/cli Categorizes an issue or PR as relevant to SIG CLI. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jul 10, 2023
@ardaguclu
Copy link
Member

/transfer kubectl

@k8s-ci-robot k8s-ci-robot transferred this issue from kubernetes/kubernetes Jul 11, 2023
@mpuckett159
Copy link
Contributor

/close
Duplicate of issue here
Please track this issue there. There is a PR to fix this here

@k8s-ci-robot
Copy link
Contributor

@mpuckett159: Closing this issue.

In response to this:

/close
Duplicate of issue here
Please track this issue there. There is a PR to fix this here

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. sig/cli Categorizes an issue or PR as relevant to SIG CLI.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants