Reproduces issue #2836, i.e.: - during initialisation: ``` $ ps auxf [...] root 1380 0.4 1.6 879660 60732 ? Ssl Mar13 5:54 /usr/bin/docker daemon -H fd:// -H unix:/// root 1664 0.0 0.4 502116 18540 ? Ssl Mar13 0:06 \_ docker-containerd -l /var/run/docker/li root 12615 0.0 0.1 200496 5424 ? Sl 14:38 0:00 \_ docker-containerd-shim c5637e5bbdcb root 12629 6.2 1.6 296400 62312 ? Ssl 14:38 0:00 | \_ /home/weave/weaver --port=6783 root 12910 0.0 0.0 1524 68 ? S 14:38 0:00 | \_ /bin/sh /home/weave/launch. root 13002 0.0 0.0 1772 1232 ? S 14:38 0:00 | \_ /bin/sh /home/weave/wea root 13027 0.0 0.0 1772 320 ? S 14:38 0:00 | \_ /bin/sh /home/weave root 13028 0.0 0.0 14656 2708 ? S 14:38 0:00 | \_ curl -o /tmp/we [...] ``` - after initialisation: ``` $ ps auxf [...] root 1380 0.4 1.6 879660 60732 ? Ssl Mar13 5:54 /usr/bin/docker daemon -H fd:// -H unix:/// root 1664 0.0 0.4 502116 18540 ? Ssl Mar13 0:06 \_ docker-containerd -l /var/run/docker/li root 12615 0.0 0.1 200496 5424 ? Sl 14:38 0:00 \_ docker-containerd-shim c5637e5bbdcb root 12629 3.5 1.6 297460 63340 ? Ssl 14:38 0:00 | \_ /home/weave/weaver --port=6783 root 12910 0.0 0.0 0 0 ? Z 14:38 0:00 | \_ [launch.sh] <defunct> [...] ``` Sample output: ``` test #5 "run_on mct-0.us-central1-a.weave-net ps aux | grep -c '[d]efunct'" failed: expected "0" got "1" test #6 "run_on mct-1.us-central1-a.weave-net ps aux | grep -c '[d]efunct'" failed: expected "0" got "1" test #7 "run_on mct-2.us-central1-a.weave-net ps aux | grep -c '[d]efunct'" failed: expected "0" got "1" 3 of 8 tests failed in 62.012s. ```
80 lines
2.7 KiB
Bash
Executable File
80 lines
2.7 KiB
Bash
Executable File
#! /bin/bash
|
|
|
|
. "$(dirname "$0")/config.sh"
|
|
|
|
tear_down_kubeadm() {
|
|
for host in $HOSTS; do
|
|
# If we don't stop kubelet, it will restart all the containers we're trying to kill
|
|
run_on $host "sudo systemctl stop kubelet"
|
|
rm_containers $host $(docker_on $host ps -aq)
|
|
run_on $host "test ! -d /var/lib/kubelet || sudo find /var/lib/kubelet -execdir findmnt -n -t tmpfs -o TARGET -T {} \; | uniq | xargs -r sudo umount"
|
|
run_on $host "sudo rm -r -f /etc/kubernetes /var/lib/kubelet /var/lib/etcd /etc/cni /opt/cni/bin/*weave*"
|
|
done
|
|
}
|
|
|
|
start_suite "Test weave-kube image with Kubernetes"
|
|
|
|
TOKEN=112233.445566778899000
|
|
HOST1IP=$($SSH $HOST1 "getent hosts $HOST1 | cut -f 1 -d ' '")
|
|
SUCCESS="6 established"
|
|
|
|
tear_down_kubeadm
|
|
|
|
run_on $HOST1 "sudo systemctl start kubelet && sudo kubeadm init --token=$TOKEN"
|
|
run_on $HOST2 "sudo systemctl start kubelet && sudo kubeadm join --token=$TOKEN $HOST1IP"
|
|
run_on $HOST3 "sudo systemctl start kubelet && sudo kubeadm join --token=$TOKEN $HOST1IP"
|
|
|
|
[ -n "$COVERAGE" ] && COVERAGE_ARGS="\\n env:\\n - name: EXTRA_ARGS\\n value: \"-test.coverprofile=/home/weave/cover.prof --\""
|
|
|
|
sed -e "s%imagePullPolicy: Always%imagePullPolicy: Never$COVERAGE_ARGS%" "$(dirname "$0")/../prog/weave-kube/weave-daemonset.yaml" | run_on $HOST1 "kubectl apply -f -"
|
|
|
|
sleep 5
|
|
|
|
wait_for_connections() {
|
|
for i in $(seq 1 45); do
|
|
if run_on $HOST1 "curl -sS http://127.0.0.1:6784/status | grep \"$SUCCESS\"" ; then
|
|
return
|
|
fi
|
|
echo "Waiting for connections"
|
|
sleep 1
|
|
done
|
|
echo "Timed out waiting for connections to establish" >&2
|
|
exit 1
|
|
}
|
|
|
|
assert_raises wait_for_connections
|
|
|
|
# Check we can ping between the Weave bridg IPs on each host
|
|
HOST1EXPIP=$($SSH $HOST1 "weave expose")
|
|
HOST2EXPIP=$($SSH $HOST2 "weave expose")
|
|
HOST3EXPIP=$($SSH $HOST3 "weave expose")
|
|
assert_raises "run_on $HOST1 $PING $HOST2EXPIP"
|
|
assert_raises "run_on $HOST2 $PING $HOST1EXPIP"
|
|
assert_raises "run_on $HOST3 $PING $HOST2EXPIP"
|
|
|
|
# Ensure we do not generate any defunct process (e.g. launch.sh) after starting weaver:
|
|
assert "run_on $HOST1 ps aux | grep -c '[d]efunct'" "0"
|
|
assert "run_on $HOST2 ps aux | grep -c '[d]efunct'" "0"
|
|
assert "run_on $HOST3 ps aux | grep -c '[d]efunct'" "0"
|
|
|
|
# See if we can get some pods running that connect to the network
|
|
run_on $HOST1 "kubectl run hello --image=weaveworks/hello-world --replicas=3"
|
|
|
|
wait_for_pods() {
|
|
for i in $(seq 1 45); do
|
|
if run_on $HOST1 "kubectl get pods | grep 'hello.*Running'" ; then
|
|
return
|
|
fi
|
|
echo "Waiting for pods"
|
|
sleep 1
|
|
done
|
|
echo "Timed out waiting for pods" >&2
|
|
exit 1
|
|
}
|
|
|
|
assert_raises wait_for_pods
|
|
|
|
tear_down_kubeadm
|
|
|
|
end_suite
|