From 631db37799fb52fc5e0d8c38a9a8980ad3dcebf1 Mon Sep 17 00:00:00 2001 From: spacewander Date: Mon, 4 Nov 2024 11:53:04 +0800 Subject: [PATCH] change: switch the default Envoy version to 1.32 Signed-off-by: spacewander --- .github/workflows/test.yml | 7 ++- .golangci.yml | 2 +- api/go.mod | 6 +- api/go.sum | 8 +-- api/pkg/filtermanager/api/api.go | 2 + api/pkg/filtermanager/api_impl_129.go | 4 ++ api/pkg/filtermanager/api_impl_131_132.go | 27 +++++++++ ...anager_dev.go => filtermanager_129_131.go} | 37 ++++++++---- api/pkg/filtermanager/filtermanager_latest.go | 40 ++++--------- .../tests/integration/dataplane/data_plane.go | 2 +- api/plugins/tests/pkg/envoy/capi.go | 3 + .../integration/filtermanager_dev_test.go | 60 ------------------- .../integration/filtermanager_latest_test.go | 32 +++++++++- common.mk | 4 +- controller/go.mod | 2 +- .../controller/filterpolicy_controller.go | 2 - .../internal/translation/data_plane_state.go | 4 -- .../translation/data_plane_state_test.go | 1 - .../controller/consumer_controller_test.go | 1 - .../dynamicconfig_controller_test.go | 3 - .../serviceregistry_controller_test.go | 4 -- e2e/go.mod | 2 +- go.work | 2 +- patch/switch-envoy-go-version.sh | 4 +- plugins/go.mod | 2 +- plugins/plugins/keyauth/config_test.go | 2 +- plugins/plugins/limitreq/config_test.go | 2 +- .../docs/developer-guide/dataplane_support.md | 3 +- .../docs/developer-guide/dataplane_support.md | 3 +- types/apis/v1/validation_test.go | 2 +- types/go.mod | 2 +- 31 files changed, 134 insertions(+), 141 deletions(-) create mode 100644 api/pkg/filtermanager/api_impl_131_132.go rename api/pkg/filtermanager/{filtermanager_dev.go => filtermanager_129_131.go} (53%) delete mode 100644 api/tests/integration/filtermanager_dev_test.go diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d424183a..e8a0f5ca 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,6 +29,7 @@ jobs: envoy_version: - 1.29 - 1.31 + - 1.32 - dev env: ENVOY_API_VERSION: ${{ matrix.envoy_version }} @@ -50,13 +51,13 @@ jobs: FULL_ENVOY_VERSION=${ENVOY_API_VERSION}.0 if [[ $ENVOY_API_VERSION == dev ]]; then # update this once there are more breaking changes - FULL_ENVOY_VERSION=1.31.1-0.20240909145059-353737786a7f - # This is the envoy:contrib-dev image pull in 2024-09-25. + FULL_ENVOY_VERSION=1.32.1-0.20241102031349-fcdc9d6d5a9d + # This is the envoy:contrib-dev image pull in 2024-11-04. # Use docker inspect --format='{{index .RepoDigests 0}}' envoyproxy/envoy:contrib-dev to get the sha256 ID. # We don't use the envoy:contrib-dev tag directly because it will be rewritten by the latest commit and # our test suite uses IfPresent policy to pull image. # We don't use the CI to catch the breaking change from the upstream so far. - export PROXY_IMAGE=envoyproxy/envoy@sha256:845c392c1f128a00c49439d129ca9f2c12ff8748aeb42c8aa2b3b8240d6e0d5b + export PROXY_IMAGE=envoyproxy/envoy@sha256:d7e833bc15746ff10734cabfbe9211d637ce4ea1d4e1bb678ed13b91e602a647 echo PROXY_IMAGE=$PROXY_IMAGE >> $GITHUB_ENV fi pushd .. diff --git a/.golangci.yml b/.golangci.yml index 43883018..02fe950c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -7,7 +7,7 @@ linters: - bodyclose - contextcheck - errcheck - - exportloopref # replace it with copyloopref once we upgrade the minimal Go requirement to 1.22 + - copyloopvar - forcetypeassert - gocheckcompilerdirectives - gocritic diff --git a/api/go.mod b/api/go.mod index 242f20f6..9ecddaa8 100644 --- a/api/go.mod +++ b/api/go.mod @@ -16,12 +16,12 @@ module mosn.io/htnn/api // This module puts the filtermanager and the API and test framework which can be used in the plugins. -go 1.21 +go 1.22 require ( github.com/agiledragon/gomonkey/v2 v2.11.0 github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa - github.com/envoyproxy/envoy v1.31.0 + github.com/envoyproxy/envoy v1.32.0 github.com/envoyproxy/go-control-plane v0.12.1-0.20240117015050-472addddff92 // version used by istio 1.21 github.com/envoyproxy/protoc-gen-validate v1.0.4 github.com/go-logr/logr v1.4.1 @@ -31,7 +31,7 @@ require ( go.uber.org/zap v1.27.0 golang.org/x/net v0.24.0 google.golang.org/grpc v1.63.2 - google.golang.org/protobuf v1.34.1 + google.golang.org/protobuf v1.35.1 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/api/go.sum b/api/go.sum index 778f3637..19ced184 100644 --- a/api/go.sum +++ b/api/go.sum @@ -6,8 +6,8 @@ github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa h1:jQCWAUqqlij9Pgj2i/P github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa/go.mod h1:x/1Gn8zydmfq8dk6e9PdstVsDgu9RuyIIJqAaF//0IM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/envoy v1.31.0 h1:NsTo+medzu0bMffXAjl+zKaViLOShKuIZWQnKKYq0/4= -github.com/envoyproxy/envoy v1.31.0/go.mod h1:ujBFxE543X8OePZG+FbeR9LnpBxTLu64IAU7A20EB9A= +github.com/envoyproxy/envoy v1.32.0 h1:l3WDpm1VsQ+HuvTTKV01p+hIEvoRPB4Mndt9pAg5B2Y= +github.com/envoyproxy/envoy v1.32.0/go.mod h1:KGS+IUehDX1mSIdqodPTWskKOo7bZMLLy3GHxvOKcJk= github.com/envoyproxy/go-control-plane v0.12.1-0.20240117015050-472addddff92 h1:/3bsjkhOTh0swUKDBxL1+3MrXCxrf/sEEMseiIEJg00= github.com/envoyproxy/go-control-plane v0.12.1-0.20240117015050-472addddff92/go.mod h1:ZBTaoJ23lqITozF0M6G4/IragXCQKCnYbmlmtHvwRG0= github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= @@ -59,8 +59,8 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1: google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= -google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= -google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/api/pkg/filtermanager/api/api.go b/api/pkg/filtermanager/api/api.go index 7861838b..aba1b7bf 100644 --- a/api/pkg/filtermanager/api/api.go +++ b/api/pkg/filtermanager/api/api.go @@ -213,6 +213,8 @@ type StreamFilterCallbacks interface { // ClearRouteCache clears the route cache for the current request, and filtermanager will re-fetch the route in the next filter. // Please be careful to invoke it, since filtermanager will raise an 404 route_not_found response when failed to re-fetch a route. ClearRouteCache() + // RefreshRouteCache works like ClearRouteCache, but it will re-fetch the route immediately. + RefreshRouteCache() // Methods added by HTNN diff --git a/api/pkg/filtermanager/api_impl_129.go b/api/pkg/filtermanager/api_impl_129.go index 5e632485..ec4a2853 100644 --- a/api/pkg/filtermanager/api_impl_129.go +++ b/api/pkg/filtermanager/api_impl_129.go @@ -33,6 +33,10 @@ func (cb *filterManagerCallbackHandler) ClearRouteCache() { api.LogErrorf("ClearRouteCache is not implemented: %s", debug.Stack()) } +func (cb *filterManagerCallbackHandler) RefreshRouteCache() { + api.LogErrorf("RefreshRouteCache is not implemented: %s", debug.Stack()) +} + func (cb *filterManagerCallbackHandler) DecoderFilterCallbacks() api.DecoderFilterCallbacks { return cb.FilterCallbackHandler } diff --git a/api/pkg/filtermanager/api_impl_131_132.go b/api/pkg/filtermanager/api_impl_131_132.go new file mode 100644 index 00000000..22c373ab --- /dev/null +++ b/api/pkg/filtermanager/api_impl_131_132.go @@ -0,0 +1,27 @@ +// Copyright The HTNN Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build !envoy1.29 && !envoydev + +package filtermanager + +import ( + "runtime/debug" + + "mosn.io/htnn/api/pkg/filtermanager/api" +) + +func (cb *filterManagerCallbackHandler) RefreshRouteCache() { + api.LogErrorf("RefreshRouteCache is not implemented: %s", debug.Stack()) +} diff --git a/api/pkg/filtermanager/filtermanager_dev.go b/api/pkg/filtermanager/filtermanager_129_131.go similarity index 53% rename from api/pkg/filtermanager/filtermanager_dev.go rename to api/pkg/filtermanager/filtermanager_129_131.go index 8502847c..38d8434b 100644 --- a/api/pkg/filtermanager/filtermanager_dev.go +++ b/api/pkg/filtermanager/filtermanager_129_131.go @@ -12,34 +12,51 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build envoydev +//go:build envoy1.29 || envoy1.31 package filtermanager import ( capi "github.com/envoyproxy/envoy/contrib/golang/common/go/api" + + "mosn.io/htnn/api/pkg/filtermanager/api" ) const ( - supportGettingHeadersOnLog = true + supportGettingHeadersOnLog = false ) -func (m *filterManager) OnLog(reqHdr capi.RequestHeaderMap, reqTrailer capi.RequestTrailerMap, rspHdr capi.ResponseHeaderMap, rspTrailer capi.ResponseTrailerMap) { +func (m *filterManager) OnLog(_ capi.RequestHeaderMap, _ capi.RequestTrailerMap, _ capi.ResponseHeaderMap, _ capi.ResponseTrailerMap) { if m.canSkipOnLog { return } - wrappedReqHdr := &filterManagerRequestHeaderMap{ - RequestHeaderMap: reqHdr, - } - m.runOnLogPhase(wrappedReqHdr, reqTrailer, rspHdr, rspTrailer) + var reqHdr api.RequestHeaderMap + m.hdrLock.Lock() + reqHdr = m.reqHdr + m.hdrLock.Unlock() + var rspHdr api.ResponseHeaderMap + m.hdrLock.Lock() + rspHdr = m.rspHdr + m.hdrLock.Unlock() + + m.runOnLogPhase(reqHdr, nil, rspHdr, nil) +} + +type filterManagerWrapper struct { + *filterManager +} + +func (w *filterManagerWrapper) OnLog() { + w.filterManager.OnLog(nil, nil, nil, nil) } func wrapFilterManager(fm *filterManager) capi.StreamFilter { - return fm + return &filterManagerWrapper{fm} } -// This method is test only +// This method is only for test func unwrapFilterManager(wrapper capi.StreamFilter) *filterManager { - return wrapper.(*filterManager) + fmw, _ := wrapper.(*filterManagerWrapper) + return fmw.filterManager } diff --git a/api/pkg/filtermanager/filtermanager_latest.go b/api/pkg/filtermanager/filtermanager_latest.go index 8c2eb1ec..f5783b0f 100644 --- a/api/pkg/filtermanager/filtermanager_latest.go +++ b/api/pkg/filtermanager/filtermanager_latest.go @@ -12,53 +12,35 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build !envoydev +//go:build !envoydev && !envoy1.29 && !envoy1.31 package filtermanager import ( capi "github.com/envoyproxy/envoy/contrib/golang/common/go/api" - - "mosn.io/htnn/api/pkg/filtermanager/api" ) const ( - supportGettingHeadersOnLog = false + supportGettingHeadersOnLog = true ) -func (m *filterManager) OnLog(_ capi.RequestHeaderMap, _ capi.RequestTrailerMap, _ capi.ResponseHeaderMap, _ capi.ResponseTrailerMap) { +func (m *filterManager) OnLog(reqHdr capi.RequestHeaderMap, reqTrailer capi.RequestTrailerMap, rspHdr capi.ResponseHeaderMap, rspTrailer capi.ResponseTrailerMap) { if m.canSkipOnLog { return } - var reqHdr api.RequestHeaderMap - m.hdrLock.Lock() - reqHdr = m.reqHdr - m.hdrLock.Unlock() - var rspHdr api.ResponseHeaderMap - m.hdrLock.Lock() - rspHdr = m.rspHdr - m.hdrLock.Unlock() - - m.runOnLogPhase(reqHdr, nil, rspHdr, nil) -} - -type filterManagerWrapper struct { - *filterManager -} - -func (w *filterManagerWrapper) OnLog() { - w.filterManager.OnLog(nil, nil, nil, nil) + wrappedReqHdr := &filterManagerRequestHeaderMap{ + RequestHeaderMap: reqHdr, + } + m.runOnLogPhase(wrappedReqHdr, reqTrailer, rspHdr, rspTrailer) } -// we will get rid of this wrapper once Envoy 1.32 is released - func wrapFilterManager(fm *filterManager) capi.StreamFilter { - return &filterManagerWrapper{fm} + return fm } -// This method is test only +// This method is only for test func unwrapFilterManager(wrapper capi.StreamFilter) *filterManager { - fmw, _ := wrapper.(*filterManagerWrapper) - return fmw.filterManager + p, _ := wrapper.(*filterManager) + return p } diff --git a/api/plugins/tests/integration/dataplane/data_plane.go b/api/plugins/tests/integration/dataplane/data_plane.go index 8b95359a..a9b42a21 100644 --- a/api/plugins/tests/integration/dataplane/data_plane.go +++ b/api/plugins/tests/integration/dataplane/data_plane.go @@ -149,7 +149,7 @@ func StartDataPlane(t *testing.T, opt *Option) (*DataPlane, error) { // Since we only care about the coverage in CI, it is fine so far. } - image := "m.daocloud.io/docker.io/envoyproxy/envoy:contrib-v1.31.2" + image := "m.daocloud.io/docker.io/envoyproxy/envoy:contrib-v1.32.0" specifiedImage := os.Getenv("PROXY_IMAGE") if specifiedImage != "" { diff --git a/api/plugins/tests/pkg/envoy/capi.go b/api/plugins/tests/pkg/envoy/capi.go index 89b9f710..17f19fcb 100644 --- a/api/plugins/tests/pkg/envoy/capi.go +++ b/api/plugins/tests/pkg/envoy/capi.go @@ -558,6 +558,9 @@ func (i *filterCallbackHandler) GetProperty(key string) (string, error) { func (i *filterCallbackHandler) ClearRouteCache() { } +func (i *filterCallbackHandler) RefreshRouteCache() { +} + func (i *filterCallbackHandler) LookupConsumer(_, _ string) (api.Consumer, bool) { return nil, false } diff --git a/api/tests/integration/filtermanager_dev_test.go b/api/tests/integration/filtermanager_dev_test.go deleted file mode 100644 index dcb01b69..00000000 --- a/api/tests/integration/filtermanager_dev_test.go +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright The HTNN Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//go:build envoydev - -package integration - -import ( - "bytes" - "net/http" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "mosn.io/htnn/api/pkg/filtermanager" - "mosn.io/htnn/api/pkg/filtermanager/model" - "mosn.io/htnn/api/plugins/tests/integration/dataplane" -) - -func TestFilterManagerLogWithTrailers(t *testing.T) { - dp, err := dataplane.StartDataPlane(t, &dataplane.Option{ - ExpectLogPattern: []string{ - `receive request trailers: .*expires:Wed, 21 Oct 2015 07:28:00 GMT.*`, - }, - }) - if err != nil { - t.Fatalf("failed to start data plane: %v", err) - return - } - defer dp.Stop() - - lp := &filtermanager.FilterManagerConfig{ - Plugins: []*model.FilterConfig{ - { - Name: "onLog", - Config: &Config{}, - }, - }, - } - - controlPlane.UseGoPluginConfig(t, lp, dp) - hdr := http.Header{} - trailer := http.Header{} - trailer.Add("Expires", "Wed, 21 Oct 2015 07:28:00 GMT") - resp, err := dp.PostWithTrailer("/echo", hdr, bytes.NewReader([]byte("test")), trailer) - require.Nil(t, err) - assert.Equal(t, 200, resp.StatusCode) -} diff --git a/api/tests/integration/filtermanager_latest_test.go b/api/tests/integration/filtermanager_latest_test.go index 4e56616f..308433e5 100644 --- a/api/tests/integration/filtermanager_latest_test.go +++ b/api/tests/integration/filtermanager_latest_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build !envoy1.29 +//go:build !envoy1.29 && !envoy1.31 package integration @@ -309,3 +309,33 @@ Response trailers received: }) } } + +func TestFilterManagerLogWithTrailers(t *testing.T) { + dp, err := dataplane.StartDataPlane(t, &dataplane.Option{ + ExpectLogPattern: []string{ + `receive request trailers: .*expires:Wed, 21 Oct 2015 07:28:00 GMT.*`, + }, + }) + if err != nil { + t.Fatalf("failed to start data plane: %v", err) + return + } + defer dp.Stop() + + lp := &filtermanager.FilterManagerConfig{ + Plugins: []*model.FilterConfig{ + { + Name: "onLog", + Config: &Config{}, + }, + }, + } + + controlPlane.UseGoPluginConfig(t, lp, dp) + hdr := http.Header{} + trailer := http.Header{} + trailer.Add("Expires", "Wed, 21 Oct 2015 07:28:00 GMT") + resp, err := dp.PostWithTrailer("/echo", hdr, bytes.NewReader([]byte("test")), trailer) + require.Nil(t, err) + assert.Equal(t, 200, resp.StatusCode) +} diff --git a/common.mk b/common.mk index 10176d8f..cc6a9a34 100644 --- a/common.mk +++ b/common.mk @@ -29,8 +29,8 @@ DOCKER_MIRROR = m.daocloud.io/ # Both images use glibc 2.31. Ensure libc in the images match each other. BUILD_IMAGE ?= $(DOCKER_MIRROR)docker.io/library/golang:1.22-bullseye -ENVOY_API_VERSION ?= 1.31 -PROXY_IMAGE ?= $(DOCKER_MIRROR)docker.io/envoyproxy/envoy:contrib-v1.31.2 +ENVOY_API_VERSION ?= 1.32 +PROXY_IMAGE ?= $(DOCKER_MIRROR)docker.io/envoyproxy/envoy:contrib-v1.32.0 # We also support other Envoy versions. See https://github.com/mosn/htnn/tree/main/site/content/en/docs/developer-guide/dataplane_support.md # We may need to use timestamp if we need to update the image in one PR diff --git a/controller/go.mod b/controller/go.mod index 72a9f883..bee3fda6 100644 --- a/controller/go.mod +++ b/controller/go.mod @@ -19,7 +19,7 @@ module mosn.io/htnn/controller // a non-release version of mosn.io/htnn/xxx module, you may need to manually update the // dependency yourself, such as using replace in go.mod -go 1.21.5 +go 1.22 require ( github.com/agiledragon/gomonkey/v2 v2.11.0 diff --git a/controller/internal/controller/filterpolicy_controller.go b/controller/internal/controller/filterpolicy_controller.go index 48f70988..60b05431 100644 --- a/controller/internal/controller/filterpolicy_controller.go +++ b/controller/internal/controller/filterpolicy_controller.go @@ -520,7 +520,6 @@ func (r *FilterPolicyReconciler) policyToTranslationState(ctx context.Context, return nil, fmt.Errorf("failed to list HTTPFilterPolicy: %w", err) } for _, p := range httpfilterpolicies.Items { - p := p // avoid capturing loop variable policies.Items = append(policies.Items, mosniov1.ConvertHTTPFilterPolicyToFilterPolicy(&p)) } @@ -834,7 +833,6 @@ func (r *FilterPolicyReconciler) SetupWithManager(mgr ctrl.Manager) error { predicate.AnnotationChangedPredicate{}, ) for name, idxer := range r.indexers { - idxer := idxer ss := strings.Split(name, "/") group := ss[0] kind := ss[1] diff --git a/controller/internal/translation/data_plane_state.go b/controller/internal/translation/data_plane_state.go index 4213c0df..2d1d81dd 100644 --- a/controller/internal/translation/data_plane_state.go +++ b/controller/internal/translation/data_plane_state.go @@ -265,7 +265,6 @@ func toDataPlaneState(ctx *Ctx, state *InitState) (*FinalState, error) { Proxies: make(map[Proxy]*proxyConfig), } for id, vsp := range state.VirtualServicePolicies { - id := id // the copied id will be referenced by address later gws := vsp.Gateways spec := &vsp.VirtualService.Spec routeNsName := &types.NamespacedName{ @@ -294,7 +293,6 @@ func toDataPlaneState(ctx *Ctx, state *InitState) (*FinalState, error) { } for id, route := range state.HTTPRoutePolicies { - id := id // the copied id will be referenced by address later gws := route.Gateways spec := &route.HTTPRoute.Spec routeNsName := &types.NamespacedName{ @@ -314,7 +312,6 @@ func toDataPlaneState(ctx *Ctx, state *InitState) (*FinalState, error) { Name: gw.Name, } for _, ls := range gw.Spec.Listeners { - ls := ls matched := false for _, ref := range route.HTTPRoute.Spec.ParentRefs { if ref.Port != nil && *ref.Port != ls.Port { @@ -354,7 +351,6 @@ func toDataPlaneState(ctx *Ctx, state *InitState) (*FinalState, error) { } for gs, gwp := range state.GatewayPolicies { - gs := gs // the copied id will be referenced by address later // Port with Policies should be added first addServerPortToProxy(&gs, *gwp.Port, s.Proxies, gwp.Policies) } diff --git a/controller/internal/translation/data_plane_state_test.go b/controller/internal/translation/data_plane_state_test.go index cbbb0b96..2d50bb45 100644 --- a/controller/internal/translation/data_plane_state_test.go +++ b/controller/internal/translation/data_plane_state_test.go @@ -162,7 +162,6 @@ func TestAllowRoute(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { actual := AllowRoute(tt.cond, route, gwNsName) if actual != tt.expected { diff --git a/controller/tests/integration/controller/consumer_controller_test.go b/controller/tests/integration/controller/consumer_controller_test.go index 5d6dec1d..25768a5a 100644 --- a/controller/tests/integration/controller/consumer_controller_test.go +++ b/controller/tests/integration/controller/consumer_controller_test.go @@ -81,7 +81,6 @@ var _ = Describe("Consumer controller", func() { } handled := len(consumers.Items) == 2 for _, item := range consumers.Items { - item := item if item.Name == "spacewander" { c = &item cs = c.Status.Conditions diff --git a/controller/tests/integration/controller/dynamicconfig_controller_test.go b/controller/tests/integration/controller/dynamicconfig_controller_test.go index cc4d156c..e4b35cb3 100644 --- a/controller/tests/integration/controller/dynamicconfig_controller_test.go +++ b/controller/tests/integration/controller/dynamicconfig_controller_test.go @@ -77,7 +77,6 @@ var _ = Describe("DynamicConfig controller", func() { } handled := len(configs.Items) == 1 for _, item := range configs.Items { - item := item if item.Name == "test" { c = &item cs = c.Status.Conditions @@ -118,7 +117,6 @@ var _ = Describe("DynamicConfig controller", func() { return false } for _, item := range configs.Items { - item := item if item.Name == "test" { c = &item cs = c.Status.Conditions @@ -153,7 +151,6 @@ var _ = Describe("DynamicConfig controller", func() { return false } for _, item := range configs.Items { - item := item if item.Name == "test" { c = &item cs = c.Status.Conditions diff --git a/controller/tests/integration/controller/serviceregistry_controller_test.go b/controller/tests/integration/controller/serviceregistry_controller_test.go index d4fced00..4b1393db 100644 --- a/controller/tests/integration/controller/serviceregistry_controller_test.go +++ b/controller/tests/integration/controller/serviceregistry_controller_test.go @@ -159,7 +159,6 @@ var _ = Describe("ServiceRegistry controller", func() { return false } for _, item := range registries.Items { - item := item if item.Name == "invalid" { r = &item cs = r.Status.Conditions @@ -189,7 +188,6 @@ var _ = Describe("ServiceRegistry controller", func() { return false } for _, item := range registries.Items { - item := item if item.Name == "earth" { r = &item cs = r.Status.Conditions @@ -258,7 +256,6 @@ var _ = Describe("ServiceRegistry controller", func() { return false } for _, item := range registries.Items { - item := item if item.Name == "moon" { registryMoon = &item } else if item.Name == "earth" { @@ -324,7 +321,6 @@ var _ = Describe("ServiceRegistry controller", func() { return false } for _, item := range registries.Items { - item := item if item.Spec.Type != "test_counter" { registry = &item } else { diff --git a/e2e/go.mod b/e2e/go.mod index 611e02d9..719f6c6c 100644 --- a/e2e/go.mod +++ b/e2e/go.mod @@ -14,7 +14,7 @@ module mosn.io/htnn/e2e -go 1.21.5 +go 1.22 require ( github.com/avast/retry-go v3.0.0+incompatible diff --git a/go.work b/go.work index f7d9911a..20f57229 100644 --- a/go.work +++ b/go.work @@ -16,7 +16,7 @@ // version during the development. We commit it to the repository to // reduce the bar of entry for the developers (now they don't need to // setup go.work by themselves). -go 1.21.5 +go 1.22 use ( ./api diff --git a/patch/switch-envoy-go-version.sh b/patch/switch-envoy-go-version.sh index 3106f905..352298af 100755 --- a/patch/switch-envoy-go-version.sh +++ b/patch/switch-envoy-go-version.sh @@ -29,13 +29,13 @@ if [[ ! "$envoy_version" =~ ^[0-9]+\.[0-9]+\. ]]; then exit 1 fi -if [[ "$envoy_version" =~ ^1\.31\.[0-9]+$ ]]; then +if [[ "$envoy_version" =~ ^1\.32\.[0-9]+$ ]]; then # patch version should not matter echo "Envoy version $envoy_version is already in used" exit 0 fi -if [[ ! "$envoy_version" =~ ^1\.(29|31)\. ]]; then +if [[ ! "$envoy_version" =~ ^1\.(29|31|32)\. ]]; then echo "Unsupported envoy version $envoy_version" exit 1 fi diff --git a/plugins/go.mod b/plugins/go.mod index 1b36e601..5cf7b938 100644 --- a/plugins/go.mod +++ b/plugins/go.mod @@ -19,7 +19,7 @@ module mosn.io/htnn/plugins // a non-release version of mosn.io/htnn/xxx module, you may need to manually update the // dependency yourself, such as using replace in go.mod -go 1.21.5 +go 1.22 require ( github.com/agiledragon/gomonkey/v2 v2.11.0 diff --git a/plugins/plugins/keyauth/config_test.go b/plugins/plugins/keyauth/config_test.go index 75fac636..b6d2c944 100644 --- a/plugins/plugins/keyauth/config_test.go +++ b/plugins/plugins/keyauth/config_test.go @@ -37,7 +37,7 @@ func TestConfig(t *testing.T) { input: `{ "keys": [{"name": "x", "source": "body"}] }`, - err: `invalid value for enum type: "body"`, + err: `invalid value for enum type source: "body"`, }, } diff --git a/plugins/plugins/limitreq/config_test.go b/plugins/plugins/limitreq/config_test.go index 88af6422..bd6e41a9 100644 --- a/plugins/plugins/limitreq/config_test.go +++ b/plugins/plugins/limitreq/config_test.go @@ -42,7 +42,7 @@ func TestConfig(t *testing.T) { { name: "invalid burst", input: `{"average":1,"burst":-1}`, - err: "invalid value for uint32 type", + err: "invalid value for uint32 field", }, { name: "bad expr", diff --git a/site/content/en/docs/developer-guide/dataplane_support.md b/site/content/en/docs/developer-guide/dataplane_support.md index 21322bf3..c90daa45 100644 --- a/site/content/en/docs/developer-guide/dataplane_support.md +++ b/site/content/en/docs/developer-guide/dataplane_support.md @@ -31,7 +31,8 @@ By default, the target API version of HTNN's data plane code is the latest offic | Version | build tag | |---------|-------------------------------------| | dev | envoydev | -| 1.31 | Latest version, no build tag needed | +| 1.32 | Latest version, no build tag needed | +| 1.31 | envoy1.31 | | 1.29 | envoy1.29 | For example, to compile a shared library that can run on Envoy 1.29, you need to execute the following commands: diff --git a/site/content/zh-hans/docs/developer-guide/dataplane_support.md b/site/content/zh-hans/docs/developer-guide/dataplane_support.md index 0d2021a1..082c203f 100644 --- a/site/content/zh-hans/docs/developer-guide/dataplane_support.md +++ b/site/content/zh-hans/docs/developer-guide/dataplane_support.md @@ -31,7 +31,8 @@ require ( | 版本 | build tag | |------|----------------------------| | dev | envoydev | -| 1.31 | 最新版本,不需要 build tag | +| 1.32 | 最新版本,不需要 build tag | +| 1.31 | envoy1.31 | | 1.29 | envoy1.29 | 举个例子,编译在 Envoy 1.29 上可运行的 shared library 需要执行下面命令: diff --git a/types/apis/v1/validation_test.go b/types/apis/v1/validation_test.go index 9de626f3..197ac7f9 100644 --- a/types/apis/v1/validation_test.go +++ b/types/apis/v1/validation_test.go @@ -693,7 +693,7 @@ func TestValidateConsumer(t *testing.T) { }, }, }, - err: "invalid value for string type", + err: "invalid value for string field", }, { name: "invalid config for filter", diff --git a/types/go.mod b/types/go.mod index af998529..5a53d307 100644 --- a/types/go.mod +++ b/types/go.mod @@ -19,7 +19,7 @@ module mosn.io/htnn/types // a non-release version of mosn.io/htnn/xxx module, you may need to manually update the // dependency yourself, such as using replace in go.mod -go 1.21.5 +go 1.22 require ( github.com/agiledragon/gomonkey/v2 v2.11.0