Skip to content

Commit d8d4f82

Browse files
committed
[CKS] Create Kubernetes ISO support for ARCH optional parameter
1 parent 41b4f0a commit d8d4f82

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

scripts/util/create-kubernetes-binaries-iso.sh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
set -e
2020

2121
if [ $# -lt 6 ]; then
22-
echo "Invalid input. Valid usage: ./create-kubernetes-binaries-iso.sh OUTPUT_PATH KUBERNETES_VERSION CNI_VERSION CRICTL_VERSION WEAVENET_NETWORK_YAML_CONFIG DASHBOARD_YAML_CONFIG BUILD_NAME"
22+
echo "Invalid input. Valid usage: ./create-kubernetes-binaries-iso.sh OUTPUT_PATH KUBERNETES_VERSION CNI_VERSION CRICTL_VERSION WEAVENET_NETWORK_YAML_CONFIG DASHBOARD_YAML_CONFIG BUILD_NAME [ARCH]"
2323
echo "eg: ./create-kubernetes-binaries-iso.sh ./ 1.11.4 0.7.1 1.11.1 https://github.com/weaveworks/weave/releases/download/latest_release/weave-daemonset-k8s-1.11.yaml https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.0/src/deploy/recommended/kubernetes-dashboard.yaml setup-v1.11.4"
2424
exit 1
2525
fi
@@ -34,26 +34,35 @@ mkdir -p "${working_dir}"
3434
build_name="${7}.iso"
3535
[ -z "${build_name}" ] && build_name="setup-${RELEASE}.iso"
3636

37+
ARCH="amd64"
38+
if [ -n "${8}" ]; then
39+
ARCH="${8}"
40+
if [ "$ARCH" != "amd64" ] && [ "$ARCH" != "arm64" ]; then
41+
echo "ERROR: ARCH must be 'amd64' or 'arm64'. If the optional parameter ARCH is not set then 'amd64' is used."
42+
exit 1
43+
fi
44+
fi
45+
3746
CNI_VERSION="v${3}"
3847
echo "Downloading CNI ${CNI_VERSION}..."
3948
cni_dir="${working_dir}/cni/"
4049
mkdir -p "${cni_dir}"
41-
cni_status_code=$(curl -L --write-out "%{http_code}\n" "https://github.com/containernetworking/plugins/releases/download/${CNI_VERSION}/cni-plugins-linux-amd64-${CNI_VERSION}.tgz" -o "${cni_dir}/cni-plugins-amd64.tgz")
50+
cni_status_code=$(curl -L --write-out "%{http_code}\n" "https://github.com/containernetworking/plugins/releases/download/${CNI_VERSION}/cni-plugins-linux-${ARCH}-${CNI_VERSION}.tgz" -o "${cni_dir}/cni-plugins-${ARCH}.tgz")
4251
if [[ ${cni_status_code} -eq 404 ]] ; then
43-
curl -L --write-out "%{http_code}\n" "https://github.com/containernetworking/plugins/releases/download/${CNI_VERSION}/cni-plugins-amd64-${CNI_VERSION}.tgz" -o "${cni_dir}/cni-plugins-amd64.tgz"
52+
curl -L --write-out "%{http_code}\n" "https://github.com/containernetworking/plugins/releases/download/${CNI_VERSION}/cni-plugins-${ARCH}-${CNI_VERSION}.tgz" -o "${cni_dir}/cni-plugins-${ARCH}.tgz"
4453
fi
4554

4655
CRICTL_VERSION="v${4}"
4756
echo "Downloading CRI tools ${CRICTL_VERSION}..."
4857
crictl_dir="${working_dir}/cri-tools/"
4958
mkdir -p "${crictl_dir}"
50-
curl -L "https://github.com/kubernetes-incubator/cri-tools/releases/download/${CRICTL_VERSION}/crictl-${CRICTL_VERSION}-linux-amd64.tar.gz" -o "${crictl_dir}/crictl-linux-amd64.tar.gz"
59+
curl -L "https://github.com/kubernetes-incubator/cri-tools/releases/download/${CRICTL_VERSION}/crictl-${CRICTL_VERSION}-linux-${ARCH}.tar.gz" -o "${crictl_dir}/crictl-linux-${ARCH}.tar.gz"
5160

5261
echo "Downloading Kubernetes tools ${RELEASE}..."
5362
k8s_dir="${working_dir}/k8s"
5463
mkdir -p "${k8s_dir}"
5564
cd "${k8s_dir}"
56-
curl -L --remote-name-all https://dl.k8s.io/release/${RELEASE}/bin/linux/amd64/{kubeadm,kubelet,kubectl}
65+
curl -L --remote-name-all https://dl.k8s.io/release/${RELEASE}/bin/linux/${ARCH}/{kubeadm,kubelet,kubectl}
5766
kubeadm_file_permissions=`stat --format '%a' kubeadm`
5867
chmod +x kubeadm
5968

0 commit comments

Comments
 (0)