vino/tools/deployment/test-cr.sh
Crank, Daniel (dc6350) 3b685480a4 Integrate vino-builder
This patchset integrates vino-builder into the manager daemonset.
See corresponding vino-builder changes in [0].

[0] https://review.opendev.org/c/airship/images/+/778213
Change-Id: Ic14b791332ca6688f5e4a856913ca3693f33e8d0

Change-Id: I7ccd6dea9666efcd7e0ddccc7404c9f481fcd8df
2021-03-30 16:39:50 -05:00

73 lines
2.4 KiB
Bash
Executable File

#!/bin/bash
set -xe
# TODO (kkalynovskyi) remove this function when zuul is able to gather debug info by itself
function vinoDebugInfo () {
kubectl get po -A
kubectl get ds -A
local pod_name
pod_name="$(kubectl get pod -n vino-system -l control-plane=controller-manager -o name)"
kubectl logs -c manager ${pod_name} -n vino-system
exit 1
}
server_label="airshipit.org/server=s1"
rack_label="airshipit.org/rack=r1"
master_copy_label="airshipit.org/k8s-role=master"
worker_copy_label="airshipit.org/k8s-role=worker"
# Label all nodes with the same rack/label. We are ok with this for this simple test.
kubectl label node --overwrite=true --all $server_label $rack_label
kubectl apply -f config/samples/vino_cr.yaml
kubectl apply -f config/samples/ippool.yaml
kubectl apply -f config/samples/network-template-secret.yaml
# Remove logs collection from here, when we will have zuul collect logs job
until [[ $(kubectl get vino vino-test-cr 2>/dev/null) ]]; do
count=$((count + 1))
if [[ ${count} -eq "30" ]]; then
echo ' Timed out waiting for vino test cr to exist'
vinoDebugInfo
return 1
fi
sleep 2
done
if ! kubectl wait --for=condition=Ready vino vino-test-cr --timeout=600s; then
vinoDebugInfo
fi
# no need to collect logs on fail, since they are already collected before
until [[ $(kubectl -n vino-system get ds default-vino-test-cr 2>/dev/null) ]]; do
count=$((count + 1))
if [[ ${count} -eq "30" ]]; then
echo ' Timed out waiting for vino builder daemonset to exist'
vinoDebugInfo
return 1
fi
sleep 2
done
if ! kubectl -n vino-system rollout status ds default-vino-test-cr --timeout=10s; then
vinoDebugInfo
fi
masterCount=$(kubectl get baremetalhosts -n vino-system -l "$server_label,$server_label,$master_copy_label" -o name | wc -l)
# with this setup set up, exactly 1 master must have been created by VINO controller
[[ "$masterCount" -eq "1" ]]
workerCount=$(kubectl get baremetalhosts -n vino-system -l "$server_label,$server_label,$worker_copy_label" -o name | wc -l)
# with this setup set up, exactly 4 workers must have been created by VINO controller
[[ "$workerCount" -eq "4" ]]
kubectl get baremetalhosts -n vino-system --show-labels=true
kubectl get -o yaml -n vino-system \
$(kubectl get secret -o name -n vino-system | grep network-data)
kubectl get secret -o yaml -n vino-system default-vino-test-cr-credentials