diff --git a/pkg/blobplugin/main.go b/pkg/blobplugin/main.go index 99adb2ea9..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,9 +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() } @@ -57,8 +61,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) @@ -74,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)