Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Deployment script for load2 (#2367)

Eric Bariauxd08aced5f86a
diff --git a/test/load2-eks/README.md b/test/load2-eks/README.md
index 7ed88c0cc..dfa56cd6e 100644
--- a/test/load2-eks/README.md
+++ b/test/load2-eks/README.md
@@ -33,6 +33,14 @@ aws ecr get-login-password --region eu-west-1 | docker login --username AWS --pa
docker buildx build --push --platform linux/amd64,linux/arm64 -t $AWS_DEVELOPERS_ACCOUNT_ID.dkr.ecr.eu-west-1.amazonaws.com/openremote/manager:load2 manager/build/install/manager/
```
+You might want to update the stack without re-creating the whole cluster, as re-creating the cluster takes time and
+requires re-generating a new certificate (on which we have some limits).
+To do so, keep the proxy running and uninstall the other charts
+```shell
+helm uninstall manager postgresql keycloak
+```
+then use the `eks-deploy-load.sh` script to properly re-deploy those charts.
+
Once deployed, running the load tests can be done using the same clients as for load testing a VM,
but using the scenarios present under `scenarios` in this folder instead.
See `load1` folder for the tools, scripts and documentation.
diff --git a/test/load2-eks/eks-cleanup-load.sh b/test/load2-eks/eks-cleanup-load.sh
index e0b2f811c..5b11f85ae 100755
--- a/test/load2-eks/eks-cleanup-load.sh
+++ b/test/load2-eks/eks-cleanup-load.sh
@@ -1,5 +1,11 @@
#!/bin/bash
+if [ -z "$K_CONTEXT" ]; then
+ echo "Error: K_CONTEXT environment variable is not set"
+ echo "Please set it to the kubernetes context to use with: export K_CONTEXT=context"
+ exit 1
+fi
+
. ./eks-common.sh
CLUSTER_VPC_ID=$(aws eks describe-cluster --name $CLUSTER_NAME --query 'cluster.resourcesVpcConfig.vpcId' --output text --profile or)
@@ -19,10 +25,10 @@ aws route53 change-resource-record-sets \
'{"Changes": [ { "Action": "DELETE", "ResourceRecordSet": { "Name": "'$FQDN'", "Type": "A", "AliasTarget":{ "HostedZoneId": '$HOSTED_ZONE_ID',"DNSName": '$DNS_NAME',"EvaluateTargetHealth": false} } } ]}' \
--profile dnschg
-helm uninstall manager
-helm uninstall keycloak
-helm uninstall postgresql
-helm uninstall proxy
+helm uninstall --kube-context=$K_CONTEXT manager
+helm uninstall --kube-context=$K_CONTEXT keycloak
+helm uninstall --kube-context=$K_CONTEXT postgresql
+helm uninstall --kube-context=$K_CONTEXT proxy
echo "Delete VPC peerings"
@@ -42,15 +48,15 @@ while aws elbv2 describe-load-balancers --profile or --query "LoadBalancers[?Vp
echo "Waiting for load balancers to be deleted..."
sleep 10
done
-helm uninstall aws-load-balancer-controller -n kube-system
+helm uninstall --kube-context=$K_CONTEXT aws-load-balancer-controller -n kube-system
MANAGER_VOLUMEID=$(kubectl get pv manager-data-pv -o=jsonpath='{.spec.awsElasticBlockStore.volumeID}')
PSQL_VOLUMEID=$(kubectl get pv postgresql-data-pv -o=jsonpath='{.spec.awsElasticBlockStore.volumeID}')
-kubectl delete pv manager-data-pv
-kubectl delete pv postgresql-data-pv
+kubectl --context $K_CONTEXT delete pv manager-data-pv
+kubectl --context $K_CONTEXT delete pv postgresql-data-pv
aws ec2 delete-volume --volume-id $MANAGER_VOLUMEID
aws ec2 delete-volume --volume-id $PSQL_VOLUMEID
-helm uninstall or-setup
+helm uninstall --kube-context=$K_CONTEXT or-setup
# Manually deleting all addons, this should not be required but otherwise the delete cluster fails
# with "2 pods are unevictable from node ..." error messages
diff --git a/test/load2-eks/eks-deploy-load.sh b/test/load2-eks/eks-deploy-load.sh
new file mode 100755
index 000000000..7c802f2ed
--- /dev/null
+++ b/test/load2-eks/eks-deploy-load.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+if [ -z "$K_CONTEXT" ]; then
+ echo "Error: K_CONTEXT environment variable is not set"
+ echo "Please set it to the kubernetes context to use with: export K_CONTEXT=context"
+ exit 1
+fi
+
+. ./eks-common.sh
+
+kubectl --context $K_CONTEXT patch pv manager-data-pv -p '{"spec":{"claimRef": null}}'
+kubectl --context $K_CONTEXT patch pv postgresql-data-pv -p '{"spec":{"claimRef": null}}'
+
+helm install --kube-context=$K_CONTEXT postgresql $OR_KUBERNETES_PATH/postgresql -f $OR_KUBERNETES_PATH/postgresql/values-eks.yaml -f profiles/$OR_PROFILE/values-postgresql-eks-load.yaml
+
+helm install --kube-context=$K_CONTEXT keycloak $OR_KUBERNETES_PATH/keycloak -f $OR_KUBERNETES_PATH/keycloak/values-haproxy.yaml \
+ -f profiles/$OR_PROFILE/values-keycloak-eks-load.yaml --set-string or.hostname=$FQDN
+
+helm install --kube-context=$K_CONTEXT manager $OR_KUBERNETES_PATH/manager -f $OR_KUBERNETES_PATH/manager/values-haproxy-eks.yaml \
+ -f profiles/$OR_PROFILE/values-manager-eks-load.yaml --set-string or.hostname=$FQDN --set or.setupRunOnRestart=true \
+ --set-string image.repository=$AWS_DEVELOPERS_ACCOUNT_ID.dkr.ecr.eu-west-1.amazonaws.com/openremote/manager