From b6cc5a649a19da31e25eed62c9b2cd1706b2bb2b Mon Sep 17 00:00:00 2001 From: huabing zhao Date: Fri, 12 Apr 2024 16:35:13 +0800 Subject: [PATCH] fix order Signed-off-by: huabing zhao --- internal/xds/translator/httpfilters.go | 8 +++++--- internal/xds/translator/httpfilters_test.go | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/internal/xds/translator/httpfilters.go b/internal/xds/translator/httpfilters.go index ca4e6bb64c3..4b19a8875e9 100644 --- a/internal/xds/translator/httpfilters.go +++ b/internal/xds/translator/httpfilters.go @@ -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 } diff --git a/internal/xds/translator/httpfilters_test.go b/internal/xds/translator/httpfilters_test.go index 47cd118da58..ee4abaca875 100644 --- a/internal/xds/translator/httpfilters_test.go +++ b/internal/xds/translator/httpfilters_test.go @@ -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), @@ -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), },