fix the issue of regexp matching#1812
Conversation
|
|
|
Welcome @Martande8055! |
|
Please rebase to fix the CI. |
e73901d to
bd70f72
Compare
|
i have now rebased my PR @saschagrunert |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Martande8055, saschagrunert The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
fork proposal for exact-string regexp match to scope search results more accurately. "--namespace=test" should not match "test1,test2,test3,test4,testtakersnamespace" --name=example" should not match "examplepod,examplehost..etc"
What type of PR is this?
/kind bug
What this PR does / why we need it:
Observed that
crictl pods --namespace "name" --name "name" -qresults in multiple pod id results:This is because it's doing an inexact regexp match on the strings for "name" and "namespace":
I posit that if we're supplying the string values for this search function, having an exact match will resolve incorrect outputs and ensure we're only returning the exact results from the search that should match.
With the change we'd get the correct string:
I believe (but will need some help testing) that the function here that we're calling at https://github.com/kubernetes-sigs/cri-tools/blob/de83eda06541a3712faa42b87958e6428c848aef/cmd/crictl/util.go#L535C1-L547C2
Should be able to handle the regexp options.
Which issue(s) this PR fixes:
Fixes #1896
Special notes for your reviewer:
Low urgency, appreciate your time.
Does this PR introduce a user-facing change?