diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d424183a..0fb00832 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=v1.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/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/filtermanager_131.go b/api/pkg/filtermanager/filtermanager_131.go new file mode 100644 index 00000000..cd07caca --- /dev/null +++ b/api/pkg/filtermanager/filtermanager_131.go @@ -0,0 +1,64 @@ +// 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 || 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 +) + +func (m *filterManager) OnLog(_ capi.RequestHeaderMap, _ capi.RequestTrailerMap, _ capi.ResponseHeaderMap, _ 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) +} + +// we will get rid of this wrapper once Envoy 1.32 is released + +func wrapFilterManager(fm *filterManager) capi.StreamFilter { + return &filterManagerWrapper{fm} +} + +// This method is test only +func unwrapFilterManager(wrapper capi.StreamFilter) *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..9d3bb315 100644 --- a/api/pkg/filtermanager/filtermanager_latest.go +++ b/api/pkg/filtermanager/filtermanager_latest.go @@ -12,53 +12,34 @@ // 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 func unwrapFilterManager(wrapper capi.StreamFilter) *filterManager { - fmw, _ := wrapper.(*filterManagerWrapper) - return fmw.filterManager + return wrapper.(*filterManager) } 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/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/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/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/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/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