-
Notifications
You must be signed in to change notification settings - Fork 919
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=jsonpath parse #1224
Comments
Something to note is that kubectl uses a fairly basic implementation of the jsonpath spec. You can find out more about the specifics of it here. Specifically we do not support the To support this we would need to implement the usage of multiple /triage accepted |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
Even without Line 208 in 838ae9f
The I propose a simple improvement: Separate the splitting on equal sign into two phases:
This would improve the situation for the case above, but would e.g. still not allow values with A nicer solution would be to match curly brackets, but since |
A work around for a job is to use this version : kubectl wait job job-test --for jsonpath='{.status.conditions[*].status}'=True -o jsonpath='{.status.conditions[*].type} This will return if the job is complete or failed. |
Make it possible to parse jsonpath filter expressions: After splitting the condition for jsonpath, drop the first element containing the prefix, use the last element as the condition and join all middle elements as the expression. Reported-at: kubernetes#1224 Signed-off-by: Andreas Karis <[email protected]>
Make it possible to parse jsonpath filter expressions: After splitting the condition for jsonpath, drop the first element containing the prefix, use the last element as the condition and join all middle elements as the expression. Reported-at: kubernetes/kubectl#1224 Signed-off-by: Andreas Karis <[email protected]>
Implement support for multiple --for statements in wait. By default, multiple --for conditions are OR'ed. With the optional --for-all flag, they can be AND'ed. Fixes: kubernetes/kubectl#1224 Reported-at: kubernetes/kubectl#1224 Signed-off-by: Andreas Karis <[email protected]>
Make it possible to parse jsonpath filter expressions: Split jsonpath expressions on single '=' only and leave '==' as part of the string. Reported-at: kubernetes/kubectl#1224 Signed-off-by: Andreas Karis <[email protected]>
Implement support for multiple --for statements in wait. By default, multiple --for conditions are OR'ed. With the optional --for-all flag, they can be AND'ed. Fixes: kubernetes/kubectl#1224 Reported-at: kubernetes/kubectl#1224 Signed-off-by: Andreas Karis <[email protected]>
/assign |
another case that is not working is the following:
however, this works: $ kubectl get KubeadmControlPlane -n vmsp-platform management-7qck2-8p7t6 -o jsonpath='{.status.readyReplicas}={.spec.replicas}'
3=3 and this also works: $ kubectl wait --for jsonpath='{.status.readyReplicas}'=3 KubeadmControlPlane -n vmsp-platform management-7qck2-8p7t6 -n vmsp-platform --timeout=20m
kubeadmcontrolplane.controlplane.cluster.x-k8s.io/management-7qck2-8p7t6 condition met
|
Background:
kubectl does not offer a direct way to wait for multiple signals.
https://stackoverflow.com/questions/55073453/wait-for-kubernetes-job-to-complete-on-either-failure-success-using-command-line
Workaround attempt:
Use jsonpath
However, this blew up, as seen above, in an unexpected way.
Side note this will likely not work anyway as a workaround to the original issue, since the output of a jsonpath might be many paths matching, it would have been easier to just have --for=..accepted many times and use the condition form.
The text was updated successfully, but these errors were encountered: