diff --git a/go.mod b/go.mod index 49a5e18dc..26b794106 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,7 @@ require ( github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 github.com/hashicorp/vault/api v1.9.0 - github.com/kubernetes-csi/csi-lib-utils v0.11.0 + github.com/kubernetes-csi/csi-lib-utils v0.13.0 github.com/kubernetes-csi/external-snapshotter/client/v6 v6.2.0 github.com/libopenstorage/secrets v0.0.0-20210908194121-a1d19aa9713a github.com/onsi/ginkgo/v2 v2.8.1 diff --git a/go.sum b/go.sum index 113d124c4..2bb27c44d 100644 --- a/go.sum +++ b/go.sum @@ -205,7 +205,6 @@ github.com/cockroachdb/datadriven v0.0.0-20200714090401-bf6692d28da5/go.mod h1:h github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoCr5oaCLELYA= github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM= -github.com/container-storage-interface/spec v1.5.0/go.mod h1:8K96oQNkJ7pFcC2R9Z1ynGGBB1I93kcS6PGg3SsOk8s= github.com/container-storage-interface/spec v1.7.0 h1:gW8eyFQUZWWrMWa8p1seJ28gwDoN5CVJ4uAbQ+Hdycw= github.com/container-storage-interface/spec v1.7.0/go.mod h1:JYuzLqr9VVNoDJl44xp/8fmCOvWPDKzuGTwCoklhuqk= github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= @@ -722,8 +721,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kubernetes-csi/csi-lib-utils v0.11.0 h1:FHWOBtAZBA/hVk7v/qaXgG9Sxv0/n06DebPFuDwumqg= -github.com/kubernetes-csi/csi-lib-utils v0.11.0/go.mod h1:BmGZZB16L18+9+Lgg9YWwBKfNEHIDdgGfAyuW6p2NV0= +github.com/kubernetes-csi/csi-lib-utils v0.13.0 h1:QrTdZVZbHlaSUBN9ReayBPnnF1N0edFIpUKBwVIBW3w= +github.com/kubernetes-csi/csi-lib-utils v0.13.0/go.mod h1:JS9eDIZmSjx4F9o0bLTVK/qfhIIOifdjEfVXzxWapfE= github.com/kubernetes-csi/external-snapshotter/client/v4 v4.0.0/go.mod h1:YBCo4DoEeDndqvAn6eeu0vWM7QdXmHEeI9cFWplmBys= github.com/kubernetes-csi/external-snapshotter/client/v6 v6.2.0 h1:cMM5AB37e9aRGjErygVT6EuBPB6s5a+l95OPERmSlVM= github.com/kubernetes-csi/external-snapshotter/client/v6 v6.2.0/go.mod h1:VQVLCPGDX5l6V5PezjlDXLa+SpCbWSVU7B16cFWVVeE= @@ -1207,7 +1206,6 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210520170846-37e1c6afe023/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= diff --git a/vendor/github.com/kubernetes-csi/csi-lib-utils/connection/connection.go b/vendor/github.com/kubernetes-csi/csi-lib-utils/connection/connection.go index ad37321e8..9f8a48f90 100644 --- a/vendor/github.com/kubernetes-csi/csi-lib-utils/connection/connection.go +++ b/vendor/github.com/kubernetes-csi/csi-lib-utils/connection/connection.go @@ -19,6 +19,7 @@ package connection import ( "context" "errors" + "fmt" "io/ioutil" "net" "strings" @@ -40,6 +41,15 @@ const ( const terminationLogPath = "/dev/termination-log" +var maxLogChar int = -1 + +// SetMaxGRPCLogLength set the maximum character count for GRPC logging. +// If characterCount is set to anything smaller than or equal to 0 then there's no limit on log length. +// The default log length limit is unlimited. +func SetMaxGRPCLogLength(characterCount int) { + maxLogChar = characterCount +} + // Connect opens insecure gRPC connection to a CSI driver. Address must be either absolute path to UNIX domain socket // file or have format '://', following gRPC name resolution mechanism at // https://github.com/grpc/grpc/blob/master/doc/naming.md. @@ -183,7 +193,11 @@ func LogGRPC(ctx context.Context, method string, req, reply interface{}, cc *grp klog.V(5).Infof("GRPC call: %s", method) klog.V(5).Infof("GRPC request: %s", protosanitizer.StripSecrets(req)) err := invoker(ctx, method, req, reply, cc, opts...) - klog.V(5).Infof("GRPC response: %s", protosanitizer.StripSecrets(reply)) + cappedStr := fmt.Sprintf("%s", protosanitizer.StripSecrets(reply)) + if maxLogChar > 0 && len(cappedStr) > maxLogChar { + cappedStr = cappedStr[:maxLogChar] + fmt.Sprintf(" [response body too large, log capped to %d chars]", maxLogChar) + } + klog.V(5).Infof("GRPC response: %s", cappedStr) klog.V(5).Infof("GRPC error: %v", err) return err } diff --git a/vendor/github.com/kubernetes-csi/csi-lib-utils/metrics/metrics.go b/vendor/github.com/kubernetes-csi/csi-lib-utils/metrics/metrics.go index 3baab8ca7..b641fffcb 100644 --- a/vendor/github.com/kubernetes-csi/csi-lib-utils/metrics/metrics.go +++ b/vendor/github.com/kubernetes-csi/csi-lib-utils/metrics/metrics.go @@ -179,12 +179,20 @@ func WithProcessStartTime(registerProcessStartTime bool) MetricsManagerOption { } } +// WithCustomRegistry allow user to use custom pre-created registry instead of a new created one. +func WithCustomRegistry(registry metrics.KubeRegistry) MetricsManagerOption { + return func(cmm *csiMetricsManager) { + cmm.registry = registry + } +} + // NewCSIMetricsManagerForSidecar creates and registers metrics for CSI Sidecars and // returns an object that can be used to trigger the metrics. It uses "csi_sidecar" // as subsystem. // // driverName - Name of the CSI driver against which this operation was executed. -// If unknown, leave empty, and use SetDriverName method to update later. +// +// If unknown, leave empty, and use SetDriverName method to update later. func NewCSIMetricsManagerForSidecar(driverName string) CSIMetricsManager { return NewCSIMetricsManagerWithOptions(driverName) } @@ -197,7 +205,8 @@ var NewCSIMetricsManager = NewCSIMetricsManagerForSidecar // as subsystem. // // driverName - Name of the CSI driver against which this operation was executed. -// If unknown, leave empty, and use SetDriverName method to update later. +// +// If unknown, leave empty, and use SetDriverName method to update later. func NewCSIMetricsManagerForPlugin(driverName string) CSIMetricsManager { return NewCSIMetricsManagerWithOptions(driverName, WithSubsystem(SubsystemPlugin), @@ -208,7 +217,8 @@ func NewCSIMetricsManagerForPlugin(driverName string) CSIMetricsManager { // if there are special needs like changing the default subsystems. // // driverName - Name of the CSI driver against which this operation was executed. -// If unknown, leave empty, and use SetDriverName method to update later. +// +// If unknown, leave empty, and use SetDriverName method to update later. func NewCSIMetricsManagerWithOptions(driverName string, options ...MetricsManagerOption) CSIMetricsManager { cmm := csiMetricsManager{ registry: metrics.NewKubeRegistry(), diff --git a/vendor/modules.txt b/vendor/modules.txt index a3793afea..8cdb6c6ea 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -335,8 +335,8 @@ github.com/josharian/intern github.com/json-iterator/go # github.com/kr/pretty v0.2.1 ## explicit; go 1.12 -# github.com/kubernetes-csi/csi-lib-utils v0.11.0 -## explicit; go 1.16 +# github.com/kubernetes-csi/csi-lib-utils v0.13.0 +## explicit; go 1.18 github.com/kubernetes-csi/csi-lib-utils/connection github.com/kubernetes-csi/csi-lib-utils/metrics github.com/kubernetes-csi/csi-lib-utils/protosanitizer