Skip to content

Commit

Permalink
CI:[CNI] Templatise CNI load test pipeline yaml (#2011)
Browse files Browse the repository at this point in the history
  • Loading branch information
vipul-21 authored Jun 16, 2023
1 parent 5f53f7a commit e0d0856
Show file tree
Hide file tree
Showing 6 changed files with 151 additions and 76 deletions.
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
pr: none
trigger: none
parameters:
dependsOn: ""
name: "cilium"
clusterType: "overlay-no-kube-proxy-up"
clusterName: "cilium-overlay"
nodeCount: 10
vmSize: "Standard_DS4_v2"


stages:
- stage: creating_aks_cluster
displayName: "Create AKS Cluster with Cilium"

- stage: createAKScluster
dependsOn: ${{ parameters.dependsOn }}
displayName: "AKS Cluster with Cilium"
jobs:
- job: create_aks_cluster_with_cilium
- job: create_aks_cluster_with_${{ parameters.name }}
steps:
- task: AzureCLI@1
inputs:
azureSubscription: $(TEST_SUB_SERVICE_CONNECTION)
scriptLocation: "inlineScript"
scriptType: "bash"
addSpnToEnvironment: true
inlineScript: |
set -ex
make -C ./hack/swift azcfg AZCLI=az REGION=$(LOCATION)
make -C ./hack/swift overlay-no-kube-proxy-up AZCLI=az REGION=$(LOCATION) SUB=$(SUBSCRIPTION_ID) CLUSTER=${RESOURCE_GROUP}-$(make revision) NODE_COUNT=10 VM_SIZE=Standard_DS4_v2
name: "CreateAksCluster"
displayName: "Create AKS Cluster"
- template: ../load-test-templates/create-cluster-template.yaml
parameters:
clusterType: ${{ parameters.clusterType }}
clusterName: ${{ parameters.clusterName }}
nodeCount: ${{ parameters.nodeCount }}
vmSize: ${{ parameters.vmSize }}
- stage: install_cilium
dependsOn: creating_aks_cluster
dependsOn: createAKScluster
displayName: "Install Cilium on AKS Overlay"
jobs:
- job: deploy_cilium_components
Expand All @@ -35,7 +37,7 @@ stages:
inlineScript: |
set -ex
az extension add --name aks-preview
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${RESOURCE_GROUP}-$(make revision)
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(make revision)
ls -lah
pwd
kubectl cluster-info
Expand Down Expand Up @@ -65,73 +67,39 @@ stages:
jobs:
- job: deploy_pods
steps:
- task: AzureCLI@1
displayName: "Pod Deployment"
inputs:
azureSubscription: $(TEST_SUB_SERVICE_CONNECTION)
scriptLocation: "inlineScript"
scriptType: "bash"
addSpnToEnvironment: true
inlineScript: |
set -ex
az extension add --name aks-preview
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${RESOURCE_GROUP}-$(make revision)
cd test/integration/load
go test -timeout 30m -tags load -run ^TestLoad$ -tags=load -iterations=4 -scaleup=2400
- template: ../load-test-templates/pod-deployment-template.yaml
parameters:
clusterName: ${{ parameters.clusterName }}
- stage: validate_state
dependsOn: pod_deployment
displayName: "Validate State"
jobs:
- job: validate_state
steps:
- task: AzureCLI@1
inputs:
azureSubscription: $(TEST_SUB_SERVICE_CONNECTION)
scriptLocation: "inlineScript"
scriptType: "bash"
addSpnToEnvironment: true
inlineScript: |
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${RESOURCE_GROUP}-$(make revision)
kubectl get pods -A
make test-validate-state
name: "ValidateState"
displayName: "Validate State"
retryCountOnTaskFailure: 3
- template: ../load-test-templates/validate-state-template.yaml
parameters:
clusterName: ${{ parameters.clusterName }}
- stage: restart_nodes
dependsOn: validate_state
displayName: "Restart Node"
jobs:
- job: restart_nodes
steps:
- task: AzureCLI@1
inputs:
azureSubscription: $(TEST_SUB_SERVICE_CONNECTION)
scriptLocation: "inlineScript"
scriptType: "bash"
addSpnToEnvironment: true
inlineScript: |
echo "Scale up the pods and immediated restart the nodes"
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${RESOURCE_GROUP}-$(make revision)
make -C ./hack/swift azcfg AZCLI=az REGION=$(LOCATION)
cd test/integration/load
echo "Scaling the pods down to 100 per node"
go test -count 1 -timeout 30m -tags load -run ^TestScaleDeployment$ -tags=load -scaleup=1000 -skip-wait=true
cd ../../../
echo "Restarting the nodes"
vmss_name=$(az vmss list -g MC_${RESOURCE_GROUP}_${RESOURCE_GROUP}_$(LOCATION) --query "[].name" -o tsv)
make -C ./hack/swift restart-vmss AZCLI=az CLUSTER=${RESOURCE_GROUP}-$(make revision) REGION=$(LOCATION) VMSS_NAME=$vmss_name
cd test/integration/load
go test -count 1 -timeout 30m -tags load -run ^TestScaleDeployment$ -tags=load -replicas=1000
name: "RestartNodes"
displayName: "Restart Nodes"
- script: |
export RESTART_CASE=true
make test-validate-state
name: "ValidateState"
displayName: "Validate State"
retryCountOnTaskFailure: 3
- stage: connectivity_tests
- template: ../load-test-templates/restart-node-template.yaml
parameters:
clusterName: ${{ parameters.clusterName }}
- stage: validate_restart_state
dependsOn: restart_nodes
displayName: "Validate Restart State"
jobs:
- job: validate_restart_state
steps:
- template: ../load-test-templates/validate-state-template.yaml
parameters:
clusterName: ${{ parameters.clusterName }}
restartCase: "true"
- stage: connectivity_tests
dependsOn: validate_restart_state
displayName: "Connectivity Tests"
jobs:
- job: cni_tests
Expand All @@ -154,7 +122,7 @@ stages:
addSpnToEnvironment: true
inlineScript: |
set -ex
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${RESOURCE_GROUP}-$(make revision)
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(make revision)
name: "GetCluster"
displayName: "Get AKS Cluster"
- script: |
Expand All @@ -181,9 +149,9 @@ stages:
if [ "$(DELETE_RESOURCES)" ]
then
echo "Deleting Cluster and resource group"
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${RESOURCE_GROUP}-$(make revision)
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(make revision)
make -C ./hack/swift azcfg AZCLI=az REGION=$(LOCATION)
make -C ./hack/swift down AZCLI=az REGION=$(LOCATION) SUB=$(SUBSCRIPTION_ID) CLUSTER=${RESOURCE_GROUP}-$(make revision)
make -C ./hack/swift down AZCLI=az REGION=$(LOCATION) SUB=$(SUBSCRIPTION_ID) CLUSTER=${{ parameters.clusterName }}-$(make revision)
echo "Cluster and resources down"
else
echo "Deletion of resources is False"
Expand Down
19 changes: 19 additions & 0 deletions .pipelines/cni/load-test-templates/create-cluster-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
parameters:
clusterType: ""
clusterName: ""
nodeCount: ""
vmSize: ""

steps:
- task: AzureCLI@1
inputs:
azureSubscription: $(TEST_SUB_SERVICE_CONNECTION)
scriptLocation: "inlineScript"
scriptType: "bash"
addSpnToEnvironment: true
inlineScript: |
set -ex
make -C ./hack/swift azcfg AZCLI=az REGION=$(LOCATION)
make -C ./hack/swift ${{ parameters.clusterType }} AZCLI=az REGION=$(LOCATION) SUB=$(SUBSCRIPTION_ID) CLUSTER=${{ parameters.clusterName }}-$(make revision) NODE_COUNT=${{ parameters.nodeCount }} VM_SIZE=${{ parameters.vmSize }}
name: "CreateAksCluster"
displayName: "Create AKS Cluster"
17 changes: 17 additions & 0 deletions .pipelines/cni/load-test-templates/pod-deployment-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
parameters:
clusterName: ""

steps:
- task: AzureCLI@1
displayName: "Pod Deployment"
inputs:
azureSubscription: $(TEST_SUB_SERVICE_CONNECTION)
scriptLocation: "inlineScript"
scriptType: "bash"
addSpnToEnvironment: true
inlineScript: |
set -ex
az extension add --name aks-preview
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(make revision)
cd test/integration/load
go test -timeout 30m -tags load -run ^TestLoad$ -tags=load -iterations=4 -scaleup=2400
26 changes: 26 additions & 0 deletions .pipelines/cni/load-test-templates/restart-node-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
parameters:
clusterName: ""

steps:
- task: AzureCLI@1
inputs:
azureSubscription: $(TEST_SUB_SERVICE_CONNECTION)
scriptLocation: "inlineScript"
scriptType: "bash"
addSpnToEnvironment: true
inlineScript: |
echo "Scale up the pods and immediated restart the nodes"
clusterName=${{ parameters.clusterName }}-$(make revision)
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${clusterName}
make -C ./hack/swift azcfg AZCLI=az REGION=$(LOCATION)
cd test/integration/load
echo "Scaling the pods down to 100 per node"
go test -count 1 -timeout 30m -tags load -run ^TestScaleDeployment$ -tags=load -scaleup=1000 -skip-wait=true
cd ../../../
echo "Restarting the nodes"
vmss_name=$(az vmss list -g MC_${clusterName}_${clusterName}_$(LOCATION) --query "[].name" -o tsv)
make -C ./hack/swift restart-vmss AZCLI=az CLUSTER=${clusterName} REGION=$(LOCATION) VMSS_NAME=$vmss_name
cd test/integration/load
go test -count 1 -timeout 30m -tags load -run ^TestScaleDeployment$ -tags=load -replicas=1000
name: "RestartNodes"
displayName: "Restart Nodes"
19 changes: 19 additions & 0 deletions .pipelines/cni/load-test-templates/validate-state-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
parameters:
clusterName: ""
restartCase: "false"

steps:
- task: AzureCLI@1
inputs:
azureSubscription: $(TEST_SUB_SERVICE_CONNECTION)
scriptLocation: "inlineScript"
scriptType: "bash"
addSpnToEnvironment: true
inlineScript: |
export RESTART_CASE=${{ parameters.restartCase }}
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(make revision)
kubectl get pods -A
make test-validate-state
name: "ValidateState"
displayName: "Validate State"
retryCountOnTaskFailure: 3
26 changes: 26 additions & 0 deletions .pipelines/cni/pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
pr: none
trigger: none

stages:
- stage: setup
displayName: Setup
jobs:
- job: env
displayName: Setup
pool:
name: "$(BUILD_POOL_NAME_DEFAULT)"
steps:
- script: |
echo "Setting up environment"
go version
name: "SetEnvVars"
displayName: "Set Environment Variables"
condition: always()
- template: cilium/cilium-overlay-load-test-template.yaml
parameters:
name: cilium
clusterType: "overlay-no-kube-proxy-up"
clusterName: "cilium-overlay"
nodeCount: 10
vmSize: "Standard_DS4_v2"
dependsOn: setup

0 comments on commit e0d0856

Please sign in to comment.