Skip to content

Commit

Permalink
fix order
Browse files Browse the repository at this point in the history
Signed-off-by: huabing zhao <zhaohuabing@gmail.com>
  • Loading branch information
zhaohuabing committed Apr 12, 2024
1 parent d0cb214 commit b6cc5a6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 5 additions & 3 deletions internal/xds/translator/httpfilters.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,14 @@ func newOrderedHTTPFilter(filter *hcmv3.HttpFilter) *OrderedHTTPFilter {
order = 5
case filter.Name == jwtAuthn:
order = 6
case filter.Name == extProcFilter:
case isFilterType(filter, extProcFilter):
order = 7
case filter.Name == localRateLimitFilter:
case isFilterType(filter, wasmFilter):
order = 8
case filter.Name == wellknown.HTTPRateLimit:
case filter.Name == localRateLimitFilter:
order = 9
case filter.Name == wellknown.HTTPRateLimit:
order = 10
case filter.Name == wellknown.Router:
order = 100
}
Expand Down
6 changes: 6 additions & 0 deletions internal/xds/translator/httpfilters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ func Test_sortHTTPFilters(t *testing.T) {
httpFilterForTest(wellknown.HTTPRateLimit),
httpFilterForTest(wellknown.Fault),
httpFilterForTest(extAuthFilter + "-route1"),
httpFilterForTest(wasmFilter + "-route1"),
httpFilterForTest(extProcFilter + "-route1"),
httpFilterForTest(localRateLimitFilter),
},
want: []*hcmv3.HttpFilter{
httpFilterForTest(wellknown.Fault),
Expand All @@ -38,6 +41,9 @@ func Test_sortHTTPFilters(t *testing.T) {
httpFilterForTest(basicAuthFilter + "-route1"),
httpFilterForTest(oauth2Filter + "-route1"),
httpFilterForTest(jwtAuthn),
httpFilterForTest(extProcFilter + "-route1"),
httpFilterForTest(wasmFilter + "-route1"),
httpFilterForTest(localRateLimitFilter),
httpFilterForTest(wellknown.HTTPRateLimit),
httpFilterForTest(wellknown.Router),
},
Expand Down

0 comments on commit b6cc5a6

Please sign in to comment.