Skip to content

Commit

Permalink
Merge pull request #2315 from k8s-infra-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…2314-to-release-1.31

[release-1.31] chore: set GoMaxProcs as 2
  • Loading branch information
andyzhangx authored Jan 5, 2025
2 parents 36e1f99 + 19a51f0 commit fc6052b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/azurefile/azurefile_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type DriverOptions struct {
PrintVolumeStatsCallLogs bool
SasTokenExpirationMinutes int
WaitForAzCopyTimeoutMinutes int
GoMaxProcs int
KubeConfig string
Endpoint string
}
Expand Down Expand Up @@ -87,6 +88,7 @@ func (o *DriverOptions) AddFlags() *flag.FlagSet {
fs.IntVar(&o.WaitForAzCopyTimeoutMinutes, "wait-for-azcopy-timeout-minutes", 19, "timeout in minutes for waiting for azcopy to finish")
fs.StringVar(&o.KubeConfig, "kubeconfig", "", "Absolute path to the kubeconfig file. Required only when running out of cluster.")
fs.StringVar(&o.Endpoint, "endpoint", "unix://tmp/csi.sock", "CSI endpoint")
fs.IntVar(&o.GoMaxProcs, "max-procs", 2, "maximum number of CPUs that can be executing simultaneously in golang runtime")

return fs
}
4 changes: 4 additions & 0 deletions pkg/azurefileplugin/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/azurefile-csi-driver/pkg/azurefile"
Expand Down Expand Up @@ -61,6 +62,9 @@ func main() {
}

func handle() {
runtime.GOMAXPROCS(driverOptions.GoMaxProcs)
klog.Infof("Sys info: NumCPU: %v MAXPROC: %v", runtime.NumCPU(), runtime.GOMAXPROCS(0))

driver := azurefile.NewDriver(&driverOptions)
if driver == nil {
klog.Fatalln("Failed to initialize azurefile CSI Driver")
Expand Down

0 comments on commit fc6052b

Please sign in to comment.