Add support for running kuryr with ocata devstack.

The signature for run_process is different between older and newer versions of
devstack. This patch works around those issues by calling sudo directly.

However, sudo cannot be called in systemd so we use the new signature when
IS_SYSTEMD is True and sudo in all other instances.

Ocata:  run_process service "command-line" [group]
Master: run_process service "command-line" [group] [user]

Change-Id: Ia2ca599fe1dc5df945425b27dc5ac70c93f47f8e
Closes-Bug: 1693323
This commit is contained in:
Frederick F. Kautz IV 2017-05-24 11:43:21 -07:00
parent 87039c64ea
commit 20bdaa81d0
1 changed files with 25 additions and 4 deletions

View File

@ -327,9 +327,21 @@ function prepare_docker {
function run_docker {
local dockerd_bin=$(which dockerd)
run_process docker \
"$dockerd_bin --debug=true \
-H unix://$KURYR_DOCKER_ENGINE_SOCKET_FILE" "" "root"
if [[ "$USE_SYSTEMD" = "True" ]]; then
# If systemd is being used, proceed as normal
run_process docker \
"$dockerd_bin --debug=true \
-H unix://$KURYR_DOCKER_ENGINE_SOCKET_FILE" "root" "root"
else
# If screen is being used, there is a possibility that the devstack
# environment is on a stable branch. Older versions of run_process have
# a different signature. Sudo is used as a workaround that works in
# both older and newer versions of devstack.
run_process docker \
"sudo $dockerd_bin --debug=true \
-H unix://$KURYR_DOCKER_ENGINE_SOCKET_FILE"
fi
# We put the stack user as owner of the socket so we do not need to
# run the Docker commands with sudo when developing.
@ -537,7 +549,16 @@ function run_k8s_kubelet {
--cert-dir=${KURYR_HYPERKUBE_DATA_DIR}/kubelet.cert \
--root-dir=${KURYR_HYPERKUBE_DATA_DIR}/kubelet"
wait_for "Kubernetes API Server" "$KURYR_K8S_API_URL"
run_process kubelet "$command" "" "root"
if [[ "$USE_SYSTEMD" = "True" ]]; then
# If systemd is being used, proceed as normal
run_process kubelet "$command" root root
else
# If screen is being used, there is a possibility that the devstack
# environment is on a stable branch. Older versions of run_process have
# a different signature. Sudo is used as a workaround that works in
# both older and newer versions of devstack.
run_process kubelet "sudo $command"
fi
}
function run_kuryr_kubernetes {