From 1793251293b5abe391f1426a693d10c6c29c54fb Mon Sep 17 00:00:00 2001 From: Michal Nasiadka Date: Wed, 6 Sep 2023 06:32:01 +0200 Subject: [PATCH] devstack: Install sonobuoy and kubectl Change-Id: I26aa7e7065913be987bc5b298809c918977ba753 --- devstack/lib/magnum | 13 +++++++++++++ devstack/plugin.sh | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/devstack/lib/magnum b/devstack/lib/magnum index ba090e81d8..81d375cc10 100644 --- a/devstack/lib/magnum +++ b/devstack/lib/magnum @@ -348,6 +348,19 @@ function install_magnum { setup_develop $MAGNUM_DIR } +# install_sonobuoy() - Download and extract sonobuoy +function install_sonobuoy { + MAGNUM_SONOBUOY_TAG=${MAGNUM_SONOBUOY_TAG:-$(wget -qO- https://api.github.com/repos/vmware-tanzu/sonobuoy/releases/latest | grep tag_name | awk '{ print $2}' | tr -d \",)} + wget -t 2 -c -qO- https://github.com/vmware-tanzu/sonobuoy/releases/download/$MAGNUM_SONOBUOY_TAG/sonobuoy_${MAGNUM_SONOBUOY_TAG:1}_linux_amd64.tar.gz | sudo tar -zxf - -C /opt/stack/bin sonobuoy +} + +# install_kubectl() - Download and extract kubectl +function install_kubectl { + MAGNUM_KUBECTL_TAG=${MAGNUM_KUBECTL_TAG:-$(wget -qO- https://dl.k8s.io/release/stable.txt)} + sudo wget -t 2 -c -q -O /opt/stack/bin/kubectl https://dl.k8s.io/release/${MAGNUM_KUBECTL_TAG}/bin/linux/amd64/kubectl + sudo chmod +x /opt/stack/bin/kubectl +} + # start_magnum_api() - Start the API process ahead of other things function start_magnum_api { run_process magnum-api "$(which uwsgi) --procname-prefix magnum-api --ini $MAGNUM_UWSGI_CONF" diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 81622f3abe..af6c151130 100755 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -31,6 +31,10 @@ if is_service_enabled magnum-api magnum-cond; then create_magnum_accounts fi + # Install kubectl and sonobuoy + install_kubectl + install_sonobuoy + elif [[ "$1" == "stack" && "$2" == "extra" ]]; then # Initialize magnum init_magnum