-
Notifications
You must be signed in to change notification settings - Fork 1
225 lines (187 loc) · 7.2 KB
/
e2e-perf.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
name: Test - E2E - Performance # e2e tests running against a k8s cluster
on:
pull_request:
branches:
- main
types:
- opened
- reopened
- synchronize
- closed
env:
N_SIMUL_PERF_DATA_FILE: n-simul-perf-data.json
E2E_UTILS: ./hack/e2e/perf/scripts/utils.sh
permissions:
contents: write
pull-requests: write
id-token: write
jobs:
build-operator:
uses: ./.github/workflows/build-operator.yaml
name: Build Operator Image
secrets: inherit
perf-test-minikube:
needs:
- build-operator
name: Performance Test - Minikube
runs-on: ubuntu-latest
strategy:
matrix:
git_branch:
- main
- PR
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
ref: ${{ matrix.git_branch == 'main' && 'main' || github.head_ref }}
- name: Checkout hack from PR
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
path: pr-temp
- name: Copy hack outside of pr-temp
run: cp -r pr-temp/hack/* hack
# - name: List contents
# run: |
# rm -rf pr-temp
# ls -R ./
# Identify comment to be updated
- name: Find comment for Performance Overview
uses: peter-evans/find-comment@v2
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
body-includes: Performance Overview
direction: last
# Create/Update comment with action deployment status
- name: Create or Update Comment with Performance Overview
id: notification
uses: peter-evans/create-or-update-comment@v2
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
## Operator Performance Overview
:gear: Running performance tests on Minikube
edit-mode: replace
- name: install yq
run: sudo snap install yq
- name: Download Helm Values Artifact
uses: actions/download-artifact@v3
with:
name: helm-values
- name: Start Minikube
run: minikube start --addons default-storageclass,storage-provisioner --driver=docker
- name: Install Uffizzi Cluster Operator
id: prev
run: |
helm dep update ./chart
helm upgrade --install --wait pr-${{ github.event.pull_request.number }} \
./chart -f helm-values.yaml
- name: Create PERF_DATA_FILE
run: |
# Ensure the file exists and initialize it as an empty array if not
if [ ! -f "$PERF_DATA_FILE" ]; then
echo '[]' > "$PERF_DATA_FILE"
fi
- name: Time taken to create UffizziClusters with different numbers of workers
run: |
n_simultaneous_clusters=3
for n_workers in $(seq 1 5 31); do
# update concurrent workers
yq -i '.concurrent = "$n_workers"' helm-values.yaml
# upgrade helm chart
helm upgrade --install --wait pr-${{ github.event.pull_request.number }} \
./chart -f helm-values.yaml
# time taken to create n clusters simultaneously
time=$(bash hack/e2e/perf/01-multicluster.sh $n_simultaneous_clusters)
bash $E2E_UTILS update_json_with_workers_and_time $n_workers $time $PERF_DATA_FILE
done
cat $PERF_DATA_FILE
# - name: dummy data
# shell: bash
# run: |
# if [[ "${{ github.ref_name }}" == "main" ]]; then
# factor=2
# else
# factor=1
# fi
# echo '[
# {"workers": 5, "time": '$((50 * factor))'},
# {"workers": 10, "time": '$((100 * factor))'},
# {"workers": 15, "time": '$((150 * factor))'},
# {"workers": 20, "time": '$((200 * factor))'},
# {"workers": 25, "time": '$((250 * factor))'},
# {"workers": 30, "time": '$((300 * factor))'}
# ]' > $PERF_DATA_FILE
- name: Rename and update PERF_DATA_FILE
run: |
NEW_NAME="${PERF_DATA_FILE%.json}-${{ matrix.git_branch }}.json"
mv $PERF_DATA_FILE $NEW_NAME
echo "PERF_DATA_FILE=$NEW_NAME" >> $GITHUB_ENV
- name: Upload PERF_DATA_FILE artifact
uses: actions/upload-artifact@v2
with:
name: perf-data-${{ matrix.git_branch }}
path: ${{ env.PERF_DATA_FILE }}
performance-overview:
name: Collate performance data and post overview
needs:
- perf-test-minikube
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
# Identify comment to be updated
- name: Find comment for Performance Overview
uses: peter-evans/find-comment@v2
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
body-includes: Performance Overview
direction: last
- name: Download perf data - PR
uses: actions/download-artifact@v2
with:
name: perf-data-PR
- name: Download perf data - main
uses: actions/download-artifact@v2
with:
name: perf-data-main
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install matplotlib
- name: Create Graph
run: python hack/e2e/perf/viz/generate_n_simul_graph.py
- name: Upload the simultaneous cluster creation test image to Imgur
id: upload_image
uses: devicons/[email protected]
with:
path: ./simul_graph.png
client_id: ${{ secrets.IMGUR_CLIENT_ID }}
- name: Update Comment with Performance Overview
uses: peter-evans/create-or-update-comment@v2
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
## Operator Performance Overview
### Cold Start Performance Test
This test would assess the duration and efficiency of initializing the first cluster,
which typically takes longer due to initial setup tasks such as pulling images and configuring the
environment. The test aims to capture the performance impact of these one-time operations to understand
the startup behavior and identify potential areas for optimization.
### Simultaneous cluster creation
Creating simultaneously to check if operator is able to manage the load of creating multiple clusters
at once. Creating multiple clusters simultaneously, in operator deployments; of varying number of concurrent
workers help us understand how the operator manages high load in restricted environments as well.
![Graph](${{ fromJSON(steps.upload_image.outputs.imgur_urls)[0] }})
edit-mode: replace