From 19c035a5ce0884ce4399443fe5dc91c333b81178 Mon Sep 17 00:00:00 2001 From: Adam Janikowski <12255597+ajanikow@users.noreply.github.com> Date: Mon, 18 Nov 2024 10:29:16 +0100 Subject: [PATCH] [Feature] Switch to google.golang.org/protobuf (#1767) --- CHANGELOG.md | 1 + go.mod | 7 ++++--- go.sum | 11 +++++++---- pkg/deployment/resources/gateway/gateway_config.go | 7 +++---- .../resources/gateway/gateway_config_destination.go | 3 +-- pkg/util/grpc/grpc.go | 4 ++-- pkg/util/tests/tgrpc/grpc.go | 4 ++-- 7 files changed, 20 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 029687bcd..d5074d0ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ - (Feature) (Platform) Chart - (Feature) (Scheduler) Deployment Scale Functionality - (Feature) (Platform) Chart Integration +- (Maintenance) Switch to google.golang.org/protobuf ## [1.2.43](https://github.com/arangodb/kube-arangodb/tree/1.2.43) (2024-10-14) - (Feature) ArangoRoute CRD diff --git a/go.mod b/go.mod index f4a3326d4..886044454 100644 --- a/go.mod +++ b/go.mod @@ -35,11 +35,11 @@ require ( github.com/cenkalti/backoff v2.2.1+incompatible github.com/coreos/go-semver v0.3.1 github.com/dchest/uniuri v0.0.0-20160212164326-8902c56451e9 - github.com/envoyproxy/go-control-plane v0.12.0 + github.com/envoyproxy/go-control-plane v0.13.1 github.com/fsnotify/fsnotify v1.7.0 github.com/gin-gonic/gin v1.9.1 github.com/golang-jwt/jwt v3.2.2+incompatible - github.com/golang/protobuf v1.5.4 + github.com/golang/protobuf v1.5.4 // indirect github.com/google/uuid v1.6.0 github.com/jessevdk/go-assets v0.0.0-20160921144138-4f4301a06e15 github.com/josephburnett/jd v1.6.1 @@ -113,7 +113,7 @@ require ( github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-metrics v0.0.1 // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect - github.com/envoyproxy/protoc-gen-validate v1.0.4 // indirect + github.com/envoyproxy/protoc-gen-validate v1.1.0 // indirect github.com/evanphx/json-patch v5.9.0+incompatible // indirect github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect github.com/fatih/color v1.13.0 // indirect @@ -182,6 +182,7 @@ require ( github.com/pavel-v-chernykh/keystore-go v2.1.0+incompatible // indirect github.com/pelletier/go-toml/v2 v2.1.1 // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect + github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/common v0.55.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/go.sum b/go.sum index dc872b988..87cabde17 100644 --- a/go.sum +++ b/go.sum @@ -137,11 +137,11 @@ github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1/go.mod h1:cyGadeNE github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.12.0 h1:4X+VP1GHd1Mhj6IB5mMeGbLCleqxjletLK6K0rbxyZI= -github.com/envoyproxy/go-control-plane v0.12.0/go.mod h1:ZBTaoJ23lqITozF0M6G4/IragXCQKCnYbmlmtHvwRG0= +github.com/envoyproxy/go-control-plane v0.13.1 h1:vPfJZCkob6yTMEgS+0TwfTUfbHjfy/6vOJ8hUWX/uXE= +github.com/envoyproxy/go-control-plane v0.13.1/go.mod h1:X45hY0mufo6Fd0KW3rqsGvQMw58jvjymeCzBU3mWyHw= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= -github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= +github.com/envoyproxy/protoc-gen-validate v1.1.0 h1:tntQDh69XqOCOZsDz0lVJQez/2L6Uu2PdjCQwWCJ3bM= +github.com/envoyproxy/protoc-gen-validate v1.1.0/go.mod h1:sXRDRVmzEbkM7CVcM06s9shE/m23dg3wzjl0UWqJ2q4= github.com/evanphx/json-patch v5.9.0+incompatible h1:fBXyNpNMuTTDdquAq/uisOr2lShz4oaXpDTX2bLe7ls= github.com/evanphx/json-patch v5.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d h1:105gxyaGwCFad8crR9dcMQWvV9Hvulu6hwUh4tWPJnM= @@ -273,6 +273,7 @@ github.com/jessevdk/go-assets v0.0.0-20160921144138-4f4301a06e15 h1:cW/amwGEJK5M github.com/jessevdk/go-assets v0.0.0-20160921144138-4f4301a06e15/go.mod h1:Fdm/oWRW+CH8PRbLntksCNtmcCBximKPkVQYvmMl80k= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/jmoiron/sqlx v1.4.0 h1:1PLqN7S1UYp5t4SrVVnt4nUVNemrDAtxlulVe+Qgm3o= github.com/jmoiron/sqlx v1.4.0/go.mod h1:ZrZ7UsYB/weZdl2Bxg6jCRO9c3YHl8r3ahlKmRT4JLY= @@ -384,6 +385,8 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= diff --git a/pkg/deployment/resources/gateway/gateway_config.go b/pkg/deployment/resources/gateway/gateway_config.go index eb61cd463..1388997bf 100644 --- a/pkg/deployment/resources/gateway/gateway_config.go +++ b/pkg/deployment/resources/gateway/gateway_config.go @@ -37,10 +37,9 @@ import ( httpConnectionManagerAPI "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3" upstreamHttpApi "github.com/envoyproxy/go-control-plane/envoy/extensions/upstreams/http/v3" discoveryApi "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - "github.com/golang/protobuf/ptypes/any" - "github.com/golang/protobuf/ptypes/wrappers" "google.golang.org/protobuf/types/known/anypb" "google.golang.org/protobuf/types/known/durationpb" + "google.golang.org/protobuf/types/known/wrapperspb" shared "github.com/arangodb/kube-arangodb/pkg/apis/shared" "github.com/arangodb/kube-arangodb/pkg/util" @@ -198,7 +197,7 @@ func (c Config) RenderClusters() ([]*clusterAPI.Cluster, error) { }, }, }, - TypedExtensionProtocolOptions: map[string]*any.Any{ + TypedExtensionProtocolOptions: map[string]*anypb.Any{ "envoy.extensions.upstreams.http.v3.HttpProtocolOptions": hpo, }, } @@ -310,7 +309,7 @@ func (c Config) RenderFilters() ([]*listenerAPI.Filter, error) { Routes: routes, }, }, - ValidateClusters: &wrappers.BoolValue{ + ValidateClusters: &wrapperspb.BoolValue{ Value: false, }, }, diff --git a/pkg/deployment/resources/gateway/gateway_config_destination.go b/pkg/deployment/resources/gateway/gateway_config_destination.go index d17e80089..602ede7ac 100644 --- a/pkg/deployment/resources/gateway/gateway_config_destination.go +++ b/pkg/deployment/resources/gateway/gateway_config_destination.go @@ -28,7 +28,6 @@ import ( endpointAPI "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3" routeAPI "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" upstreamHttpApi "github.com/envoyproxy/go-control-plane/envoy/extensions/upstreams/http/v3" - "github.com/golang/protobuf/ptypes/any" "google.golang.org/protobuf/types/known/anypb" "google.golang.org/protobuf/types/known/durationpb" @@ -162,7 +161,7 @@ func (c *ConfigDestination) RenderCluster(name string) (*clusterAPI.Cluster, err }, }, }, - TypedExtensionProtocolOptions: map[string]*any.Any{ + TypedExtensionProtocolOptions: map[string]*anypb.Any{ "envoy.extensions.upstreams.http.v3.HttpProtocolOptions": hpo, }, } diff --git a/pkg/util/grpc/grpc.go b/pkg/util/grpc/grpc.go index 217f54514..ba7128b82 100644 --- a/pkg/util/grpc/grpc.go +++ b/pkg/util/grpc/grpc.go @@ -25,13 +25,13 @@ import ( "crypto/tls" "io" - any1 "github.com/golang/protobuf/ptypes/any" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/metadata" proto "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/known/anypb" pbPongV1 "github.com/arangodb/kube-arangodb/integrations/pong/v1/definition" pbSharedV1 "github.com/arangodb/kube-arangodb/integrations/shared/v1/definition" @@ -137,7 +137,7 @@ func attachTokenAuthToInterceptors(ctx context.Context, token string) context.Co return metadata.AppendToOutgoingContext(ctx, AuthorizationGRPCHeader, token) } -func GRPCAnyCastAs[T proto.Message](in *any1.Any, v T) error { +func GRPCAnyCastAs[T proto.Message](in *anypb.Any, v T) error { if err := in.UnmarshalTo(v); err != nil { return err } diff --git a/pkg/util/tests/tgrpc/grpc.go b/pkg/util/tests/tgrpc/grpc.go index 678b78430..1dd9b522b 100644 --- a/pkg/util/tests/tgrpc/grpc.go +++ b/pkg/util/tests/tgrpc/grpc.go @@ -25,12 +25,12 @@ import ( "fmt" "testing" - any1 "github.com/golang/protobuf/ptypes/any" "github.com/stretchr/testify/require" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" proto "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/known/anypb" ugrpc "github.com/arangodb/kube-arangodb/pkg/util/grpc" "github.com/arangodb/kube-arangodb/pkg/util/svc" @@ -75,6 +75,6 @@ func AsGRPCError(t *testing.T, err error) ErrorStatusValidator { return errorStatusValidator{st: st} } -func GRPCAnyCastAs[T proto.Message](t *testing.T, in *any1.Any, v T) { +func GRPCAnyCastAs[T proto.Message](t *testing.T, in *anypb.Any, v T) { require.NoError(t, ugrpc.GRPCAnyCastAs[T](in, v)) }