xiaobaicai66695 commented on code in PR #1553:
URL: https://github.com/apache/dubbo-admin/pull/1553#discussion_r4302202425
##########
pkg/discovery/zk/factory.go:
##########
@@ -130,18 +132,37 @@ func toUpsertZKConfigResource(mesh, nodePath, nodeData
string) coremodel.Resourc
}
func toDeleteZKConfigResource(mesh, nodePath string) coremodel.Resource {
- paths := strings.Split(nodePath, constants.PathSeparator)
- if len(paths) != 4 {
+ configName, ok := zkConfigName(nodePath)
+ if !ok {
return nil
}
- configName := paths[3]
res := meshresource.NewZKConfigResourceWithAttributes(configName, mesh)
res.Spec = &meshproto.ZKConfig{
NodeName: configName,
}
return res
}
+// zkConfigName accepts the Dubbo 3 grouped config path
+// /dubbo/config/dubbo/<ruleName> and the legacy flat path
+// /dubbo/config/<ruleName>. Group/root nodes are not rules.
+func zkConfigName(nodePath string) (string, bool) {
+ paths := strings.Split(strings.Trim(nodePath, constants.PathSeparator),
constants.PathSeparator)
+ // Trim above removes the leading slash, therefore the grouped form has
+ // [dubbo config dubbo rule] and the legacy form [dubbo config rule].
+ switch len(paths) {
+ case 3:
+ if paths[2] != "" && paths[2] != constants.RuleConfigGroup {
+ return paths[2], true
+ }
+ case 4:
+ if paths[2] == constants.RuleConfigGroup && paths[3] != "" {
+ return paths[3], true
Review Comment:
One scope note for your review: the existing Go Admin ZooKeeper handling for
Configurator, Condition, and Tag writes the flat /dubbo/config/<ruleName> path.
Current Dubbo-Go consumers resolve these rules under the dubbo group, so those
Admin-published rules may appear successful in Admin while having no effect on
a Go consumer. This fix moves those three existing rule kinds to
/dubbo/config/dubbo/<ruleName> as well. Since you maintain those routers, could
you please review that compatibility correction specifically? Affinity and
Script already have real ZooKeeper → Dubbo-Go listener → RouterChain
create/update/delete E2E coverage, while Configurator, Condition, and Tag do
not yet have similar E2E tests.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]