-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat(nacos): add metadata filtering support to nacos discovery #12445
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
base: master
Are you sure you want to change the base?
Conversation
- Add metadata validation schema in schema_def.lua - Implement metadata filtering logic in nacos discovery - Add comprehensive test cases for metadata validation - Update documentation for metadata filtering feature - Fix lint issues and code formatting
There seems to be duplicate work #12448 (coincidentally, we have similar demands). According to my understanding of apisix, all routes share the same service discovery results, so it is not suitable to filter in the discovery. |
I don't think it's a duplicate at the moment. Using metadata to filter nacos services is a very useful feature. For more information, you can check the related issue. |
@@ -54,6 +55,23 @@ local function get_key(namespace_id, group_name, service_name) | |||
return namespace_id .. '.' .. group_name .. '.' .. service_name | |||
end | |||
|
|||
|
|||
local function metadata_contains(host_metadata, route_metadata) |
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.
Could you explain what these two parameters mean?
|
||
|
||
|
||
=== TEST 28: get APISIX-NACOS info from NACOS - metadata filtering lane=b (only server2) |
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.
This case is somewhat repetitive, I think the configuration can be changed to
discovery_args:
metadata:
Test the behavior of metadata being empty.
Got it, thanks for you reply :) This is used to filter when pulling the service list from service discovery to avoid pulling a large number of useless instances. We also have similar demands when using Consul. I will try to add the following. |
Description
Add metadata filtering support to nacos discovery.
Which issue(s) this PR fixes:
Fixes #12392
Checklist