-
Notifications
You must be signed in to change notification settings - Fork 112
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
support filter MotanCluster.refers before refresh LoadBalance #410
Conversation
c9490ff
to
8212eb3
Compare
manageHandler.go
Outdated
} | ||
err := json.Unmarshal([]byte(configContent), &config) | ||
if err != nil { | ||
JSONError(w, "unmarshal request body failed.") |
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.
修改报错信息
core/util.go
Outdated
@@ -194,21 +194,25 @@ func TrimSplit(s string, sep string) []string { | |||
if sep == "" { | |||
return strings.Split(s, sep) | |||
} | |||
n := strings.Count(s, sep) + 1 | |||
a := make([]string, n) | |||
var a []string | |||
i := 0 |
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.
变量i已经无用了
cluster/motanCluster.go
Outdated
if len(refersAfterFilter) > 0 { | ||
refers = refersAfterFilter | ||
} | ||
vlog.Warningf("empty refers after filter, cluster: %s", m.url.GetIdentityWithRegistry()) |
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.
这个日志refers是否为空都会打印
cluster/motanCluster.go
Outdated
@@ -405,6 +426,17 @@ func (m *MotanCluster) GetRuntimeInfo() map[string]interface{} { | |||
return info | |||
} | |||
|
|||
func (m *MotanCluster) SetRefersFilters(filter RefersFilter) { |
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.
SetRefersFilters -> SetRefersFilter
manageHandler.go
Outdated
return true | ||
} | ||
url := cls.GetURL() | ||
refersFilters := config.ParseRefersFilters(url) |
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.
refersFilters 改为 refersFilter
cluster/RefersFilter.go
Outdated
var rules []RefersFilterConfig | ||
for _, filter := range list { | ||
if (filter.Group == "" && filter.Service == "") || // global filter | ||
(filter.Group != "" && filter.Group == clusterURL.Group) || // match group |
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.
逻辑不对
83dda8c
to
3d9c4dd
Compare
support filter MotanCluster.refers before refresh LoadBalance support filter MotanCluster.refers before refresh LoadBalance code review code review & bug fix
3d9c4dd
to
cf19c6f
Compare
No description provided.