Skip to content

feat: support filtering the key and value of labels#13398

Open
okaybase wants to merge 2 commits into
apache:masterfrom
okaybase:label-filter
Open

feat: support filtering the key and value of labels#13398
okaybase wants to merge 2 commits into
apache:masterfrom
okaybase:label-filter

Conversation

@okaybase
Copy link
Copy Markdown
Member

Description

admin-api, only support filtering labels' key currently, however, in more scenarios, filtering is required based on both key and value, so support filtering the key and value of labels.

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. enhancement New feature or request labels May 20, 2026
Copy link
Copy Markdown
Contributor

@Baoyuantop Baoyuantop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First, this changes a public Admin API query semantic, but the documentation is not updated. docs/en/latest/admin-api.md and docs/zh/latest/admin-api.md currently only say that label filters by resource labels. They do not describe the new label=key:value format, whether value-only matching is still unsupported, or how key-only and key/value matching interact.

Second, the implementation uses k .. ":" .. v == args.label to represent key/value matching, but the label schema does not forbid : in either label keys or label values. This makes a query such as label=a:b:c ambiguous, and it can also overlap with the existing key-only matching space. Please define the query grammar first: if : is the delimiter, the docs and tests should specify how : in keys/values is handled; if : is allowed, we may need parsing or escaping rules instead of plain string concatenation.

Please add documentation and boundary tests before merging. At minimum, the tests should cover a wrong value not matching, value-only matching remaining unsupported, the old key-only behavior still working, and the expected behavior when keys or values contain :.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants