rebase: bump github.com/kubernetes-csi/csi-lib-utils

Bumps [github.com/kubernetes-csi/csi-lib-utils](https://github.com/kubernetes-csi/csi-lib-utils) from 0.11.0 to 0.13.0.
- [Release notes](https://github.com/kubernetes-csi/csi-lib-utils/releases)
- [Commits](https://github.com/kubernetes-csi/csi-lib-utils/compare/v0.11.0...v0.13.0)

---
updated-dependencies:
- dependency-name: github.com/kubernetes-csi/csi-lib-utils
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot]
2023-02-20 14:30:45 +00:00
committed by mergify[bot]
parent 58c4d0bdc5
commit 17a342261e
5 changed files with 33 additions and 11 deletions

View File

@ -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 '<protocol>://', 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
}

View File

@ -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(),