Skip to content

Commit 36bb163

Browse files
authored
Merge pull request #969 from mattcary/maxproc
override maxprocs, defaulting to 1
2 parents c6ddc04 + ea87316 commit 36bb163

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

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

+17-8
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"
@@ -33,13 +34,15 @@ import (
3334
)
3435

3536
var (
36-
cloudConfigFilePath = flag.String("cloud-config", "", "Path to GCE cloud provider config")
37-
endpoint = flag.String("endpoint", "unix:/tmp/csi.sock", "CSI endpoint")
38-
runControllerService = flag.Bool("run-controller-service", true, "If set to false then the CSI driver does not activate its controller service (default: true)")
39-
runNodeService = flag.Bool("run-node-service", true, "If set to false then the CSI driver does not activate its node service (default: true)")
40-
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.")
41-
metricsPath = flag.String("metrics-path", "/metrics", "The HTTP path where prometheus metrics will be exposed. Default is `/metrics`.")
42-
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")
37+
cloudConfigFilePath = flag.String("cloud-config", "", "Path to GCE cloud provider config")
38+
endpoint = flag.String("endpoint", "unix:/tmp/csi.sock", "CSI endpoint")
39+
runControllerService = flag.Bool("run-controller-service", true, "If set to false then the CSI driver does not activate its controller service (default: true)")
40+
runNodeService = flag.Bool("run-node-service", true, "If set to false then the CSI driver does not activate its node service (default: true)")
41+
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.")
42+
metricsPath = flag.String("metrics-path", "/metrics", "The HTTP path where prometheus metrics will be exposed. Default is `/metrics`.")
43+
44+
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")
45+
4346
attachDiskBackoffDuration = flag.Duration("attach-disk-backoff-duration", 5*time.Second, "Duration for attachDisk backoff")
4447
attachDiskBackoffFactor = flag.Float64("attach-disk-backoff-factor", 0.0, "Factor for attachDisk backoff")
4548
attachDiskBackoffJitter = flag.Float64("attach-disk-backoff-jitter", 0.0, "Jitter for attachDisk backoff")
@@ -50,7 +53,10 @@ var (
5053
waitForOpBackoffJitter = flag.Float64("wait-op-backoff-jitter", 0.0, "Jitter for wait for operation backoff")
5154
waitForOpBackoffSteps = flag.Int("wait-op-backoff-steps", 100, "Steps for wait for operation backoff")
5255
waitForOpBackoffCap = flag.Duration("wait-op-backoff-cap", 0, "Cap for wait for operation backoff")
53-
version string
56+
57+
maxprocs = flag.Int("maxprocs", 1, "GOMAXPROCS override")
58+
59+
version string
5460
)
5561

5662
const (
@@ -77,6 +83,9 @@ func main() {
7783
func handle() {
7884
var err error
7985

86+
runtime.GOMAXPROCS(*maxprocs)
87+
klog.Infof("Sys info: NumCPU: %v MAXPROC: %v", runtime.NumCPU(), runtime.GOMAXPROCS(0))
88+
8089
if version == "" {
8190
klog.Fatalf("version must be set at compile time")
8291
}

0 commit comments

Comments
 (0)