Skip to content

Commit

Permalink
Merge pull request #2253 from kubernetes-sigs/allow-more-powershell-c…
Browse files Browse the repository at this point in the history
…ommand-running-1.30

[release-1.30] fix: allow more powershell command running at same time on Windows node
  • Loading branch information
andyzhangx authored Dec 8, 2024
2 parents 98063fa + 2e9da25 commit 3d52d22
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion charts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ The following table lists the configurable parameters of the latest Azure File C
| `windows.resources.nodeDriverRegistrar.limits.memory` | csi-node-driver-registrar memory limits | 150Mi |
| `windows.resources.nodeDriverRegistrar.requests.cpu` | csi-node-driver-registrar cpu requests | 10m |
| `windows.resources.nodeDriverRegistrar.requests.memory` | csi-node-driver-registrar memory requests | 40Mi |
| `windows.resources.azurefile.limits.memory` | azurefile memory limits | 200Mi |
| `windows.resources.azurefile.limits.memory` | azurefile memory limits | 600Mi |
| `windows.resources.azurefile.requests.cpu` | azurefile cpu requests | 10m |
| `windows.resources.azurefile.requests.memory` | azurefile memory requests | 40Mi |
| `workloadIdentity.clientID` | client ID of workload identity | ''
Expand Down
Binary file modified charts/latest/azurefile-csi-driver-v1.30.6.tgz
Binary file not shown.
2 changes: 1 addition & 1 deletion charts/latest/azurefile-csi-driver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ windows:
memory: 40Mi
azurefile:
limits:
memory: 200Mi
memory: 600Mi
requests:
cpu: 10m
memory: 40Mi
Expand Down
2 changes: 1 addition & 1 deletion deploy/csi-azurefile-node-windows-hostprocess.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ spec:
fieldPath: spec.nodeName
resources:
limits:
memory: 200Mi
memory: 600Mi
requests:
cpu: 10m
memory: 40Mi
Expand Down
12 changes: 6 additions & 6 deletions pkg/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"os"
"os/exec"
"strings"
"sync"
"time"

"k8s.io/klog/v2"
Expand All @@ -41,7 +40,8 @@ const (
AzcopyJobCompleted AzcopyJobState = "Completed"
)

var powershellCmdMutex = &sync.Mutex{}
// control the number of concurrent powershell commands running on Windows node
var powershellCmdSem = make(chan struct{}, 3)

// RoundUpBytes rounds up the volume size in bytes up to multiplications of GiB
// in the unit of Bytes
Expand Down Expand Up @@ -79,13 +79,13 @@ func roundUpSize(volumeSizeBytes int64, allocationUnitBytes int64) int64 {
}

func RunPowershellCmd(command string, envs ...string) ([]byte, error) {
// only one powershell command can be executed at a time to avoid OOM
powershellCmdMutex.Lock()
defer powershellCmdMutex.Unlock()
// acquire a semaphore to limit the number of concurrent operations
powershellCmdSem <- struct{}{}
defer func() { <-powershellCmdSem }()

cmd := exec.Command("powershell", "-Mta", "-NoProfile", "-Command", command)
cmd.Env = append(os.Environ(), envs...)
klog.V(8).Infof("Executing command: %q", cmd.String())
klog.V(6).Infof("Executing command: %q", cmd.String())
return cmd.CombinedOutput()
}

Expand Down

0 comments on commit 3d52d22

Please sign in to comment.