Skip to content

Commit

Permalink
ci: Add control through environment variables for CNI Load Test (#2277)
Browse files Browse the repository at this point in the history
* ci: conditional run logic

* add: SCENARIO env var control

* ci: change RUN to CNI

* ci: move SCENARIO to job level

* fix: change env vars to unique values

* ci: condition logic and description
  • Loading branch information
jpayne3506 authored Oct 12, 2023
1 parent 1190646 commit 6ddc44c
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 42 deletions.
11 changes: 11 additions & 0 deletions .pipelines/cni/cilium/cilium-overlay-load-test-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ parameters:
vmSize: "Standard_DS4_v2"
os: "linux"

# Condition confirms that:
# Previous job has reported Succeeded. Previous job is currently setup which controls variable assignment and we are dependent on its success.
# CONTROL_CNI either contains 'cniv1' or 'all'. It is not case sensitive
stages:
- stage: create_${{ parameters.name }}
condition: and( succeeded(), or( contains(variables.CONTROL_CNI, 'cilium') , contains(variables.CONTROL_CNI, 'all') ) )
variables:
commitID: $[ stagedependencies.setup.env.outputs['SetEnvVars.commitID'] ]
dependsOn:
Expand All @@ -27,6 +31,10 @@ stages:
vmSize: ${{ parameters.vmSize }}
region: $(LOCATION)

# Conditions for below E2E test scenarios confirm that:
# Pipeline has not been canceled and that the previous job has reports anything other than failure(Succeeded, SuccededWithIssues, Skipped). Previous job is declared by dependsOn:
# CONTROL_SCENARIO either contains 'all' or its respective scenario 'npm', 'scaleTest', 'restartNode', 'restartCNS'. It is not case sensitive
# Ex. CONTROL_SCENARIO = "restartnode SCALETEST" will only run Scale Test and Restart Test.
- stage: ${{ parameters.name }}
variables:
commitID: $[ stagedependencies.setup.env.outputs['SetEnvVars.commitID'] ]
Expand Down Expand Up @@ -70,6 +78,7 @@ stages:
sudo -E env "PATH=$PATH" make test-integration CNS_VERSION=$(cnsVersion) CNI_DROPGZ_VERSION=$(dropgzVersion) INSTALL_CNS=true INSTALL_OVERLAY=true TEST_DROPGZ=${{ parameters.testDropgz }} CNS_IMAGE_REPO=$(CNS_IMAGE_REPO)
kubectl get po -owide -A
- job: deploy_pods
condition: and( and( not(canceled()), not(failed()) ), or( contains(variables.CONTROL_SCENARIO, 'scaleTest') , contains(variables.CONTROL_SCENARIO, 'all') ) )
displayName: "Scale Test"
dependsOn: deploy_cilium_components
steps:
Expand All @@ -85,6 +94,7 @@ stages:
parameters:
clusterName: ${{ parameters.clusterName }}-$(commitID)
- job: restart_nodes
condition: and( and( not(canceled()), not(failed()) ), or( contains(variables.CONTROL_SCENARIO, 'restartNode') , contains(variables.CONTROL_SCENARIO, 'all') ) )
displayName: "Restart Test"
dependsOn: deploy_pods
steps:
Expand All @@ -101,6 +111,7 @@ stages:
restartCase: "true"
cnsManagedEndpoint: "true"
- job: restart_cns
condition: and( and( not(canceled()), not(failed()) ), or( contains(variables.CONTROL_SCENARIO, 'restartCNS') , contains(variables.CONTROL_SCENARIO, 'all') ) )
displayName: "Restart and Validate CNS"
dependsOn: restart_nodes
steps:
Expand Down
90 changes: 68 additions & 22 deletions .pipelines/cni/singletenancy/cniv1-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,67 @@ parameters:
# + The HNS state should be validated with that of CNI state.
# + All CNI E2E is re-ran after HNS service is restarted

# If ensures that only linux template calls are compared against the below condition
# Condition confirms that:
# Previous job has reported Succeeded. Previous job is currently setup which controls variable assignment and we are dependent on its success.
# CONTROL_OS either contains 'linux' or 'all' and CONTROL_CNI either contains 'cniv1' or 'all'. Both must be true and are not case sensitive
stages:
- stage: create_${{ parameters.name }}
variables:
commitID: $[ stagedependencies.setup.env.outputs['SetEnvVars.commitID'] ]
npmVersion: $[ stagedependencies.setup.env.outputs['SetEnvVars.npmVersion'] ]
pool:
name: $(BUILD_POOL_NAME_DEFAULT)
dependsOn:
- setup
displayName: "Create Cluster - ${{ parameters.clusterName }}"
jobs:
- job: create_aks_cluster_with_${{ parameters.name }}
steps:
- template: ../load-test-templates/create-cluster-template.yaml
parameters:
clusterType: ${{ parameters.clusterType }}
clusterName: ${{ parameters.clusterName }}-$(commitID)
nodeCount: ${{ parameters.nodeCount }}
vmSize: ${{ parameters.vmSize }}
vmSizeWin: ${{ parameters.vmSizeWin }}
region: $(LOCATION)
osSKU: ${{ parameters.osSKU }}
- ${{ if eq(parameters.os, 'linux') }}:
- stage: create_${{ parameters.name }}
condition: and( succeeded(), and( or( contains(variables.CONTROL_CNI, 'cniv1'), contains(variables.CONTROL_CNI, 'all') ), or( contains(variables.CONTROL_OS, 'linux'), contains(variables.CONTROL_OS, 'all') ) ) )
variables:
commitID: $[ stagedependencies.setup.env.outputs['SetEnvVars.commitID'] ]
npmVersion: $[ stagedependencies.setup.env.outputs['SetEnvVars.npmVersion'] ]
pool:
name: $(BUILD_POOL_NAME_DEFAULT)
dependsOn:
- setup
displayName: "Create Cluster - ${{ parameters.clusterName }}"
jobs:
- job: create_aks_cluster_with_${{ parameters.name }}
steps:
- template: ../load-test-templates/create-cluster-template.yaml
parameters:
clusterType: ${{ parameters.clusterType }}
clusterName: ${{ parameters.clusterName }}-$(commitID)
nodeCount: ${{ parameters.nodeCount }}
vmSize: ${{ parameters.vmSize }}
vmSizeWin: ${{ parameters.vmSizeWin }}
region: $(LOCATION)
osSKU: ${{ parameters.osSKU }}

# If ensures that only windows template calls are compared against the below condition
# Condition confirms that:
# Previous job has reported Succeeded. Previous job is currently setup which controls variable assignment and we are dependent on its success.
# CONTROL_OS either contains 'windows' or 'all' and CONTROL_CNI either contains 'cniv1' or 'all'. Both must be true and are not case sensitive
- ${{ if eq(parameters.os, 'windows') }}:
- stage: create_${{ parameters.name }}
condition: and( succeeded(), and( or( contains(variables.CONTROL_CNI, 'cniv1'), contains(variables.CONTROL_CNI, 'all') ), or( contains(variables.CONTROL_OS, 'windows'), contains(variables.CONTROL_OS, 'all') ) ) )
variables:
commitID: $[ stagedependencies.setup.env.outputs['SetEnvVars.commitID'] ]
npmVersion: $[ stagedependencies.setup.env.outputs['SetEnvVars.npmVersion'] ]
pool:
name: $(BUILD_POOL_NAME_DEFAULT)
dependsOn:
- setup
displayName: "Create Cluster - ${{ parameters.clusterName }}"
jobs:
- job: create_aks_cluster_with_${{ parameters.name }}
steps:
- template: ../load-test-templates/create-cluster-template.yaml
parameters:
clusterType: ${{ parameters.clusterType }}
clusterName: ${{ parameters.clusterName }}-$(commitID)
nodeCount: ${{ parameters.nodeCount }}
vmSize: ${{ parameters.vmSize }}
vmSizeWin: ${{ parameters.vmSizeWin }}
region: $(LOCATION)
osSKU: ${{ parameters.osSKU }}

# Conditions for below E2E test scenarios confirm that:
# Pipeline has not been canceled and that the previous job has reports anything other than failure(Succeeded, SuccededWithIssues, Skipped). Previous job is declared by dependsOn:
# CONTROL_SCENARIO either contains 'all' or its respective scenario 'npm', 'scaleTest', 'restartNode', 'restartCNS'. It is not case sensitive
# Ex. CONTROL_SCENARIO = "restartnode SCALETEST" will only run Scale Test and Restart Test.
- stage: ${{ parameters.name }}
variables:
commitID: $[ stagedependencies.setup.env.outputs['SetEnvVars.commitID'] ]
Expand Down Expand Up @@ -95,6 +133,7 @@ stages:
tag: $(npmVersion)
dependsOn: update_cni
- job: deploy_pods
condition: and( and( not(canceled()), not(failed()) ), or( contains(variables.CONTROL_SCENARIO, 'scaleTest') , contains(variables.CONTROL_SCENARIO, 'all') ) )
displayName: "Scale Test"
dependsOn: npm_k8se2e
steps:
Expand All @@ -112,6 +151,7 @@ stages:
os: ${{ parameters.os }}
cni: cniv1
- job: restart_nodes
condition: and( and( not(canceled()), not(failed()) ), or( contains(variables.CONTROL_SCENARIO, 'restartNode') , contains(variables.CONTROL_SCENARIO, 'all') ) )
displayName: "Restart Test"
dependsOn: deploy_pods
steps:
Expand Down Expand Up @@ -176,6 +216,10 @@ stages:
clusterName: ${{ parameters.clusterName }}-$(commitID)
os: ${{ parameters.os }}

# Conditions for below E2E test scenarios confirm that:
# Pipeline has not been canceled and that the previous job has reports anything other than failure(Succeeded, SuccededWithIssues, Skipped). Previous job is declared by dependsOn:
# CONTROL_SCENARIO either contains 'all' or its respective scenario 'npm', 'scaleTest', 'restartNode', 'restartCNS'. It is not case sensitive
# Ex. CONTROL_SCENARIO = "restartnode SCALETEST" will only run Scale Test and Restart Test.
- ${{ if eq(parameters.os, 'windows') }}:
- stage: ${{ parameters.name }}_HNS
variables:
Expand All @@ -191,13 +235,14 @@ stages:
jobs:
- job: restart_hns
displayName: "Restart and Validate HNS"
condition: and( succeeded(), ${{ eq(parameters.os, 'windows') }} )
condition: and( and( not(canceled()), not(failed()) ), ${{ eq(parameters.os, 'windows') }} )
steps:
- template: ../load-test-templates/restart-hns-template.yaml
parameters:
clusterName: ${{ parameters.clusterName }}-$(commitID)
cni: cniv1
- job: deploy_podsHNS
condition: and( and( not(canceled()), not(failed()) ), or( contains(variables.CONTROL_SCENARIO, 'scaleTest') , contains(variables.CONTROL_SCENARIO, 'all') ) )
displayName: "Scale Test"
dependsOn: restart_hns
steps:
Expand All @@ -215,6 +260,7 @@ stages:
os: ${{ parameters.os }}
cni: cniv1
- job: restart_nodesHNS
condition: and( and( not(canceled()), not(failed()) ), or( contains(variables.CONTROL_SCENARIO, 'restartNode') , contains(variables.CONTROL_SCENARIO, 'all') ) )
displayName: "Restart Test"
dependsOn: deploy_podsHNS
steps:
Expand Down
81 changes: 62 additions & 19 deletions .pipelines/cni/singletenancy/linux-cniv2-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,73 @@ parameters:
testDropgz: true
osSKU: Ubuntu

# CNIv2
# + Should be able to scale up/down the pods successfully certain number of times.
# + Node reboot scenarios should be covered.
# + The CNS state should be validated with that of CNI state.
# + Pods should have ips assigned and connectivity/datapath test should be present.
# + CNS restart and validates the state
# Windows
# The HNS state should be validated with that of CNI state.
# + All CNI E2E is re-ran after HNS service is restarted

# If ensures that only linux template calls are compared against the below condition
# Condition confirms that:
# Previous job has reported Succeeded. Previous job is currently setup which controls variable assignment and we are dependent on its success.
# CONTROL_OS either contains 'linux' or 'all' and CONTROL_CNI either contains 'cniv1' or 'all'. Both must be true and are not case sensitive
stages:
- stage: create_${{ parameters.name }}
variables:
commitID: $[ stagedependencies.setup.env.outputs['SetEnvVars.commitID'] ]
pool:
name: $(BUILD_POOL_NAME_DEFAULT)
dependsOn:
- setup
displayName: "Create Cluster - ${{ parameters.clusterName }}"
jobs:
- job: create_aks_cluster_with_${{ parameters.name }}
steps:
- template: ../load-test-templates/create-cluster-template.yaml
parameters:
clusterType: ${{ parameters.clusterType }}
clusterName: ${{ parameters.clusterName }}-$(commitID)
nodeCount: ${{ parameters.nodeCount }}
vmSize: ${{ parameters.vmSize }}
region: $(LOCATION)
osSKU: ${{ parameters.osSKU }}
- ${{ if eq(parameters.os, 'linux') }}:
- stage: create_${{ parameters.name }}
condition: and( succeeded(), and( or( contains(variables.CONTROL_CNI, 'cniv2'), contains(variables.CONTROL_CNI, 'all') ), or( contains(variables.CONTROL_OS, 'linux'), contains(variables.CONTROL_OS, 'all') ) ) )
variables:
commitID: $[ stagedependencies.setup.env.outputs['SetEnvVars.commitID'] ]
pool:
name: $(BUILD_POOL_NAME_DEFAULT)
dependsOn:
- setup
displayName: "Create Cluster - ${{ parameters.clusterName }}"
jobs:
- job: create_aks_cluster_with_${{ parameters.name }}
steps:
- template: ../load-test-templates/create-cluster-template.yaml
parameters:
clusterType: ${{ parameters.clusterType }}
clusterName: ${{ parameters.clusterName }}-$(commitID)
nodeCount: ${{ parameters.nodeCount }}
vmSize: ${{ parameters.vmSize }}
region: $(LOCATION)
osSKU: ${{ parameters.osSKU }}

# If ensures that only windows template calls are compared against the below condition
# Condition confirms that:
# Previous job has reported Succeeded. Previous job is currently setup which controls variable assignment and we are dependent on its success.
# CONTROL_OS either contains 'windows' or 'all' and CONTROL_CNI either contains 'cniv2' or 'all'. Both must be true and are not case sensitive
- ${{ if eq(parameters.os, 'windows') }}:
- stage: create_${{ parameters.name }}
condition: and( succeeded(), and( or( contains(variables.CONTROL_CNI, 'cniv2'), contains(variables.CONTROL_CNI, 'all') ), or( contains(variables.CONTROL_OS, 'windows'), contains(variables.CONTROL_OS, 'all') ) ) )
variables:
commitID: $[ stagedependencies.setup.env.outputs['SetEnvVars.commitID'] ]
pool:
name: $(BUILD_POOL_NAME_DEFAULT)
dependsOn:
- setup
displayName: "Create Cluster - ${{ parameters.clusterName }}"
jobs:
- job: create_aks_cluster_with_${{ parameters.name }}
steps:
- template: ../load-test-templates/create-cluster-template.yaml
parameters:
clusterType: ${{ parameters.clusterType }}
clusterName: ${{ parameters.clusterName }}-$(commitID)
nodeCount: ${{ parameters.nodeCount }}
vmSize: ${{ parameters.vmSize }}
region: $(LOCATION)
osSKU: ${{ parameters.osSKU }}

# Conditions for below E2E test scenarios confirm that:
# Pipeline has not been canceled and that the previous job has reports anything other than failure(Succeeded, SuccededWithIssues, Skipped). Previous job is declared by dependsOn:
# CONTROL_SCENARIO either contains 'all' or its respective scenario 'npm', 'scaleTest', 'restartNode', 'restartCNS'. It is not case sensitive
# Ex. CONTROL_SCENARIO = "restartnode SCALETEST" will only run Scale Test and Restart Test.
- stage: ${{ parameters.name }}
variables:
commitID: $[ stagedependencies.setup.env.outputs['SetEnvVars.commitID'] ]
Expand Down Expand Up @@ -93,6 +133,7 @@ stages:
dependsOn: integration
continueOnError: true
- job: deploy_pods
condition: and( and( not(canceled()), not(failed()) ), or( contains(variables.CONTROL_SCENARIO, 'scaleTest') , contains(variables.CONTROL_SCENARIO, 'all') ) )
displayName: "Scale Test"
dependsOn: npm_k8se2e
steps:
Expand All @@ -110,6 +151,7 @@ stages:
os: ${{ parameters.os }}
cni: cniv2
- job: restart_nodes
condition: and( and( not(canceled()), not(failed()) ), or( contains(variables.CONTROL_SCENARIO, 'restartNode') , contains(variables.CONTROL_SCENARIO, 'all') ) )
displayName: "Restart Test"
dependsOn: deploy_pods
steps:
Expand All @@ -127,6 +169,7 @@ stages:
cni: cniv2
restartCase: "true"
- job: restart_cns
condition: and( and( not(canceled()), not(failed()) ), or( contains(variables.CONTROL_SCENARIO, 'restartCNS') , contains(variables.CONTROL_SCENARIO, 'all') ) )
displayName: "Restart and Validate CNS"
dependsOn: restart_nodes
steps:
Expand Down
6 changes: 5 additions & 1 deletion .pipelines/npm/npm-cni-integration-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ parameters:
tag: ""
continueOnError: false

# Condition confirms that:
# Pipeline has not been canceled and that the previous job has reports anything other than failure(Succeeded, SuccededWithIssues, Skipped). Previous job is declared by dependsOn: ${{ parameters.dependsOn }}
# Cluster is either Windows2022 or Linux
# CONTROL_SCENARIO either contains 'npm' or 'all'. It is not case sensitive
jobs:
- job: npm_k8se2e
displayName: "NPM k8s E2E"
dependsOn: ${{ parameters.dependsOn }}
condition: and(succeeded(), ${{ or(contains(parameters.os_version, '2022'), eq(parameters.os, 'linux')) }} )
condition: and( and( not(canceled()), not(failed()) ), ${{ or(contains(parameters.os_version, '2022'), eq(parameters.os, 'linux') ) }} , or( contains(variables.CONTROL_SCENARIO, 'npm') , contains(variables.CONTROL_SCENARIO, 'all') ) )
pool:
name: $(BUILD_POOL_NAME_DEFAULT)
demands:
Expand Down

0 comments on commit 6ddc44c

Please sign in to comment.