Skip to content

Commit c0a54de

Browse files
committed
override maxprocs, defaulting to 1
Change-Id: I0ae4b788ba5a08ff1b6bf3efb4cbf79371f842e3
1 parent 9681ab1 commit c0a54de

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cmd/gce-pd-csi-driver/main.go

+5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"flag"
2121
"math/rand"
2222
"os"
23+
"runtime"
2324
"time"
2425

2526
"k8s.io/klog"
@@ -40,6 +41,7 @@ var (
4041
httpEndpoint = flag.String("http-endpoint", "", "The TCP network address where the prometheus metrics endpoint will listen (example: `:8080`). The default is empty string, which means metrics endpoint is disabled.")
4142
metricsPath = flag.String("metrics-path", "/metrics", "The HTTP path where prometheus metrics will be exposed. Default is `/metrics`.")
4243
extraVolumeLabelsStr = flag.String("extra-labels", "", "Extra labels to attach to each PD created. It is a comma separated list of key value pairs like '<key1>=<value1>,<key2>=<value2>'. See https://cloud.google.com/compute/docs/labeling-resources for details")
44+
maxprocs = flag.Int("maxprocs", 1, "GOMAXPROCS override")
4345
version string
4446
)
4547

@@ -67,6 +69,9 @@ func main() {
6769
func handle() {
6870
var err error
6971

72+
runtime.GOMAXPROCS(*maxprocs)
73+
klog.Infof("Sys info: NumCPU: %v MAXPROC: %v", runtime.NumCPU(), runtime.GOMAXPROCS(0))
74+
7075
if version == "" {
7176
klog.Fatalf("version must be set at compile time")
7277
}

0 commit comments

Comments
 (0)