Skip to content

Commit a75f607

Browse files
azure-sdkbenbp
andauthored
Set default LimitRange for stress container resource requests (#1223)
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
1 parent a57da78 commit a75f607

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@ $FailedCommands = New-Object Collections.Generic.List[hashtable]
55

66
. (Join-Path $PSScriptRoot "../Helpers" PSModule-Helpers.ps1)
77

8+
$limitRangeSpec = @"
9+
apiVersion: v1
10+
kind: LimitRange
11+
metadata:
12+
name: default-resource-request
13+
spec:
14+
limits:
15+
- defaultRequest:
16+
cpu: 100m
17+
memory: 100Mi
18+
type: Container
19+
"@
20+
821
# Powershell does not (at time of writing) treat exit codes from external binaries
922
# as cause for stopping execution, so do this via a wrapper function.
1023
# See https://github.com/PowerShell/PowerShell-RFC/pull/277
@@ -191,6 +204,9 @@ function DeployStressPackage(
191204
Write-Host "Creating namespace $($pkg.Namespace) if it does not exist..."
192205
kubectl create namespace $pkg.Namespace --dry-run=client -o yaml | kubectl apply -f -
193206
if ($LASTEXITCODE) {exit $LASTEXITCODE}
207+
Write-Host "Adding default resource requests to namespace/$($pkg.Namespace)"
208+
$limitRangeSpec | kubectl apply -n $pkg.Namespace -f -
209+
if ($LASTEXITCODE) {exit $LASTEXITCODE}
194210

195211
$dockerBuildConfigs = @()
196212

0 commit comments

Comments
 (0)