Skip to content

Commit

Permalink
Merge pull request #1781 from andyzhangx/add-driver-options
Browse files Browse the repository at this point in the history
chore: set GoMaxProcs as 2
  • Loading branch information
andyzhangx authored Jan 4, 2025
2 parents e02ba4d + f2816a6 commit 3b2c0b6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/blobplugin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"net"
"net/http"
"os"
"runtime"
"strings"

"sigs.k8s.io/blob-csi-driver/pkg/blob"
Expand All @@ -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()
}

Expand All @@ -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)
Expand All @@ -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)

Expand Down

0 comments on commit 3b2c0b6

Please sign in to comment.