Skip to content

Commit

Permalink
Fix aks pipeline to test e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
lanlou1554 committed Jul 29, 2022
1 parent c7f6eb1 commit 901819c
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 26 deletions.
15 changes: 6 additions & 9 deletions .pipelines/run-autoscaling-e2e.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
pr:
schedules:
- cron: "0 1 * * *"
displayName: Daily AKS Autoscaling E2E Test
branches:
include:
- master
- release-*
paths:
exclude:
- docs
- site
- helm
- .github

pr: none

pool:
vmImage: ubuntu-18.04
Expand Down Expand Up @@ -60,7 +57,7 @@ stages:
REGISTRY_PASSWORD: $(registry.password)
- job: create_aks_cluster_and_run_tests_job
dependsOn: [build_push_ccm_image_job, build_push_cnm_image_job]
timeoutInMinutes: 100
timeoutInMinutes: 300
steps:
- bash: |
CLUSTER_TYPE="autoscaling"
Expand Down
15 changes: 6 additions & 9 deletions .pipelines/run-autoscaling-multipool-e2e.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
pr:
schedules:
- cron: "0 5 * * *"
displayName: Daily AKS Autoscaling Multipool E2E Test
branches:
include:
- master
- release-*
paths:
exclude:
- docs
- site
- helm
- .github

pr: none

pool:
vmImage: ubuntu-18.04
Expand Down Expand Up @@ -60,7 +57,7 @@ stages:
REGISTRY_PASSWORD: $(registry.password)
- job: create_aks_cluster_and_run_tests_job
dependsOn: [build_push_ccm_image_job, build_push_cnm_image_job]
timeoutInMinutes: 100
timeoutInMinutes: 300
steps:
- bash: |
CLUSTER_TYPE="autoscaling-multipool"
Expand Down
4 changes: 2 additions & 2 deletions .pipelines/run-basic-lb-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ stages:
REGISTRY_PASSWORD: $(registry.password)
- job: create_aks_cluster_and_run_tests_job
dependsOn: [build_push_ccm_image_job, build_push_cnm_image_job]
timeoutInMinutes: 100
timeoutInMinutes: 300
steps:
- bash: |
CCLUSTER_TYPE="basic-lb"
CLUSTER_TYPE="basic-lb"
echo "##vso[task.setvariable variable=CLUSTER_TYPE]${CLUSTER_TYPE}"
displayName: set cluster type
- bash: |
Expand Down
16 changes: 14 additions & 2 deletions .pipelines/scripts/run-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set -o errexit
set -o nounset
set -o pipefail

REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/../..
REPO_ROOT=$(realpath $(dirname "${BASH_SOURCE[0]}")/../..)
export GOPATH="/home/vsts/go"
export PATH="${PATH}:${GOPATH}/bin"
export AKS_CLUSTER_ID="/subscriptions/${AZURE_SUBSCRIPTION_ID}/resourcegroups/${RESOURCE_GROUP}/providers/Microsoft.ContainerService/managedClusters/${CLUSTER_NAME}"
Expand All @@ -27,7 +27,7 @@ az extension add -n aks-preview
az login --service-principal -u "${AZURE_CLIENT_ID}" -p "${AZURE_CLIENT_SECRET}" --tenant "${AZURE_TENANT_ID}"

get_random_location() {
local LOCATIONS=("eastus" "eastus2" "southcentralus" "westus3" "australiaeast")
local LOCATIONS=("eastus" "eastus2" "southcentralus" "westus3")
echo "${LOCATIONS[${RANDOM} % ${#LOCATIONS[@]}]}"
}

Expand All @@ -39,6 +39,9 @@ cleanup() {
trap cleanup EXIT

export AZURE_LOCATION="$(get_random_location)"
if [[ "${CLUSTER_TYPE}" =~ "autoscaling" ]]; then
export AZURE_LOCATION="australiaeast"
fi

echo "Setting up customconfiguration.json"
IMAGE_TAG="$(git rev-parse --short=7 HEAD)"
Expand Down Expand Up @@ -83,5 +86,14 @@ kubectl wait --for=condition=Ready node --all --timeout=5m
kubectl get node -owide

echo "Running e2e"

# TODO: We should do it in autoscaling-multipool.json
if [[ "${CLUSTER_TYPE}" == "autoscaling-multipool" ]]; then
az aks update --resource-group "${RESOURCE_GROUP}" --name "${CLUSTER_NAME}" --cluster-autoscaler-profile balance-similar-node-groups=true
fi

export E2E_ON_AKS_CLUSTER=true
if [[ "${CLUSTER_TYPE}" =~ "autoscaling" ]]; then
export LABEL_FILTER="Feature:Autoscaling"
fi
make test-ccm-e2e
4 changes: 2 additions & 2 deletions .pipelines/templates/autoscaling-multipool.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"agentPoolProfiles": [
{
"name": "agentpool1",
"count": 2,
"count": 1,
"mode" : "System",
"vmSize": "Standard_DS2_v2",
"osType": "Linux",
Expand All @@ -26,7 +26,7 @@
},
{
"name": "agentpool2",
"count": 2,
"count": 1,
"mode" : "System",
"vmSize": "Standard_DS2_v2",
"osType": "Linux",
Expand Down
2 changes: 1 addition & 1 deletion .pipelines/templates/autoscaling.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"agentPoolProfiles": [
{
"name": "agentpool1",
"count": 2,
"count": 1,
"mode" : "System",
"vmSize": "Standard_DS2_v2",
"osType": "Linux",
Expand Down
2 changes: 1 addition & 1 deletion hack/test-ccm-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ LABEL_FILTER="${LABEL_FILTER:-${DEFAULT_LABEL_FILTER}}"

if [[ -n "${E2E_ON_AKS_CLUSTER}" ]]; then
AKS_CLUSTER_E2E_LABEL_FILTER="!Autoscaling && !Multi-Nodepool && !Single-Nodepool && !VMSS && !Spot-VM && !Kubenet && !Multi-Group && !AvailabilitySet && !PLS && !SLBOutbound && !ServiceAnnotation && !Credential && !Node && !LB && !Multi-Ports && !NSG"
LABEL_FILTER="${LABEL_FILTER} && ${AKS_CLUSTER_E2E_LABEL_FILTER}"
LABEL_FILTER="${AKS_CLUSTER_E2E_LABEL_FILTER}"
fi

source "${REPO_ROOT}/hack/ensure-ginkgo-v2.sh"
Expand Down

0 comments on commit 901819c

Please sign in to comment.