Skip to content

Commit 46f6d4d

Browse files
committed
Make script customizable
1 parent c8b69ac commit 46f6d4d

File tree

3 files changed

+32
-122
lines changed

3 files changed

+32
-122
lines changed

Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,5 @@ generate-e2e-client:
4848
go generate ./e2e/client
4949
.PHONY: generate-e2e-client
5050

51-
# TODO: Make this less simplistic
52-
run-loadtest:
53-
# TODO: Required because of reusing config
54-
API_KEY=dummy API_URL=http://example.com CLUSTER_ID=D30A163C-C5DF-4CC8-985C-D1449398295E KUBECONFIG=~/.kube/config LOG_LEVEL=4 go run . test-server
51+
deploy-loadtest: release
52+
IMAGE_REPOSITORY=$(DOCKER_REPOSITORY) IMAGE_TAG=$(VERSION) ./hack/loadtest/deploy.sh

hack/loadtest/deploy.sh

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,31 @@
1+
#!/usr/bin/env bash
2+
3+
CC_IMAGE_REPOSITORY="${IMAGE_REPOSITORY:-us-docker.pkg.dev/castai-hub/library/cluster-controller}"
4+
CC_IMAGE_TAG="${IMAGE_TAG:-latest}"
5+
DEPLOY_CLUSTER_CONTROLLER="${DEPLOY_CLUSTER_CONTROLLER:-true}"
6+
7+
# Determine the directory where the script resides.
8+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9+
10+
echo "Deploying kwok"
111
helm repo add kwok https://kwok.sigs.k8s.io/charts/
212
helm repo update kwok
313

414
helm upgrade --namespace castai-agent --create-namespace --install kwok kwok/kwok
515
helm upgrade --namespace castai-agent --create-namespace --install kwok-stages kwok/stage-fast
616
helm upgrade --namespace castai-agent --create-namespace --install kwok-metrics kwok/metrics-usage
717

8-
# TODO: Tune kwok to be faster?
9-
10-
11-
helm upgrade --namespace castai-agent --create-namespace --install cluster-controller castai-helm/castai-cluster-controller \
12-
--set castai.apiKey="dummy" \
13-
--set castai.apiURL="http://castai-loadtest-agent-service.castai-agent.svc.cluster.local.:8080" \
14-
--set castai.clusterID="00000000-0000-0000-0000-000000000000" \
15-
--set image.repository=docker.io/lachezarcast/cluster-controller \
16-
--set image.tag="loadtest" \
17-
--set image.pullPolicy="Always" \
18-
--set autoscaling.enabled="true"
18+
if [ "$DEPLOY_CLUSTER_CONTROLLER" = "true" ]; then
19+
echo "Deploying cluster controller"
20+
helm upgrade --namespace castai-agent --create-namespace --install cluster-controller castai-helm/castai-cluster-controller \
21+
--set castai.apiKey="dummy" \
22+
--set castai.apiURL="http://castai-loadtest-agent-service.castai-agent.svc.cluster.local.:8080" \
23+
--set castai.clusterID="00000000-0000-0000-0000-000000000000" \
24+
--set image.repository="$CC_IMAGE_REPOSITORY" \
25+
--set image.tag="$CC_IMAGE_TAG" \
26+
--set image.pullPolicy="Always" \
27+
--set autoscaling.enabled="true"
28+
fi
1929

20-
kubectl apply -k . # TODO
30+
echo "Deploying load testing components"
31+
kubectl apply -k "$SCRIPT_DIR"

hack/loadtest/grafana/cluster-controller-dashboard.json

Lines changed: 7 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@
7171
{
7272
"color": "green",
7373
"value": null
74-
},
75-
{
76-
"color": "red",
77-
"value": 80
7874
}
7975
]
8076
}
@@ -87,95 +83,6 @@
8783
"x": 0,
8884
"y": 0
8985
},
90-
"id": 15,
91-
"options": {
92-
"legend": {
93-
"calcs": [],
94-
"displayMode": "list",
95-
"placement": "bottom",
96-
"showLegend": true
97-
},
98-
"tooltip": {
99-
"hideZeros": false,
100-
"mode": "single",
101-
"sort": "none"
102-
}
103-
},
104-
"pluginVersion": "11.5.2",
105-
"targets": [
106-
{
107-
"editorMode": "code",
108-
"expr": "sum(rate(action_executed_total[$__rate_interval])) by (type)",
109-
"legendFormat": "__auto",
110-
"range": true,
111-
"refId": "A"
112-
}
113-
],
114-
"title": "Actions/s executed",
115-
"type": "timeseries"
116-
},
117-
{
118-
"datasource": {
119-
"type": "prometheus",
120-
"uid": "PBFA97CFB590B2093"
121-
},
122-
"fieldConfig": {
123-
"defaults": {
124-
"color": {
125-
"mode": "palette-classic"
126-
},
127-
"custom": {
128-
"axisBorderShow": false,
129-
"axisCenteredZero": false,
130-
"axisColorMode": "text",
131-
"axisLabel": "",
132-
"axisPlacement": "auto",
133-
"barAlignment": 0,
134-
"barWidthFactor": 0.6,
135-
"drawStyle": "line",
136-
"fillOpacity": 0,
137-
"gradientMode": "none",
138-
"hideFrom": {
139-
"legend": false,
140-
"tooltip": false,
141-
"viz": false
142-
},
143-
"insertNulls": false,
144-
"lineInterpolation": "linear",
145-
"lineWidth": 1,
146-
"pointSize": 5,
147-
"scaleDistribution": {
148-
"type": "linear"
149-
},
150-
"showPoints": "auto",
151-
"spanNulls": false,
152-
"stacking": {
153-
"group": "A",
154-
"mode": "none"
155-
},
156-
"thresholdsStyle": {
157-
"mode": "off"
158-
}
159-
},
160-
"mappings": [],
161-
"thresholds": {
162-
"mode": "absolute",
163-
"steps": [
164-
{
165-
"color": "green",
166-
"value": null
167-
}
168-
]
169-
}
170-
},
171-
"overrides": []
172-
},
173-
"gridPos": {
174-
"h": 8,
175-
"w": 12,
176-
"x": 12,
177-
"y": 0
178-
},
17986
"id": 1,
18087
"options": {
18188
"legend": {
@@ -209,7 +116,7 @@
209116
"refId": "A"
210117
}
211118
],
212-
"title": "Actions execute",
119+
"title": "Actions executed",
213120
"type": "timeseries"
214121
},
215122
{
@@ -565,8 +472,7 @@
565472
"mode": "absolute",
566473
"steps": [
567474
{
568-
"color": "green",
569-
"value": null
475+
"color": "green"
570476
},
571477
{
572478
"color": "red",
@@ -658,8 +564,7 @@
658564
"mode": "absolute",
659565
"steps": [
660566
{
661-
"color": "green",
662-
"value": null
567+
"color": "green"
663568
},
664569
{
665570
"color": "red",
@@ -751,8 +656,7 @@
751656
"mode": "absolute",
752657
"steps": [
753658
{
754-
"color": "green",
755-
"value": null
659+
"color": "green"
756660
},
757661
{
758662
"color": "red",
@@ -844,8 +748,7 @@
844748
"mode": "absolute",
845749
"steps": [
846750
{
847-
"color": "green",
848-
"value": null
751+
"color": "green"
849752
},
850753
{
851754
"color": "red",
@@ -950,8 +853,7 @@
950853
"mode": "absolute",
951854
"steps": [
952855
{
953-
"color": "green",
954-
"value": null
856+
"color": "green"
955857
},
956858
{
957859
"color": "red",
@@ -1043,8 +945,7 @@
1043945
"mode": "absolute",
1044946
"steps": [
1045947
{
1046-
"color": "green",
1047-
"value": null
948+
"color": "green"
1048949
},
1049950
{
1050951
"color": "red",

0 commit comments

Comments
 (0)