You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.2 KiB
47 lines
1.2 KiB
#!/bin/bash
|
|
|
|
set -e
|
|
set -x
|
|
|
|
if [ ! -d "$1" ]
|
|
then
|
|
echo "Helm dir does not exist!"
|
|
exit 1
|
|
fi
|
|
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
POSTFIX=$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 10 | head -n 1)
|
|
NAMESPACE="covidok-ci-$POSTFIX"
|
|
HELM_PACKAGE="covid-$POSTFIX"
|
|
|
|
printf "$NAMESPACE" > "$DIR/namespace"
|
|
|
|
kubectl create namespace "$NAMESPACE"
|
|
|
|
helm install -f "$DIR/ci_values.yaml" -n "$NAMESPACE" "$HELM_PACKAGE" "$1"
|
|
|
|
while [ ! $(kubectl get pod -n "$NAMESPACE" | wc -l) -gt 0 ]
|
|
do
|
|
echo "No pods in namespace..."
|
|
sleep 2
|
|
done
|
|
|
|
i=0
|
|
while [[ $(kubectl get pod -n "$NAMESPACE" -o jsonpath='{.items[*].status.containerStatuses[0].ready}') == *"false"* ]]; do
|
|
echo "Covidok backend is not yet ready..."
|
|
# Timeout is 200 sec, mysql should be available after 2 min
|
|
if [ $i -gt 40 ]
|
|
then
|
|
echo "Timeout reached while waiting for backend to start"
|
|
exit 1
|
|
else
|
|
sleep 5
|
|
fi
|
|
i=$((i+1))
|
|
done
|
|
|
|
echo "Covidok backend is up"
|
|
CLUSTERIP=$(kubectl get svc -n test1 -l=app.kubernetes.io/name=covidok -o jsonpath='{.items[*].spec.clusterIP}')
|
|
echo "ClusterIP of service is $CLUSTERIP, writing to file"
|
|
printf $CLUSTERIP > $DIR/tests/host.file
|
|
|