-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add support for Filter query parameter to list images api #6878
Add support for Filter query parameter to list images api #6878
Conversation
Hi @skorhone. Thanks for your PR. I'm waiting for a containers member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed 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. |
ce18785
to
6c3f80a
Compare
/ok-to-test |
pkg/api/handlers/utils/images.go
Outdated
if len(query.Filters) > 0 { | ||
for k, v := range query.Filters { | ||
queryFilters := query.Filters | ||
if len(query.Filter) > 0 { // Docker 1.24 compatibility |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, we need to make sure that we only accept this parameter for the docker-compat endpoints. There's a helper function to check if the request for libpod:
if !IsLibpodRequest(r) && en(query.Filter) > 0 { ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Added this check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix, @skorhone!
I'd love to have a test for the filter
parameter in test/apiv2/10-images.at
.
@vrothberg I'll have a look at those tests. Also, it seems that currently name/reference filter is a bit too relaxed. It does seem to allow partial matches for names and tags. If it's much of an issue with name, but tag matching should be strict. Filter for image:v1 should not match with image:v10 like it currently does. |
55dd925
to
b2e6fc9
Compare
Docker api version 1.24 uses a query parameter named Filter for filtering images by names. In more recent versions of api name filter is in filters query parameter with other filters This patch adds a mapping that translates Filter query parameter to Filters={"reference": [""]} Signed-off-by: Sami Korhonen <[email protected]>
b2e6fc9
to
610118d
Compare
@vrothberg Now there's both positive and negative test cases |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks a lot for contributing!
@baude @mheon @QiWang19 @ashley-cui PTAL |
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhatdan, skorhone The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Docker api version 1.24 uses a query parameter named Filter for filtering images by names. In more recent versions of api name filter is in filters query parameter with other filters
This patch adds a mapping that translates Filter query parameter to Filters={"reference": [""]}
Patch resolves issue: #6797