Sync bootstrap scripts from Akraino IEC wiki
[iec.git] / scripts / cni / calico / calico.sh
1 #!/bin/bash -ex
2
3 CLUSTER_IP=${1:-172.16.1.136} # Align with the value in our K8s setup script
4 CALICO_URI_ROOT=https://docs.projectcalico.org/v3.3/getting-started/kubernetes/installation
5
6 # Install the Etcd Database
7 if [ "$(uname -m)" == 'aarch64' ]; then
8   ETCD_YAML=https://raw.githubusercontent.com/Jingzhao123/arm64TemporaryCalico/temporay_arm64/v3.3/getting-started/kubernetes/installation/hosted/etcd-arm64.yaml
9 else
10   ETCD_YAML=${CALICO_URI_ROOT}/hosted/etcd.yaml
11 fi
12 wget -O etcd.yaml "${ETCD_YAML}"
13 sed -i "s/10.96.232.136/${CLUSTER_IP}/" etcd.yaml
14 kubectl apply -f etcd.yaml
15
16 # Install the RBAC Roles required for Calico
17 kubectl apply -f "${CALICO_URI_ROOT}/rbac.yaml"
18
19 # Install Calico to system
20 wget -O calico.yaml "${CALICO_URI_ROOT}/hosted/calico.yaml"
21 sed -i "s/10.96.232.136/${CLUSTER_IP}/" calico.yaml
22 if [ "$(uname -m)" == 'aarch64' ]; then
23   sed -i "s/quay.io\/calico/calico/" calico.yaml
24 fi
25 # FIXME: IP_AUTODETECTION_METHOD?
26 kubectl apply -f calico.yaml
27
28 # Remove the taints on master node
29 kubectl taint nodes --all node-role.kubernetes.io/master- || true