From f77ca51f77ff9c229601b6362bbc937eddc3c929 Mon Sep 17 00:00:00 2001 From: Ben Broderick Phillips Date: Thu, 25 Apr 2024 19:20:16 -0400 Subject: [PATCH 1/2] Migrate stress cluster to use workload identity --- .../scripts/stress-testing/stress-test-deployment-lib.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1 b/eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1 index f05f7388f7881..c17e416eccdc3 100644 --- a/eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1 +++ b/eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1 @@ -216,6 +216,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} + # Give a few seconds for stress watcher to initialize the federated identity credential + # and create the service account before we reference it + Start-Sleep 5 Write-Host "Adding default resource requests to namespace/$($pkg.Namespace)" $limitRangeSpec | kubectl apply -n $pkg.Namespace -f - if ($LASTEXITCODE) {exit $LASTEXITCODE} From 55a1f90b87492c94f7f3f2e9cc2af56285768936 Mon Sep 17 00:00:00 2001 From: Ben Broderick Phillips Date: Thu, 23 May 2024 12:05:06 -0400 Subject: [PATCH 2/2] Only sleep to sync fed creds when namespace is new --- .../stress-test-deployment-lib.ps1 | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1 b/eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1 index c17e416eccdc3..c3468a111b5de 100644 --- a/eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1 +++ b/eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1 @@ -213,12 +213,17 @@ function DeployStressPackage( $imageTagBase += "/$($pkg.Namespace)/$($pkg.ReleaseName)" if (!$Template) { - 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} - # Give a few seconds for stress watcher to initialize the federated identity credential - # and create the service account before we reference it - Start-Sleep 5 + Write-Host "Checking for namespace $($pkg.Namespace)" + kubectl get namespace $pkg.Namespace + if ($LASTEXITCODE) { + Write-Host "Creating namespace $($pkg.Namespace) ..." + kubectl create namespace $pkg.Namespace --dry-run=client -o yaml | kubectl apply -f - + if ($LASTEXITCODE) {exit $LASTEXITCODE} + # Give a few seconds for stress watcher to initialize the federated identity credential + # and create the service account before we reference it + Write-Host "Waiting 15 seconds for namespace federated credentials to be created and synced" + Start-Sleep 15 + } Write-Host "Adding default resource requests to namespace/$($pkg.Namespace)" $limitRangeSpec | kubectl apply -n $pkg.Namespace -f - if ($LASTEXITCODE) {exit $LASTEXITCODE}