From a91bcc199e00ba862b37103eb9703e2b25eea9b7 Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Fri, 3 Jan 2025 14:07:38 +0000 Subject: [PATCH 1/2] fix: add driver options in command line fix --- pkg/blobplugin/main.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/blobplugin/main.go b/pkg/blobplugin/main.go index 99adb2ea9..b1b6e71e1 100644 --- a/pkg/blobplugin/main.go +++ b/pkg/blobplugin/main.go @@ -48,6 +48,7 @@ var ( ) func init() { + klog.InitFlags(nil) driverOptions.AddFlags() } @@ -57,8 +58,6 @@ var exit = func(code int) { } func main() { - klog.InitFlags(nil) - _ = flag.Set("logtostderr", "true") flag.Parse() if *version { info, err := blob.GetVersionYAML(driverOptions.DriverName) From f2816a69656ad3c9497a9ffec896fcce4aba8eac Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Fri, 3 Jan 2025 14:34:37 +0000 Subject: [PATCH 2/2] chore: set GoMaxProcs as 2 fix --- pkg/blobplugin/main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/blobplugin/main.go b/pkg/blobplugin/main.go index b1b6e71e1..1a9336338 100644 --- a/pkg/blobplugin/main.go +++ b/pkg/blobplugin/main.go @@ -23,6 +23,7 @@ import ( "net" "net/http" "os" + "runtime" "strings" "sigs.k8s.io/blob-csi-driver/pkg/blob" @@ -45,10 +46,12 @@ var ( allowEmptyCloudConfig = flag.Bool("allow-empty-cloud-config", true, "allow running driver without cloud config") kubeAPIQPS = flag.Float64("kube-api-qps", 25.0, "QPS to use while communicating with the kubernetes apiserver.") kubeAPIBurst = flag.Int("kube-api-burst", 50, "Burst to use while communicating with the kubernetes apiserver.") + goMaxProcs = flag.Int("max-procs", 2, "maximum number of CPUs that can be executing simultaneously in golang runtime") ) func init() { klog.InitFlags(nil) + _ = flag.Set("logtostderr", "true") driverOptions.AddFlags() } @@ -73,6 +76,9 @@ func main() { } func handle() { + runtime.GOMAXPROCS(*goMaxProcs) + klog.Infof("Sys info: NumCPU: %v MAXPROC: %v", runtime.NumCPU(), runtime.GOMAXPROCS(0)) + userAgent := blob.GetUserAgent(driverOptions.DriverName, *customUserAgent, *userAgentSuffix) klog.V(2).Infof("driver userAgent: %s", userAgent)