devstack: don't assume there's a running hyperkube

In case a node is only set to run the kubelet, there's not going to be a
running hyperkube container and the hyperkube extraction will fail. It's
better to not assume and just have a cheap container run made in purpose
for extraction.

Change-Id: Iaa543825e89ae4acd2d4527f6eb4324b97874313
Closes-Bug: 1742757
Signed-off-by: Antoni Segura Puimedon <antonisp@celebdor.com>
This commit is contained in:
Antoni Segura Puimedon 2018-01-09 17:32:15 +01:00 committed by Antoni Segura Puimedon
parent e91516bfd3
commit 89f22456e4
1 changed files with 6 additions and 3 deletions

View File

@ -490,13 +490,16 @@ function extract_hyperkube {
tmp_loopback_cni_path="/tmp/loopback"
tmp_nsenter_path="/tmp/nsenter"
hyperkube_container="$(docker ps -aq \
-f ancestor="${KURYR_HYPERKUBE_IMAGE}:${KURYR_HYPERKUBE_VERSION}" | \
head -1)"
hyperkube_container=$(docker run -d \
--net host \
"${KURYR_HYPERKUBE_IMAGE}:${KURYR_HYPERKUBE_VERSION}" \
/bin/false)
docker cp "${hyperkube_container}:/hyperkube" "$tmp_hyperkube_path"
docker cp "${hyperkube_container}:/opt/cni/bin/loopback" \
"$tmp_loopback_cni_path"
docker cp "${hyperkube_container}:/usr/bin/nsenter" "$tmp_nsenter_path"
docker rm "$hyperkube_container"
sudo install -o "$STACK_USER" -m 0555 -D "$tmp_hyperkube_path" \
"$KURYR_HYPERKUBE_BINARY"
sudo install -o "$STACK_USER" -m 0555 -D "$tmp_loopback_cni_path" \