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

Jsonpath impl does not support left match regex #124157

Open
rotty3000 opened this issue Apr 2, 2024 · 3 comments · May be fixed by #124158
Open

Jsonpath impl does not support left match regex #124157

rotty3000 opened this issue Apr 2, 2024 · 3 comments · May be fixed by #124158
Labels
kind/feature Categorizes issue or PR as related to a new feature. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/cli Categorizes an issue or PR as relevant to SIG CLI. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@rotty3000
Copy link

rotty3000 commented Apr 2, 2024

What would you like to be added?

I would like to have support for =~ in jsonpath filter expressions.

e.g.

Matches a Golang regular expression. For example, k get pods -o jsonpath='{.items[?(@.metadata.name =~ /^node.*/i)].metadata.name}' matches items whose description starts with node (case-insensitive).

Why is this needed?

When many resources exist in the system being able to match by regex can greatly simplify locating the desired resources.

Note: I am willing to contribute an implementation.

@rotty3000 rotty3000 added the kind/feature Categorizes issue or PR as related to a new feature. label Apr 2, 2024
@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 Apr 2, 2024
rotty3000 added a commit to rotty3000/kubernetes that referenced this issue Apr 2, 2024
fixes kubernetes#124157

Signed-off-by: Raymond Augé <raymond.auge@liferay.com>
rotty3000 added a commit to rotty3000/kubernetes that referenced this issue Apr 2, 2024
fixes kubernetes#124157

Signed-off-by: Raymond Augé <raymond.auge@liferay.com>
rotty3000 added a commit to rotty3000/kubernetes that referenced this issue Apr 2, 2024
fixes kubernetes#124157

Signed-off-by: Raymond Augé <raymond.auge@liferay.com>
@neolit123
Copy link
Member

/sig api-machinery

@k8s-ci-robot k8s-ci-robot added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Apr 3, 2024
@alexzielenski
Copy link
Contributor

/sig cli
/cc @jpbetz
/triage accepted

@k8s-ci-robot k8s-ci-robot added sig/cli Categorizes an issue or PR as relevant to SIG CLI. triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Apr 9, 2024
@jpbetz
Copy link
Contributor

jpbetz commented Apr 12, 2024

I'll defer to sig-cli for the kubectl functionality, which I think is front and center here.

But just to clarify the server side aspects-- on the apiserver we only use a very limited subset of json path, typically we only allow a dot separated list of field names like supported by CRD additionalPrinterColumns and similar. I don't anticipate that being expanded. We're trending toward use of CEL server side to perform more involved operations, including plans to use it for field extraction, and so I don't think we'll be investing in json path in the apiserver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/cli Categorizes an issue or PR as relevant to SIG CLI. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Status: Needs Triage
Development

Successfully merging a pull request may close this issue.

5 participants