From 89f22456e4be7eee18aeeea2e21f460b89006761 Mon Sep 17 00:00:00 2001 From: Antoni Segura Puimedon Date: Tue, 9 Jan 2018 17:32:15 +0100 Subject: [PATCH] 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 --- devstack/plugin.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/devstack/plugin.sh b/devstack/plugin.sh index afdc9db55..5d572047d 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -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" \