Skip to content
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

Closed
wants to merge 5 commits into from

Conversation

Demogorgon314
Copy link
Member

What this PR does / why we need it:

#4306
support multiple host

Pre-submission checklist:

  • Did you explain what problem does this PR solve? Or what new features have been added?
  • Have you added corresponding test cases?
  • Have you modified the corresponding document?
  • Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first

@@ -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)
Copy link
Member

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 :
Copy link
Member

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
Copy link
Member

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 = {
Copy link
Member

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,
Copy link
Member

Choose a reason for hiding this comment

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

Need space around the =

@spacewander
Copy link
Member

Test must be added for the new feature.

@spacewander
Copy link
Member

My suggestion is that we need to split the PR into steps:

  1. add namespace
  2. add group
  3. add multiple host

So that the PR can be merged quickly.

@Demogorgon314
Copy link
Member Author

My suggestion is that we need to split the PR into steps:

  1. add namespace
  2. add group
  3. add multiple host

So that the PR can be merged quickly.

Thx I will close this pr and open another

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants