Skip to content

Commit

Permalink
Adapt performance test (#928)
Browse files Browse the repository at this point in the history
  • Loading branch information
barchw authored Jul 10, 2024
1 parent 9500993 commit 0a752be
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 46 deletions.
35 changes: 1 addition & 34 deletions hack/ci/gardener-perf-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,39 +23,6 @@ trap cleanup EXIT INT

tag=$(gcloud container images list-tags europe-docker.pkg.dev/kyma-project/prod/istio-manager --limit 1 --format json | jq '.[0].tags[1]')
IMG=europe-docker.pkg.dev/kyma-project/prod/istio-manager:${tag} make install deploy
kubectl apply -f config/samples/operator_v1alpha2_istio.yaml

number=1
while [[ $number -le 100 ]] ; do
echo ">--> checking Istio status #$number"
STATUS=$(kubectl get -n kyma-system istio default -o jsonpath='{.status.state}')
echo "kyma status: ${STATUS:='UNKNOWN'}"
[[ "$STATUS" == "Ready" ]] && break
sleep 5
((number = number + 1))
done
number=1
while [[ $number -le 100 ]] ; do
ip=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
[[ "$ip" != "" ]] && break
sleep 5
((number = number + 1))
done

domain=$(kubectl config view -o json | jq '.clusters[0].cluster.server' | sed -e "s/https:\/\/api.//" -e 's/"//g')
kubectl annotate service -n istio-system istio-ingressgateway "dns.gardener.cloud/dnsnames=*.${domain}" --overwrite

cd tests/performance || exit

n=0
until [ "$n" -ge 5 ]
do
make test-performance && break
n=$((n+1))
sleep 15
done

if [ "$n" -ge 5 ]; then
echo "Failed to run performance tests"
exit 1
fi
make test-performance
22 changes: 11 additions & 11 deletions tests/performance/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,31 @@ test-deploy:
kubectl rollout status deployment/load-testing
kubectl cp scripts/common.js $(shell kubectl get pods --selector=app=k6 -o jsonpath='{.items[0].metadata.name}'):run.js -c k6-alpine

test-performance: deploy-helm test-deploy
sleep 60

kubectl scale --replicas=3 deployment/istio-ingressgateway -n istio-system
test-performance: deploy-max-replicas-istio deploy-helm test-deploy
kubectl patch deployment/load-testing --type merge --patch-file istio-disabled.yaml
kubectl rollout status deployment/load-testing
kubectl exec -q $(shell kubectl get pods --selector=app=k6 -o jsonpath='{.items[0].metadata.name}') -- k6 run run.js -d 1m --vus 500 --out influxdb=http://load-testing-influxdb:8086/k6 --log-output none --system-tags=method,name,status,tag -e DOMAIN=${KYMA_DOMAIN};\
EXIT_CODE=$$?;\
echo "Performance test without sidecar test completed with exit code $$EXIT_CODE"
sleep 2

kubectl scale --replicas=3 deployment/istio-ingressgateway -n istio-system
sleep 60
sleep 5
kubectl cp $(shell kubectl get pods --selector=app=k6 -o jsonpath='{.items[0].metadata.name}'):summary.html summary-no-sidecar.html

kubectl scale --replicas=3 deployment/istio-ingressgateway -n istio-system
kubectl patch deployment/load-testing --type merge --patch-file istio-enabled.yaml
kubectl rollout status deployment/load-testing
kubectl exec -q $(shell kubectl get pods --selector=app=k6 -o jsonpath='{.items[0].metadata.name}') -- k6 run run.js -d 1m --vus 500 --out influxdb=http://load-testing-influxdb:8086/k6 --log-output none --system-tags=method,name,status,tag -e DOMAIN=${KYMA_DOMAIN};\
EXIT_CODE=$$?;\
echo "Performance test with sidecar test completed with exit code $$EXIT_CODE"

sleep 5
kubectl cp $(shell kubectl get pods --selector=app=k6 -o jsonpath='{.items[0].metadata.name}'):summary.html summary-sidecar.html

cd hack/puppeteer && KYMA_DOMAIN=${KYMA_DOMAIN} ./export.sh

.PHONY: test-performance
deploy-max-replicas-istio:
kubectl apply -f istio-max-replicas.yaml
kubectl wait --for='jsonpath={.status.state}=Ready' --timeout=5m -n kyma-system istio default
kubectl wait -n istio-system --for=jsonpath='{.status.loadBalancer.ingress}' service/istio-ingressgateway

domain=$(shell kubectl config view -o json | jq '.clusters[0].cluster.server' | sed -e "s/https:\/\/api.//" -e 's/"//g');\
kubectl annotate service -n istio-system istio-ingressgateway "dns.gardener.cloud/dnsnames=*.${domain}" --overwrite

.PHONY: test-performance deploy-max-replicas-istio deploy-helm test-deploy
12 changes: 12 additions & 0 deletions tests/performance/istio-max-replicas.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: operator.kyma-project.io/v1alpha2
kind: Istio
metadata:
name: default
namespace: kyma-system
spec:
components:
ingressGateway:
k8s:
hpaSpec:
maxReplicas: 10
minReplicas: 10
2 changes: 1 addition & 1 deletion tests/performance/load-testing/templates/httpbin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ kind: Deployment
metadata:
name: {{ .Release.Name }}
spec:
replicas: 1
replicas: 10
selector:
matchLabels:
app: {{ .Release.Name }}
Expand Down

0 comments on commit 0a752be

Please sign in to comment.