Add architecture check when downloading helm and kubectl
There is an issue that setup-kubectl.sh and setup-helm.sh can only download helm and kubectl for X86_64, but it cannot handle other architectrues like arm64 or ppc64le. This patch detects architecture and make the script architecture-aware, so the script can download proper helm and kubectl for the corresponding arm64 and ppc64le architectures, in addition to X86_64. Closes-Bug: #1738743 Change-Id: I58a39268040797fdb3e39b9ff10b2cd7e0822386 Signed-off-by: Kevin Zhao <kevin.zhao@arm.com>
This commit is contained in:
parent
12f79c88fd
commit
addf5f3401
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
function is_arch {
|
||||
[[ "$(uname -m)" == "$1" ]]
|
||||
}
|
||||
|
||||
if is_arch "x86_64"; then
|
||||
ARCH="amd64"
|
||||
elif is_arch "aarch64"; then
|
||||
ARCH="arm64"
|
||||
elif is_arch "ppc64le"; then
|
||||
ARCH="ppc64le"
|
||||
else
|
||||
ARCH=$(uname -m)
|
||||
exit "Kolla Kubernetes unsupported architecture $ARCH"
|
||||
fi
|
|
@ -1,4 +1,4 @@
|
|||
HELM_VERSION="2.4.2"
|
||||
HELM_TEMPLATE_URL="https://github.com/technosophos/helm-template/releases/download/2.2.2%2B1/helm-template-linux-2.2.2.1.tgz"
|
||||
|
||||
HELM_URL="http://storage.googleapis.com/kubernetes-helm/helm-v$HELM_VERSION-linux-amd64.tar.gz"
|
||||
HELM_URL="http://storage.googleapis.com/kubernetes-helm/helm-v$HELM_VERSION-linux-${ARCH}.tar.gz"
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
# https://gist.github.com/FrankDeGroot/8cbec84eabfebcf2f2e7
|
||||
|
||||
echo "Finding latest kubectl"
|
||||
# Returns $ARCH, which can be amd64, arm64 and ppc64le
|
||||
. tools/get_arch.sh
|
||||
# curl -s https://github.com/kubernetes/kubernetes/releases/latest | awk -F '[<>]' '/.*/ { match($0, "tag/([^\"]+)",a); print a[1] }'
|
||||
LATEST=$(wget -qO- https://github.com/kubernetes/kubernetes/releases/latest | awk -F '[<>]' '/href="\/kubernetes\/kubernetes\/tree\/.*"/ { match($0, "tree/([^\"]+)",a); print a[1] }' | head -1)
|
||||
|
||||
echo "Getting kubectl-$LATEST"
|
||||
sudo wget -NP /usr/bin http://storage.googleapis.com/kubernetes-release/release/$LATEST/bin/linux/amd64/kubectl
|
||||
sudo wget -NP /usr/bin http://storage.googleapis.com/kubernetes-release/release/$LATEST/bin/linux/$ARCH/kubectl
|
||||
sudo chmod 755 /usr/bin/kubectl
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/" && pwd )"
|
||||
|
||||
. tools/helm_versions.sh
|
||||
# Returns $ARCH, which can be amd64, arm64 and ppc64le
|
||||
. tools/get_arch.sh
|
||||
. tools/helm_versions.sh
|
||||
|
||||
curl "$HELM_URL" | sudo tar --strip-components 1 -C /usr/bin linux-amd64/helm -zxf -
|
||||
curl "$HELM_URL" | sudo tar --strip-components 1 -C /usr/bin linux-$ARCH/helm -zxf -
|
||||
if [ ! -e ~/.kube/config ]; then
|
||||
mkdir -p ~/.kube
|
||||
sudo cat /etc/kubernetes/kubelet.conf > ~/.kube/config
|
||||
|
|
|
@ -9,12 +9,13 @@ grep orchestration_engine etc/kolla/globals.yml || echo orchestration_engine: KU
|
|||
#sudo yum install -y golang-bin || sudo apt-get install -y golang
|
||||
#tools/build_helm_templates.sh
|
||||
set -x
|
||||
. tools/get_arch.sh
|
||||
. tools/helm_versions.sh
|
||||
mkdir -p ~/.helm/plugins/template
|
||||
curl -L -o /tmp/helm-template.tar.gz "$HELM_TEMPLATE_URL"
|
||||
curl -L -o /tmp/helm.tar.gz "$HELM_URL"
|
||||
mkdir -p ~/bin
|
||||
tar --strip-components 1 -C ~/bin linux-amd64/helm -zxf /tmp/helm.tar.gz
|
||||
tar --strip-components 1 -C ~/bin linux-$ARCH/helm -zxf /tmp/helm.tar.gz
|
||||
tar -C ~/.helm/plugins/template/ -zxf /tmp/helm-template.tar.gz
|
||||
export PATH=$PATH:~/bin
|
||||
export HOME=$(cd ~; pwd)
|
||||
|
|
Loading…
Reference in New Issue