diff --git a/depot/containerstore/proxy_config_handler.go b/depot/containerstore/proxy_config_handler.go index fbb54b33..f5255914 100644 --- a/depot/containerstore/proxy_config_handler.go +++ b/depot/containerstore/proxy_config_handler.go @@ -27,14 +27,13 @@ import ( envoy_discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" envoy_matcher "github.com/envoyproxy/go-control-plane/envoy/type/matcher/v3" ghodss_yaml "github.com/ghodss/yaml" - "github.com/golang/protobuf/ptypes/any" - "github.com/golang/protobuf/ptypes/duration" - pstruct "github.com/golang/protobuf/ptypes/struct" - "github.com/golang/protobuf/ptypes/wrappers" "github.com/tedsuo/ifrit" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/anypb" + "google.golang.org/protobuf/types/known/durationpb" + "google.golang.org/protobuf/types/known/structpb" + "google.golang.org/protobuf/types/known/wrapperspb" ) const ( @@ -354,7 +353,7 @@ func generateProxyConfig( clusters = append(clusters, &envoy_cluster.Cluster{ Name: clusterName, ClusterDiscoveryType: &envoy_cluster.Cluster_Type{Type: envoy_cluster.Cluster_STATIC}, - ConnectTimeout: &duration.Duration{Nanos: TimeOut}, + ConnectTimeout: &durationpb.Duration{Nanos: TimeOut}, LoadAssignment: &envoy_endpoint.ClusterLoadAssignment{ ClusterName: clusterName, Endpoints: []*envoy_endpoint.LocalityLbEndpoints{{ @@ -369,9 +368,9 @@ func generateProxyConfig( }, CircuitBreakers: &envoy_cluster.CircuitBreakers{ Thresholds: []*envoy_cluster.CircuitBreakers_Thresholds{ - {MaxConnections: &wrappers.UInt32Value{Value: math.MaxUint32}}, - {MaxPendingRequests: &wrappers.UInt32Value{Value: math.MaxUint32}}, - {MaxRequests: &wrappers.UInt32Value{Value: math.MaxUint32}}, + {MaxConnections: &wrapperspb.UInt32Value{Value: math.MaxUint32}}, + {MaxPendingRequests: &wrapperspb.UInt32Value{Value: math.MaxUint32}}, + {MaxRequests: &wrapperspb.UInt32Value{Value: math.MaxUint32}}, }}, }) } @@ -405,18 +404,18 @@ func generateProxyConfig( { Name: "static-layer", LayerSpecifier: &envoy_bootstrap.RuntimeLayer_StaticLayer{ - StaticLayer: &pstruct.Struct{ - Fields: map[string]*pstruct.Value{ - "envoy": &pstruct.Value{ - Kind: &pstruct.Value_StructValue{ - StructValue: &pstruct.Struct{ - Fields: map[string]*pstruct.Value{ - "reloadable_features": &pstruct.Value{ - Kind: &pstruct.Value_StructValue{ - StructValue: &pstruct.Struct{ - Fields: map[string]*pstruct.Value{ - "new_tcp_connection_pool": &pstruct.Value{ - Kind: &pstruct.Value_BoolValue{ + StaticLayer: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "envoy": &structpb.Value{ + Kind: &structpb.Value_StructValue{ + StructValue: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "reloadable_features": &structpb.Value{ + Kind: &structpb.Value_StructValue{ + StructValue: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "new_tcp_connection_pool": &structpb.Value{ + Kind: &structpb.Value_BoolValue{ BoolValue: false, }, }, @@ -455,7 +454,7 @@ func generateProxyConfig( clusters = append(clusters, &envoy_cluster.Cluster{ Name: AdsClusterName, ClusterDiscoveryType: &envoy_cluster.Cluster_Type{Type: envoy_cluster.Cluster_STATIC}, - ConnectTimeout: &duration.Duration{Nanos: TimeOut}, + ConnectTimeout: &durationpb.Duration{Nanos: TimeOut}, LoadAssignment: &envoy_endpoint.ClusterLoadAssignment{ ClusterName: AdsClusterName, Endpoints: []*envoy_endpoint.LocalityLbEndpoints{{ @@ -567,7 +566,7 @@ func generateListeners(container executor.Container, requireClientCerts, http2En } if requireClientCerts && portMap.ContainerTLSProxyPort != C2CTLSPort { - tlsContext.RequireClientCertificate = &wrappers.BoolValue{Value: requireClientCerts} + tlsContext.RequireClientCertificate = &wrapperspb.BoolValue{Value: requireClientCerts} tlsContext.CommonTlsContext.ValidationContextType = &envoy_tls.CommonTlsContext_ValidationContextSdsSecretConfig{ ValidationContextSdsSecretConfig: &envoy_tls.SdsSecretConfig{ Name: "id-validation-context", @@ -669,7 +668,7 @@ func writeDiscoveryResponseYAML(resourceMsg proto.Message, outPath string) error } dr := &envoy_discovery.DiscoveryResponse{ VersionInfo: "0", - Resources: []*any.Any{ + Resources: []*anypb.Any{ resourceAny, }, } diff --git a/depot/containerstore/proxy_config_handler_test.go b/depot/containerstore/proxy_config_handler_test.go index fc263517..c7f03c27 100644 --- a/depot/containerstore/proxy_config_handler_test.go +++ b/depot/containerstore/proxy_config_handler_test.go @@ -30,14 +30,14 @@ import ( envoy_matcher "github.com/envoyproxy/go-control-plane/envoy/type/matcher/v3" "github.com/fsnotify/fsnotify" ghodss_yaml "github.com/ghodss/yaml" - "github.com/golang/protobuf/ptypes/duration" - "github.com/golang/protobuf/ptypes/wrappers" uuid "github.com/nu7hatch/gouuid" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/anypb" + "google.golang.org/protobuf/types/known/durationpb" + "google.golang.org/protobuf/types/known/wrapperspb" ) var _ = Describe("ProxyConfigHandler", func() { @@ -1089,7 +1089,7 @@ func createListener(config expectedListener) *envoy_listener.Listener { }, } if config.requireClientCertificate { - tlsContext.RequireClientCertificate = &wrappers.BoolValue{Value: true} + tlsContext.RequireClientCertificate = &wrapperspb.BoolValue{Value: true} tlsContext.CommonTlsContext.ValidationContextType = &envoy_tls.CommonTlsContext_ValidationContextSdsSecretConfig{ ValidationContextSdsSecretConfig: &envoy_tls.SdsSecretConfig{ Name: "id-validation-context", @@ -1146,7 +1146,7 @@ func createCluster(config expectedCluster) *envoy_cluster.Cluster { } cluster := &envoy_cluster.Cluster{ Name: config.name, - ConnectTimeout: &duration.Duration{Nanos: 250000000}, + ConnectTimeout: &durationpb.Duration{Nanos: 250000000}, ClusterDiscoveryType: &envoy_cluster.Cluster_Type{Type: envoy_cluster.Cluster_STATIC}, LbPolicy: envoy_cluster.Cluster_ROUND_ROBIN, LoadAssignment: &envoy_endpoint.ClusterLoadAssignment{ @@ -1160,9 +1160,9 @@ func createCluster(config expectedCluster) *envoy_cluster.Cluster { if config.maxConnections > 0 { cluster.CircuitBreakers = &envoy_cluster.CircuitBreakers{ Thresholds: []*envoy_cluster.CircuitBreakers_Thresholds{ - {MaxConnections: &wrappers.UInt32Value{Value: math.MaxUint32}}, - {MaxPendingRequests: &wrappers.UInt32Value{Value: math.MaxUint32}}, - {MaxRequests: &wrappers.UInt32Value{Value: math.MaxUint32}}, + {MaxConnections: &wrapperspb.UInt32Value{Value: math.MaxUint32}}, + {MaxPendingRequests: &wrapperspb.UInt32Value{Value: math.MaxUint32}}, + {MaxRequests: &wrapperspb.UInt32Value{Value: math.MaxUint32}}, }} } return cluster diff --git a/depot/steps/run_step.go b/depot/steps/run_step.go index e99d0bb5..0e4a4f37 100644 --- a/depot/steps/run_step.go +++ b/depot/steps/run_step.go @@ -118,7 +118,7 @@ func (step *runStep) Run(signals <-chan os.Signal, ready chan<- struct{}) error var nofile *uint64 if step.model.ResourceLimits != nil { - nofile = step.model.ResourceLimits.GetNofilePtr() + nofile = step.model.ResourceLimits.GetNofile() } var processIO garden.ProcessIO diff --git a/depot/steps/run_step_test.go b/depot/steps/run_step_test.go index a2fc1587..31b9b880 100644 --- a/depot/steps/run_step_test.go +++ b/depot/steps/run_step_test.go @@ -53,8 +53,9 @@ var _ = Describe("RunAction", func() { sidecar = steps.Sidecar{} rl := models.ResourceLimits{} - rl.SetNofile(fileDescriptorLimit) - rl.SetNproc(processesLimit) + rl.SetNofile(&fileDescriptorLimit) + //lint:ignore SA1019 - testing deprecated logic + rl.SetNproc(&processesLimit) runAction = models.RunAction{ Path: "sudo", diff --git a/depot/transformer/transformer.go b/depot/transformer/transformer.go index 366f4fe1..be74f3de 100644 --- a/depot/transformer/transformer.go +++ b/depot/transformer/transformer.go @@ -650,7 +650,7 @@ func (t *transformer) createCheck( } rl := models.ResourceLimits{} - rl.SetNofile(nofiles) + rl.SetNofile(&nofiles) runAction := models.RunAction{ LogSource: sourceName, ResourceLimits: &rl, diff --git a/depot/transformer/transformer_test.go b/depot/transformer/transformer_test.go index fa6abd61..75af955d 100644 --- a/depot/transformer/transformer_test.go +++ b/depot/transformer/transformer_test.go @@ -25,12 +25,12 @@ import ( "code.cloudfoundry.org/lager/v3" "code.cloudfoundry.org/lager/v3/lagertest" "code.cloudfoundry.org/workpool" - "github.com/gogo/protobuf/proto" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/onsi/gomega/gbytes" "github.com/tedsuo/ifrit" ginkgomon "github.com/tedsuo/ifrit/ginkgomon_v2" + "google.golang.org/protobuf/proto" ) var _ = Describe("Transformer", func() {