-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
feat: nacos discovery support namespace and group and support multiple host #4308
Conversation
@@ -157,9 +157,23 @@ local function get_token_param(base_uri, username, password) | |||
return '&accessToken=' .. data.accessToken | |||
end | |||
|
|||
local function get_group_and_namespace_param(service_info) |
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.
Need to encode the args.
@@ -99,3 +99,97 @@ The format response as below: | |||
"action": "set" | |||
} | |||
``` | |||
|
|||
example of routing a request with a URL of "/nacosWithNamespaceIdAndGroupId/*" to a service which name, namespaceId, groupName "http://192.168.33.1:8848/nacos/v1/ns/instance/list?serviceName=APISIX-NACOS&groupName=test&namespaceId=test" and use nacos discovery client in the registry : |
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 first letter should be uppercase.
} | ||
``` | ||
|
||
example to use other nacos host |
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.
In what situation we need to switch Nacos address in the per upstream level?
@@ -389,6 +389,24 @@ local upstream_schema = { | |||
description = "discovery type", | |||
type = "string", | |||
}, | |||
discovery_host = { |
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.
Better to use nacos_address
instead.
All these 3 fields should go under a separate field called discovery_args
, as it is nacos specific.
And we need to check them only when discovery_type nacos
is used.
@@ -208,7 +222,12 @@ local function iter_and_add_service(services, values) | |||
end | |||
|
|||
if up.discovery_type == 'nacos' then | |||
core.table.insert(services, up.service_name) | |||
core.table.insert(services, { | |||
service_name=up.service_name, |
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.
Need space around the =
Test must be added for the new feature. |
My suggestion is that we need to split the PR into steps:
So that the PR can be merged quickly. |
Thx I will close this pr and open another |
What this PR does / why we need it:
#4306
support multiple host
Pre-submission checklist: