Skip to content

Commit

Permalink
change: switch the default Envoy version to 1.32
Browse files Browse the repository at this point in the history
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
  • Loading branch information
spacewander committed Nov 4, 2024
1 parent 21c6743 commit 0a24a69
Show file tree
Hide file tree
Showing 14 changed files with 124 additions and 106 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
envoy_version:
- 1.29
- 1.31
- 1.32
- dev
env:
ENVOY_API_VERSION: ${{ matrix.envoy_version }}
Expand All @@ -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 ..
Expand Down
6 changes: 3 additions & 3 deletions api/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
)

Expand Down
8 changes: 4 additions & 4 deletions api/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down
64 changes: 64 additions & 0 deletions api/pkg/filtermanager/filtermanager_131.go
Original file line number Diff line number Diff line change
@@ -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
}
37 changes: 9 additions & 28 deletions api/pkg/filtermanager/filtermanager_latest.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Check warning on line 27 in api/pkg/filtermanager/filtermanager_latest.go

View check run for this annotation

Codecov / codecov/patch

api/pkg/filtermanager/filtermanager_latest.go#L27

Added line #L27 was not covered by tests
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)

Check warning on line 35 in api/pkg/filtermanager/filtermanager_latest.go

View check run for this annotation

Codecov / codecov/patch

api/pkg/filtermanager/filtermanager_latest.go#L32-L35

Added lines #L32 - L35 were not covered by tests
}

// we will get rid of this wrapper once Envoy 1.32 is released

func wrapFilterManager(fm *filterManager) capi.StreamFilter {
return &filterManagerWrapper{fm}
return fm

Check warning on line 39 in api/pkg/filtermanager/filtermanager_latest.go

View check run for this annotation

Codecov / codecov/patch

api/pkg/filtermanager/filtermanager_latest.go#L39

Added line #L39 was not covered by tests
}

// This method is test only
func unwrapFilterManager(wrapper capi.StreamFilter) *filterManager {
fmw, _ := wrapper.(*filterManagerWrapper)
return fmw.filterManager
return wrapper.(*filterManager)

Check warning on line 44 in api/pkg/filtermanager/filtermanager_latest.go

View check run for this annotation

Codecov / codecov/patch

api/pkg/filtermanager/filtermanager_latest.go#L44

Added line #L44 was not covered by tests
}
60 changes: 0 additions & 60 deletions api/tests/integration/filtermanager_dev_test.go

This file was deleted.

32 changes: 31 additions & 1 deletion api/tests/integration/filtermanager_latest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
}
2 changes: 1 addition & 1 deletion controller/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion e2e/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion go.work
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion plugins/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion site/content/en/docs/developer-guide/dataplane_support.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 需要执行下面命令:
Expand Down
2 changes: 1 addition & 1 deletion types/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0a24a69

Please sign in to comment.