From 1b1e9eb5e8d54604cee68e6c73d9b8488b404b0e Mon Sep 17 00:00:00 2001 From: Ilya Chukhnakov Date: Mon, 5 Dec 2016 20:58:20 +0300 Subject: [PATCH] devstack: add nsenter and fix setup-files race This patch installs 'nsenter' as part of 'hyperkube' installation and introduces a workaround for a race between 'setup-files.sh' and 'kubernetes-api' service. Change-Id: Ic7fc7adbc27671b716f5be18529053790b6bd049 --- devstack/plugin.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 3487006b1..5998c838d 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -202,6 +202,11 @@ function prepare_kubernetes_files { "${KURYR_HYPERKUBE_IMAGE}:${KURYR_HYPERKUBE_VERSION}" \ /setup-files.sh \ "IP:${HOST_IP},DNS:kubernetes,DNS:kubernetes.default,DNS:kubernetes.default.svc,DNS:kubernetes.default.svc.cluster.local" + + # FIXME(ivc): replace 'sleep' with a strict check (e.g. wait_for_files) + # 'kubernetes-api' fails if started before files are generated. + # this is a workaround to prevent races. + sleep 5 } function wait_for { @@ -281,6 +286,7 @@ function extract_hyperkube { tmp_hyperkube_path="/tmp/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}" | \ @@ -288,10 +294,13 @@ function extract_hyperkube { 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" 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" \ "${CNI_BIN_DIR}/loopback" + sudo install -o "root" -m 0555 -D "$tmp_nsenter_path" \ + "/usr/local/bin/nsenter" # Convenience kubectl executable for development sudo install -o "$STACK_USER" -m 555 -D "${KURYR_HOME}/devstack/kubectl" \