Skip to content

Commit 2438a73

Browse files
authored
fix:xds rule build (#1318)
1 parent 2ce2f5a commit 2438a73

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

Diff for: apiserver/xdsserverv3/resource/help.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ func BuildRateLimitDescriptors(rule *traffic_manage.Rule) ([]*route.RateLimit_Ac
345345
Value: arg.GetValue().GetValue().GetValue(),
346346
})
347347
case apitraffic.MatchArgument_QUERY:
348-
queryParameterValueMatch := BuildRateLimitActionQueryParameterValueMatch(descriptorKey, arg.Value)
348+
queryParameterValueMatch := BuildRateLimitActionQueryParameterValueMatch(descriptorKey, arg)
349349
actions = append(actions, &route.RateLimit_Action{
350350
ActionSpecifier: &route.RateLimit_Action_QueryParameterValueMatch_{
351351
QueryParameterValueMatch: queryParameterValueMatch,
@@ -392,22 +392,22 @@ func BuildRateLimitDescriptors(rule *traffic_manage.Rule) ([]*route.RateLimit_Ac
392392
}
393393

394394
func BuildRateLimitActionQueryParameterValueMatch(key string,
395-
value *apimodel.MatchString) *route.RateLimit_Action_QueryParameterValueMatch {
395+
arg *apitraffic.MatchArgument) *route.RateLimit_Action_QueryParameterValueMatch {
396396
queryParameterValueMatch := &route.RateLimit_Action_QueryParameterValueMatch{
397397
DescriptorKey: key,
398-
DescriptorValue: value.GetValue().GetValue(),
398+
DescriptorValue: arg.GetValue().GetValue().GetValue(),
399399
ExpectMatch: wrapperspb.Bool(true),
400400
QueryParameters: []*route.QueryParameterMatcher{},
401401
}
402-
switch value.GetType() {
402+
switch arg.GetValue().GetType() {
403403
case apimodel.MatchString_EXACT:
404404
queryParameterValueMatch.QueryParameters = []*route.QueryParameterMatcher{
405405
{
406-
Name: key,
406+
Name: arg.GetKey(),
407407
QueryParameterMatchSpecifier: &route.QueryParameterMatcher_StringMatch{
408408
StringMatch: &v32.StringMatcher{
409409
MatchPattern: &v32.StringMatcher_Exact{
410-
Exact: value.GetValue().GetValue(),
410+
Exact: arg.GetValue().GetValue().GetValue(),
411411
},
412412
},
413413
},
@@ -416,13 +416,13 @@ func BuildRateLimitActionQueryParameterValueMatch(key string,
416416
case apimodel.MatchString_REGEX:
417417
queryParameterValueMatch.QueryParameters = []*route.QueryParameterMatcher{
418418
{
419-
Name: key,
419+
Name: arg.GetKey(),
420420
QueryParameterMatchSpecifier: &route.QueryParameterMatcher_StringMatch{
421421
StringMatch: &v32.StringMatcher{
422422
MatchPattern: &v32.StringMatcher_SafeRegex{
423423
SafeRegex: &v32.RegexMatcher{
424424
EngineType: &v32.RegexMatcher_GoogleRe2{},
425-
Regex: value.GetValue().GetValue(),
425+
Regex: arg.GetValue().GetValue().GetValue(),
426426
},
427427
},
428428
},

Diff for: apiserver/xdsserverv3/server.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ func (x *XDSServer) getRegistryInfoWithCache(ctx context.Context,
337337
}
338338

339339
// 获取routing配置
340-
routerRule, err := x.namingServer.Cache().RoutingConfig().GetRouterConfig("", svc.Name, svc.Namespace)
340+
routerRule, err := x.namingServer.Cache().RoutingConfig().GetRouterConfigV2("", svc.Name, svc.Namespace)
341341
if err != nil {
342342
log.Errorf("error sync routing for namespace(%s) service(%s), info : %s", svc.Namespace,
343343
svc.Name, err.Error())

0 commit comments

Comments
 (0)