diff --git a/go.mod b/go.mod index 2d284cde6..d739a8f2b 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/fsnotify/fsnotify v1.7.0 github.com/golang/mock v1.6.0 github.com/google/gofuzz v1.2.0 - github.com/kubernetes-csi/csi-lib-utils v0.18.0 + github.com/kubernetes-csi/csi-lib-utils v0.18.1 github.com/kubernetes-csi/csi-test/v5 v5.2.0 github.com/kubernetes-csi/external-snapshotter/client/v8 v8.0.0 github.com/prometheus/client_golang v1.19.1 @@ -22,7 +22,7 @@ require ( k8s.io/client-go v0.30.0 k8s.io/component-base v0.30.0 k8s.io/component-helpers v0.30.0 - k8s.io/klog/v2 v2.120.1 + k8s.io/klog/v2 v2.130.0 ) require ( diff --git a/go.sum b/go.sum index 4a853c1da..dc438e134 100644 --- a/go.sum +++ b/go.sum @@ -63,8 +63,8 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= 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.18.0 h1:Tpt1qLIbmpz5ux1hllut/dEWww2VRxdvSSOF4gGwhnA= -github.com/kubernetes-csi/csi-lib-utils v0.18.0/go.mod h1:FEQIcHcZmXZKWKTg18dJbXCHvgtCjnH7/uM0trmZyhU= +github.com/kubernetes-csi/csi-lib-utils v0.18.1 h1:vpg1kbQ6lFVCz7mY71zcqVE7W0GAQXXBoFfHvbW3gdw= +github.com/kubernetes-csi/csi-lib-utils v0.18.1/go.mod h1:PIcn27zmbY0KBue4JDdZVfDF56tjcS3jKroZPi+pMoY= github.com/kubernetes-csi/csi-test/v5 v5.2.0 h1:Z+sdARWC6VrONrxB24clCLCmnqCnZF7dzXtzx8eM35o= github.com/kubernetes-csi/csi-test/v5 v5.2.0/go.mod h1:o/c5w+NU3RUNE+DbVRhEUTmkQVBGk+tFOB2yPXT8teo= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= @@ -188,8 +188,8 @@ k8s.io/component-base v0.30.0 h1:cj6bp38g0ainlfYtaOQuRELh5KSYjhKxM+io7AUIk4o= k8s.io/component-base v0.30.0/go.mod h1:V9x/0ePFNaKeKYA3bOvIbrNoluTSG+fSJKjLdjOoeXQ= k8s.io/component-helpers v0.30.0 h1:xbJtNCfSM4SB/Tz5JqCKDZv4eT5LVi/AWQ1VOxhmStU= k8s.io/component-helpers v0.30.0/go.mod h1:68HlSwXIumMKmCx8cZe1PoafQEYh581/sEpxMrkhmX4= -k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= -k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +k8s.io/klog/v2 v2.130.0 h1:5nB3+3HpqKqXJIXNtJdtxcDCfaa9KL8StJgMzGJkUkM= +k8s.io/klog/v2 v2.130.0/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag= k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98= k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= diff --git a/vendor/github.com/kubernetes-csi/csi-lib-utils/rpc/common.go b/vendor/github.com/kubernetes-csi/csi-lib-utils/rpc/common.go index c794267c6..f83a7f15c 100644 --- a/vendor/github.com/kubernetes-csi/csi-lib-utils/rpc/common.go +++ b/vendor/github.com/kubernetes-csi/csi-lib-utils/rpc/common.go @@ -136,32 +136,35 @@ func GetGroupControllerCapabilities(ctx context.Context, conn *grpc.ClientConn) func ProbeForever(ctx context.Context, conn *grpc.ClientConn, singleProbeTimeout time.Duration) error { logger := klog.FromContext(ctx) ticker := time.NewTicker(probeInterval) + defer ticker.Stop() for { + // Run the probe once before waiting for the ticker + logger.Info("Probing CSI driver for readiness") + ready, err := probeOnce(ctx, conn, singleProbeTimeout) + if err != nil { + st, ok := status.FromError(err) + if !ok { + // This is not gRPC error. The probe must have failed before gRPC + // method was called, otherwise we would get gRPC error. + return fmt.Errorf("CSI driver probe failed: %s", err) + } + if st.Code() != codes.DeadlineExceeded { + return fmt.Errorf("CSI driver probe failed: %s", err) + } + // Timeout -> driver is not ready. Fall through to sleep() below. + logger.Info("CSI driver probe timed out") + } else { + if ready { + return nil + } + logger.Info("CSI driver is not ready") + } select { case <-ctx.Done(): return ctx.Err() case <-ticker.C: - logger.Info("Probing CSI driver for readiness") - ready, err := probeOnce(ctx, conn, singleProbeTimeout) - if err != nil { - st, ok := status.FromError(err) - if !ok { - // This is not gRPC error. The probe must have failed before gRPC - // method was called, otherwise we would get gRPC error. - return fmt.Errorf("CSI driver probe failed: %s", err) - } - if st.Code() != codes.DeadlineExceeded { - return fmt.Errorf("CSI driver probe failed: %s", err) - } - // Timeout -> driver is not ready. Fall through to sleep() below. - logger.Info("CSI driver probe timed out") - } else { - if ready { - return nil - } - logger.Info("CSI driver is not ready") - } + continue } } } diff --git a/vendor/k8s.io/klog/v2/klog.go b/vendor/k8s.io/klog/v2/klog.go index 026be9e3b..16dcb3b9d 100644 --- a/vendor/k8s.io/klog/v2/klog.go +++ b/vendor/k8s.io/klog/v2/klog.go @@ -1011,7 +1011,8 @@ func (l *loggingT) exit(err error) { logExitFunc(err) return } - l.flushAll() + files := l.flushAll() + l.syncAll(files) OsExit(2) } @@ -1223,24 +1224,38 @@ func StartFlushDaemon(interval time.Duration) { // lockAndFlushAll is like flushAll but locks l.mu first. func (l *loggingT) lockAndFlushAll() { l.mu.Lock() - l.flushAll() + files := l.flushAll() l.mu.Unlock() + // Some environments are slow when syncing and holding the lock might cause contention. + l.syncAll(files) } -// flushAll flushes all the logs and attempts to "sync" their data to disk. +// flushAll flushes all the logs // l.mu is held. -func (l *loggingT) flushAll() { +func (l *loggingT) flushAll() []flushSyncWriter { + files := make([]flushSyncWriter, 0, severity.NumSeverity) // Flush from fatal down, in case there's trouble flushing. for s := severity.FatalLog; s >= severity.InfoLog; s-- { file := l.file[s] if file != nil { _ = file.Flush() // ignore error - _ = file.Sync() // ignore error } + files = append(files, file) } if logging.loggerOptions.flush != nil { logging.loggerOptions.flush() } + return files +} + +// syncAll attempts to "sync" their data to disk. +func (l *loggingT) syncAll(files []flushSyncWriter) { + // Flush from fatal down, in case there's trouble flushing. + for _, file := range files { + if file != nil { + _ = file.Sync() // ignore error + } + } } // CopyStandardLogTo arranges for messages written to the Go "log" package's diff --git a/vendor/modules.txt b/vendor/modules.txt index 76e0ce2f6..690255696 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -94,7 +94,7 @@ github.com/josharian/intern # github.com/json-iterator/go v1.1.12 ## explicit; go 1.12 github.com/json-iterator/go -# github.com/kubernetes-csi/csi-lib-utils v0.18.0 +# github.com/kubernetes-csi/csi-lib-utils v0.18.1 ## explicit; go 1.22.0 github.com/kubernetes-csi/csi-lib-utils/connection github.com/kubernetes-csi/csi-lib-utils/leaderelection @@ -756,7 +756,7 @@ k8s.io/component-base/version ## explicit; go 1.22.0 k8s.io/component-helpers/scheduling/corev1 k8s.io/component-helpers/scheduling/corev1/nodeaffinity -# k8s.io/klog/v2 v2.120.1 +# k8s.io/klog/v2 v2.130.0 ## explicit; go 1.18 k8s.io/klog/v2 k8s.io/klog/v2/internal/buffer