|
19 | 19 | set -e |
20 | 20 |
|
21 | 21 | 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 [ETCD_VERSION]" |
23 | | - 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 3.5.1" |
| 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] [ETCD_VERSION]" |
| 23 | + 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 amd64" |
24 | 24 | exit 1 |
25 | 25 | fi |
26 | 26 |
|
| 27 | +ARCH="amd64" |
| 28 | +ARCH_SUFFIX="x86_64" |
| 29 | +if [ -n "${8}" ]; then |
| 30 | + if [ "${8}" = "x86_64" ] || [ "${8}" = "amd64" ]; then |
| 31 | + ARCH="amd64" |
| 32 | + ARCH_SUFFIX="x86_64" |
| 33 | + elif [ "${8}" = "aarch64" ] || [ "${8}" = "arm64" ]; then |
| 34 | + ARCH="arm64" |
| 35 | + ARCH_SUFFIX="aarch64" |
| 36 | + else |
| 37 | + echo "ERROR: ARCH must be 'x86_64' or 'aarch64'. If the optional parameter ARCH is not set then 'x86_64' is used." |
| 38 | + exit 1 |
| 39 | + fi |
| 40 | +fi |
| 41 | + |
27 | 42 | RELEASE="v${2}" |
28 | 43 | VAL="1.18.0" |
29 | 44 | output_dir="${1}" |
30 | 45 | start_dir="$PWD" |
31 | 46 | iso_dir="/tmp/iso" |
32 | 47 | working_dir="${iso_dir}/" |
33 | 48 | mkdir -p "${working_dir}" |
34 | | -build_name="${7}.iso" |
35 | | -[ -z "${build_name}" ] && build_name="setup-${RELEASE}.iso" |
| 49 | +build_name="${7}-${ARCH_SUFFIX}.iso" |
| 50 | +[ -z "${build_name}" ] && build_name="setup-${RELEASE}-${ARCH_SUFFIX}.iso" |
36 | 51 |
|
37 | 52 | CNI_VERSION="v${3}" |
38 | 53 | echo "Downloading CNI ${CNI_VERSION}..." |
39 | 54 | cni_dir="${working_dir}/cni/" |
40 | 55 | 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") |
| 56 | +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") |
42 | 57 | 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" |
| 58 | + 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" |
44 | 59 | fi |
45 | 60 |
|
46 | 61 | CRICTL_VERSION="v${4}" |
47 | 62 | echo "Downloading CRI tools ${CRICTL_VERSION}..." |
48 | 63 | crictl_dir="${working_dir}/cri-tools/" |
49 | 64 | 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" |
| 65 | +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" |
51 | 66 |
|
52 | 67 | echo "Downloading Kubernetes tools ${RELEASE}..." |
53 | 68 | k8s_dir="${working_dir}/k8s" |
54 | 69 | mkdir -p "${k8s_dir}" |
55 | 70 | cd "${k8s_dir}" |
56 | | -curl -L --remote-name-all https://dl.k8s.io/release/${RELEASE}/bin/linux/amd64/{kubeadm,kubelet,kubectl} |
| 71 | +curl -L --remote-name-all https://dl.k8s.io/release/${RELEASE}/bin/linux/${ARCH}/{kubeadm,kubelet,kubectl} |
57 | 72 | kubeadm_file_permissions=`stat --format '%a' kubeadm` |
58 | 73 | chmod +x kubeadm |
59 | 74 |
|
@@ -148,11 +163,12 @@ chmod ${kubeadm_file_permissions} "${working_dir}/k8s/kubeadm" |
148 | 163 | echo "Updating imagePullPolicy to IfNotPresent in yaml files..." |
149 | 164 | sed -i "s/imagePullPolicy:.*/imagePullPolicy: IfNotPresent/g" ${working_dir}/*.yaml |
150 | 165 |
|
151 | | -if [ -n "${8}" ]; then |
| 166 | +# Optional parameter ETCD_VERSION |
| 167 | +if [ -n "${9}" ]; then |
152 | 168 | # Install etcd dependencies |
153 | 169 | etcd_dir="${working_dir}/etcd" |
154 | 170 | mkdir -p "${etcd_dir}" |
155 | | - ETCD_VERSION=v${8} |
| 171 | + ETCD_VERSION=v${9} |
156 | 172 | wget -q --show-progress "https://github.com/etcd-io/etcd/releases/download/${ETCD_VERSION}/etcd-${ETCD_VERSION}-linux-amd64.tar.gz" -O ${etcd_dir}/etcd-linux-amd64.tar.gz |
157 | 173 | fi |
158 | 174 |
|
|
0 commit comments