Skip to content

test: add scale-test to workflow #50

test: add scale-test to workflow

test: add scale-test to workflow #50

name: E2E Test v2
on:
push:
branches:
- 'alexcastilio/clusterloader2'
inputs:
create_cluster:
description: "Create AKS Cluster"
default: false
type: boolean
value: false
cluster_name:
description: "AKS Cluster Name"
type: string
# TODO: remove my default value
default: "lx-retina-e2e-tests"
resource_group:
description: "Resource Group"
type: string
# TODO: remove my default value
default: "lx-retina-e2e-tests"
workflow_dispatch:
inputs:
image_namespace:
description: "Image Namespace (if not set, default namespace will be used)"
type: string
image_tag:
description: "Image Tag (if not set, default for this commit will be used)"
type: string
num_deployments:
description: "Number of Traffic Deployments"
default: 1000
type: number
num_replicas:
description: "Number of Traffic Replicas per Deployment"
default: 40
type: number
num_netpol:
description: "Number of Network Policies"
default: 1000
type: number
cleanup:
description: "Clean up environment after test"
default: true
type: boolean
workflow_call:
inputs:
num_deployments:
description: "Number of Traffic Deployments"
default: 1000
type: number
num_replicas:
description: "Number of Traffic Replicas per Deployment"
default: 40
type: number
num_netpol:
description: "Number of Network Policies"
default: 1000
type: number
cleanup:
description: "Clean up environment after test"
default: true
type: boolean
permissions:
contents: read
id-token: write
jobs:
setup-cluster:
if: ${{ github.event.inputs.create_cluster == 'true' }}
name: Config cluster
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set environment variables
uses: ./.github/actions/set-env-variables
- name: Az CLI login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION }}
- name: Create Resource Group
shell: bash
run: echo az group create --name $RESOURCE_GROUP --location $LOCATION
- name: Create AKS Cluster
shell: bash
run: echo az aks create --name $CLUSTER_NAME --node-vm-size $VM_SIZE --load-balancer-sku standard --resource-group $RESOURCE_GROUP --generate-ssh-keys --location $LOCATION --max-pods 250 --network-plugin azure --network-plugin-mode overlay --tier standard --node-count 5 --pod-cidr 100.64.0.0/10 --kubernetes-version 1.29
- name: Get Kubeconfig
shell: bash
run: az aks get-credentials --name $CLUSTER_NAME --resource-group $RESOURCE_GROUP --overwrite-existing
- name: Deploy Retina
shell: bash
run: make quick-deploy
e2e-test:
name: E2E Test
runs-on: ubuntu-latest
needs: setup-cluster
if: always()
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set environment variables
uses: ./.github/actions/set-env-variables
- name: Setup go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- run: go version
- name: Az CLI login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION }}
- name: Get Kubeconfig
shell: bash
run: az aks get-credentials --name $CLUSTER_NAME --resource-group $RESOURCE_GROUP --overwrite-existing
- name: Run Scale Test
shell: bash
run: |
set -euo pipefail
# Placeholder for test
go test ./test/e2e/. -v -tags=scale -timeout 300s -args -image-tag=$(make version) -create-infra=false -delete-infra=false &
- name: Clone ClusterLoader2
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: kubernetes/perf-tests
# Avoid using renovate to update this dependency because: (1)
# perf-tests does not tag or release, so renovate will pull
# all updates to the default branch and (2) continually
# updating CL2 may impact the stability of the scale test
# results.
ref: 6eb52ac89d5de15a0ad13cfeb2b2026e57ce4f64
persist-credentials: false
sparse-checkout: clusterloader2
path: perf-tests
- name: Setup CL2
run: |
cd perf-tests/clusterloader2
mkdir test
cp ../../.github/actions/cl2/* ./test -r
go build ./cmd/clusterloader.go
ls -l
- name: Run CL2
shell: bash
run: |
set -euo pipefail
cd perf-tests/clusterloader2
./clusterloader --testconfig=./test/config.yaml --provider=aks --kubeconfig=$HOME/.kube/config --v=2 --report-dir=./report
- name: Stop test
shell: bash
run: |
PID=$(ps aux | grep go test | awk '{print $2}')
echo $PID
kill -s 15 $PID
cleanup:
name: Cleanup
runs-on: ubuntu-latest
needs: e2e-test
if: ${{ github.event.inputs.create_cluster == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set environment variables
uses: ./.github/actions/set-env-variables
- name: Az CLI login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION }}
- name: Delete AKS Cluster
shell: bash
run: echo az aks delete --name $CLUSTER_NAME --resource-group $RESOURCE_GROUP --yes