Skip to content

Commit 7e6b9b3

Browse files
authored
K8s: Add test results for Grid autoscaling with KEDA (#2490)
Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent 363a1d4 commit 7e6b9b3

24 files changed

+779
-221
lines changed
+155-60
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test Autoscaling
1+
name: Test Grid Autoscaling in Kubernetes
22

33
on:
44
workflow_call:
@@ -8,20 +8,82 @@ on:
88
required: false
99
type: string
1010
default: 'false'
11+
push-results:
12+
description: 'Publish the results to the repository'
13+
required: false
14+
type: boolean
15+
default: false
16+
iteration:
17+
description: 'Test a specific iteration'
18+
required: false
19+
type: string
20+
default: '20'
1121
workflow_dispatch:
22+
inputs:
23+
publish-results:
24+
description: 'Publish the results to the repository'
25+
required: false
26+
type: boolean
27+
default: false
28+
pr-results:
29+
description: 'Create a PR with the results'
30+
required: false
31+
type: boolean
32+
default: false
33+
iteration:
34+
description: 'Test a specific iteration'
35+
required: false
36+
type: string
37+
default: '20'
1238

1339
permissions:
14-
contents: read
40+
contents: write
41+
pull-requests: write
42+
43+
env:
44+
RUN_ID: ${{ github.run_id }}
45+
TEST_AUTOSCALING_ITERATIONS: ${{ github.event.inputs.iteration || '20' }}
1546

1647
jobs:
1748
build-and-test:
1849
name: Test K8s
19-
runs-on: blacksmith-16vcpu-ubuntu-2204
50+
runs-on: ubuntu-latest
2051
strategy:
2152
fail-fast: false
2253
matrix:
2354
include:
2455
- k8s-version: 'v1.31.2'
56+
test-strategy: test_k8s_autoscaling_job_count_strategy_default_in_chaos
57+
cluster: 'minikube'
58+
helm-version: 'v3.16.3'
59+
docker-version: '27.3.1'
60+
python-version: '3.13'
61+
- k8s-version: 'v1.31.2'
62+
test-strategy: test_k8s_autoscaling_job_count_strategy_default_with_node_max_sessions
63+
cluster: 'minikube'
64+
helm-version: 'v3.16.3'
65+
docker-version: '27.3.1'
66+
python-version: '3.13'
67+
- k8s-version: 'v1.31.2'
68+
test-strategy: test_k8s_autoscaling_job_count_strategy_default
69+
cluster: 'minikube'
70+
helm-version: 'v3.16.3'
71+
docker-version: '27.3.1'
72+
python-version: '3.13'
73+
- k8s-version: 'v1.31.2'
74+
test-strategy: test_k8s_autoscaling_deployment_count_in_chaos
75+
cluster: 'minikube'
76+
helm-version: 'v3.16.3'
77+
docker-version: '27.3.1'
78+
python-version: '3.13'
79+
- k8s-version: 'v1.31.2'
80+
test-strategy: test_k8s_autoscaling_deployment_count_with_node_max_sessions
81+
cluster: 'minikube'
82+
helm-version: 'v3.16.3'
83+
docker-version: '27.3.1'
84+
python-version: '3.13'
85+
- k8s-version: 'v1.31.2'
86+
test-strategy: test_k8s_autoscaling_deployment_count
2587
cluster: 'minikube'
2688
helm-version: 'v3.16.3'
2789
docker-version: '27.3.1'
@@ -53,8 +115,6 @@ jobs:
53115
with:
54116
python-version: ${{ matrix.python-version }}
55117
check-latest: true
56-
- name: Verify chart configuration up-to-date
57-
run: make lint_readme_charts
58118
- name: Get branch name (only for push to branch)
59119
if: github.event_name == 'push'
60120
run: echo "BRANCH=$(echo ${PUSH_BRANCH##*/})" >> $GITHUB_ENV
@@ -79,83 +139,118 @@ jobs:
79139
echo "AUTHORS=${AUTHORS}" >> $GITHUB_ENV
80140
env:
81141
AUTHORS: ${{ vars.AUTHORS || 'SeleniumHQ' }}
82-
- name: Build Helm charts
83-
run: |
84-
BUILD_DATE=${BUILD_DATE} make chart_build
85-
echo "CHART_PACKAGE_PATH=$(cat /tmp/selenium_chart_version)" >> $GITHUB_ENV
86-
echo "CHART_FILE_NAME=$(basename $(cat /tmp/selenium_chart_version))" >> $GITHUB_ENV
87-
- name: Build Docker images
88-
uses: nick-invision/retry@master
89-
with:
90-
timeout_minutes: 12
91-
max_attempts: 3
92-
retry_wait_seconds: 60
93-
command: NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make build
94142
- name: Setup Kubernetes cluster
95143
uses: nick-invision/retry@master
96144
with:
97145
timeout_minutes: 10
98146
max_attempts: 3
99147
command: CLUSTER=${CLUSTER} SERVICE_MESH=${SERVICE_MESH} KUBERNETES_VERSION=${KUBERNETES_VERSION} NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make chart_cluster_setup
100-
- name: Test Selenium Grid on Kubernetes with Autoscaling
101-
uses: nick-invision/retry@master
102-
with:
103-
timeout_minutes: 30
104-
max_attempts: 3
105-
command: |
106-
NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} TEST_UPGRADE_CHART=false make chart_test_autoscaling_job_count_chaos
107-
- name: Upload results
108-
if: always()
109-
uses: actions/upload-artifact@main
110-
with:
111-
name: chart_test_autoscaling_job_count_chaos
112-
path: ./tests/tests/*.md
113-
if-no-files-found: ignore
114-
- name: Test Selenium Grid on Kubernetes with Autoscaling
115-
uses: nick-invision/retry@master
116-
with:
117-
timeout_minutes: 30
118-
max_attempts: 3
119-
command: |
120-
NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} TEST_UPGRADE_CHART=false make chart_test_autoscaling_job_count_max_sessions
121-
- name: Upload results
122-
if: always()
123-
uses: actions/upload-artifact@main
124-
with:
125-
name: chart_test_autoscaling_job_count_max_sessions
126-
path: ./tests/tests/*.md
127-
if-no-files-found: ignore
128-
- name: Test Selenium Grid on Kubernetes with Autoscaling
148+
- name: Build Docker images
129149
uses: nick-invision/retry@master
130150
with:
131-
timeout_minutes: 30
151+
timeout_minutes: 12
132152
max_attempts: 3
133-
command: |
134-
NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} TEST_UPGRADE_CHART=false make chart_test_autoscaling_job_count_strategy_accurate
135-
- name: Upload results
136-
if: always()
137-
uses: actions/upload-artifact@main
138-
with:
139-
name: chart_test_autoscaling_job_count_strategy_accurate
140-
path: ./tests/tests/*.md
141-
if-no-files-found: ignore
153+
retry_wait_seconds: 60
154+
command: NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make build
155+
- name: Build Helm charts
156+
run: |
157+
BUILD_DATE=${BUILD_DATE} make chart_build
158+
echo "CHART_PACKAGE_PATH=$(cat /tmp/selenium_chart_version)" >> $GITHUB_ENV
159+
echo "CHART_FILE_NAME=$(basename $(cat /tmp/selenium_chart_version))" >> $GITHUB_ENV
142160
- name: Test Selenium Grid on Kubernetes with Autoscaling
143161
uses: nick-invision/retry@master
144162
with:
145163
timeout_minutes: 30
146164
max_attempts: 3
147165
command: |
148-
NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} TEST_UPGRADE_CHART=false make chart_test_autoscaling_job_count
166+
NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} TEST_UPGRADE_CHART=false TEST_AUTOSCALING_ITERATIONS=${TEST_AUTOSCALING_ITERATIONS} \
167+
make ${{ matrix.test-strategy }}
168+
- name: Rename results
169+
run: mv ./tests/tests/autoscaling_results.md ./tests/tests/results_${{ matrix.test-strategy }}.md
149170
- name: Upload results
150171
if: always()
151-
uses: actions/upload-artifact@main
172+
uses: actions/upload-artifact@v4
152173
with:
153-
name: chart_test_autoscaling_job_count
154-
path: ./tests/tests/*.md
174+
name: results_${{ matrix.test-strategy }}
175+
path: ./tests/tests/results_${{ matrix.test-strategy }}.md
155176
if-no-files-found: ignore
156177
- name: Cleanup Kubernetes cluster
157178
if: always()
158179
run: CLUSTER=${CLUSTER} make chart_cluster_cleanup
159180
- name: Clean up Docker
160181
if: always()
161182
run: docker system prune -af
183+
184+
publish-results:
185+
name: Publish Results
186+
if: (!failure() && !cancelled() && (github.event.inputs.publish-results == 'true'))
187+
runs-on: ubuntu-latest
188+
needs: build-and-test
189+
steps:
190+
- name: Checkout code
191+
uses: actions/checkout@main
192+
with:
193+
persist-credentials: false
194+
fetch-depth: 0
195+
- name: Download results
196+
uses: actions/download-artifact@v4
197+
with:
198+
path: ./.keda
199+
pattern: 'results_*'
200+
merge-multiple: 'true'
201+
run-id: ${{ env.RUN_ID }}
202+
github-token: ${{ secrets.GITHUB_TOKEN }}
203+
- name: Commit files
204+
run: |
205+
git config --local user.email "[email protected]"
206+
git config --local user.name "Selenium CI Bot"
207+
git add .keda/.
208+
git commit -m "[ci] Upload autoscaling in K8s test results [skip ci]" -a
209+
- name: Push changes
210+
uses: ad-m/github-push-action@master
211+
with:
212+
github_token: ${{ secrets.SELENIUM_CI_TOKEN }}
213+
branch: ${{ env.BRANCH_NAME }}
214+
env:
215+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
216+
217+
218+
pr-results:
219+
name: Create a PR with the results
220+
if: (!failure() && !cancelled() && (github.event.inputs.pr-results == 'true'))
221+
runs-on: ubuntu-latest
222+
needs: build-and-test
223+
steps:
224+
- name: Checkout code
225+
uses: actions/checkout@main
226+
with:
227+
persist-credentials: false
228+
fetch-depth: 0
229+
- name: Download results
230+
uses: actions/download-artifact@v4
231+
with:
232+
path: ./.keda
233+
pattern: 'results_*'
234+
merge-multiple: 'true'
235+
run-id: ${{ env.RUN_ID }}
236+
github-token: ${{ secrets.GITHUB_TOKEN }}
237+
- name: Commit configs
238+
run: |
239+
git config --local user.email "[email protected]"
240+
git config --local user.name "Selenium CI Bot"
241+
- name: Create Pull Request
242+
id: cpr
243+
uses: peter-evans/create-pull-request@main
244+
with:
245+
token: ${{ secrets.SELENIUM_CI_TOKEN }}
246+
commit-message: "[ci] Upload autoscaling in K8s test results"
247+
title: "[ci] Upload autoscaling in K8s test results"
248+
body: "This PR contains the results of the autoscaling tests in Kubernetes"
249+
committer: 'Selenium CI Bot <[email protected]>'
250+
author: 'Selenium CI Bot <[email protected]>'
251+
branch: autoscaling-results
252+
- name: Check outputs
253+
if: ${{ steps.cpr.outputs.pull-request-number }}
254+
run: |
255+
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
256+
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"

.keda/README.md

+14-3
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,24 @@ You can involve to review and discuss the pull requests to help us early detect
5151

5252
- https://github.com/kedacore/keda/pull/6368
5353

54-
~~- https://github.com/kedacore/keda/pull/6169 (merged, v2.16.0)~~
54+
- ~~https://github.com/kedacore/keda/pull/6169 (merged, v2.16.0)~~
5555

5656
[kedacore/keda-docs](https://github.com/kedacore/keda-docs)
5757

58-
- https://github.com/kedacore/keda-docs/pull/1504
58+
- ~~https://github.com/kedacore/keda-docs/pull/1468 (merged, v2.16.0)~~
5959

60-
~~- https://github.com/kedacore/keda-docs/pull/1468 (merged, v2.16.0)~~
60+
# Test results of the patch scaler
61+
62+
There are tests for the patched scaler implementation. You can run the tests by following the steps in [../tests/README.md](../tests/README.md).
63+
64+
Test results could be referred to
65+
66+
- [results_test_k8s_autoscaling_job_count_strategy_default.md](./results_test_k8s_autoscaling_job_count_strategy_default.md)
67+
- [results_test_k8s_autoscaling_job_count_strategy_default_in_chaos.md](./results_test_k8s_autoscaling_job_count_strategy_default_in_chaos.md)
68+
- [results_test_k8s_autoscaling_job_count_strategy_default_with_node_max_sessions.md](./results_test_k8s_autoscaling_job_count_strategy_default_with_node_max_sessions.md)
69+
- [results_test_k8s_autoscaling_deployment_count.md](./results_test_k8s_autoscaling_deployment_count.md)
70+
- [results_test_k8s_autoscaling_deployment_count_in_chaos.md](./results_test_k8s_autoscaling_deployment_count_in_chaos.md)
71+
- [results_test_k8s_autoscaling_deployment_count_with_node_max_sessions.md](./results_test_k8s_autoscaling_deployment_count_with_node_max_sessions.md)
6172

6273
# Resources
6374

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
| Iteration | New request sessions | Sessions created time | Sessions failed to create | New pods scaled up | Total running sessions | Total running pods | Max sessions per pod | Gaps | Sessions closed |
2+
| --------- | -------------------- | --------------------- | ------------------------- | ------------------ | ---------------------- | ------------------ | -------------------- | ---- | --------------- |
3+
| 1 | 1 | 39.44 s | 0 | 1 | 1 | 1 | 1 | 0 | 1 |
4+
| 2 | 2 | 39.77 s | 0 | 1 | 2 | 2 | 1 | 0 | 0 |
5+
| 3 | 1 | 28.38 s | 0 | 1 | 3 | 3 | 1 | 0 | 0 |
6+
| 4 | 2 | 54.92 s | 0 | 2 | 5 | 5 | 1 | 0 | 0 |
7+
| 5 | 2 | 33.04 s | 0 | 2 | 7 | 7 | 1 | 0 | 0 |
8+
| 6 | 1 | 29.43 s | 0 | 1 | 8 | 8 | 1 | 0 | 8 |
9+
| 7 | 2 | 47.04 s | 0 | 1 | 2 | 9 | 1 | 7 | 0 |
10+
| 8 | 2 | 43.42 s | 0 | 1 | 4 | 10 | 1 | 6 | 0 |
11+
| 9 | 2 | 47.99 s | 0 | 0 | 6 | 10 | 1 | 4 | 0 |
12+
| 10 | 3 | 44.97 s | 0 | 2 | 9 | 12 | 1 | 3 | 0 |
13+
| 11 | 3 | 42.98 s | 0 | -2 | 12 | 10 | 1 | -2 | 12 |
14+
| 12 | 1 | 4.52 s | 0 | 0 | 1 | 10 | 1 | 9 | 0 |
15+
| 13 | 2 | 39.93 s | 0 | 1 | 3 | 11 | 1 | 8 | 0 |
16+
| 14 | 1 | 29.45 s | 0 | 1 | 4 | 12 | 1 | 8 | 0 |
17+
| 15 | 2 | 30.52 s | 0 | 1 | 6 | 13 | 1 | 7 | 0 |
18+
| 16 | 3 | 35.62 s | 0 | 3 | 9 | 16 | 1 | 7 | 9 |
19+
| 17 | 3 | 16.59 s | 0 | 0 | 3 | 16 | 1 | 13 | 0 |
20+
| 18 | 3 | 36.76 s | 0 | 1 | 6 | 10 | 1 | 4 | 0 |
21+
| 19 | 3 | 29.10 s | 0 | 1 | 9 | 11 | 1 | 2 | 0 |
22+
| 20 | 3 | 51.36 s | 0 | 3 | 12 | 14 | 1 | 2 | 0 |

0 commit comments

Comments
 (0)