Skip to content

Commit

Permalink
Set default LimitRange for stress container resource requests (#2396)
Browse files Browse the repository at this point in the history
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
  • Loading branch information
azure-sdk and benbp committed Nov 8, 2022
1 parent 3ea2705 commit 070162c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ $FailedCommands = New-Object Collections.Generic.List[hashtable]

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

$limitRangeSpec = @"
apiVersion: v1
kind: LimitRange
metadata:
name: default-resource-request
spec:
limits:
- defaultRequest:
cpu: 100m
memory: 100Mi
type: Container
"@

# Powershell does not (at time of writing) treat exit codes from external binaries
# as cause for stopping execution, so do this via a wrapper function.
# See https://github.com/PowerShell/PowerShell-RFC/pull/277
Expand Down Expand Up @@ -191,6 +204,9 @@ function DeployStressPackage(
Write-Host "Creating namespace $($pkg.Namespace) if it does not exist..."
kubectl create namespace $pkg.Namespace --dry-run=client -o yaml | kubectl apply -f -
if ($LASTEXITCODE) {exit $LASTEXITCODE}
Write-Host "Adding default resource requests to namespace/$($pkg.Namespace)"
$limitRangeSpec | kubectl apply -n $pkg.Namespace -f -
if ($LASTEXITCODE) {exit $LASTEXITCODE}

$dockerBuildConfigs = @()

Expand Down

0 comments on commit 070162c

Please sign in to comment.