calico: Align IPv4 pool CIDR with k8s_master
[iec.git] / scripts / setup-cni.sh
1 #!/bin/bash
2 set -o xtrace
3 set -e
4
5 CLUSTER_IP=${1:-172.16.1.136} # Align with the value in our K8s setup script
6 POD_NETWORK_CIDR=${2:-192.168.0.0/16}
7
8 # Install the Etcd Database
9 if [ "$(uname -m)" == 'aarch64' ]; then
10   ETCD_YAML=etcd-arm64.yaml
11 else
12   ETCD_YAML=etcd-amd64.yaml
13 fi
14
15 SCRIPTS_DIR=$(dirname "${BASH_SOURCE[0]}")
16
17 sed -i "s/10.96.232.136/${CLUSTER_IP}/" "${SCRIPTS_DIR}/cni/calico/${ETCD_YAML}"
18 kubectl apply -f "${SCRIPTS_DIR}/cni/calico/${ETCD_YAML}"
19
20 # Install the RBAC Roles required for Calico
21 kubectl apply -f "${SCRIPTS_DIR}/cni/calico/rbac.yaml"
22
23 # Install Calico to system
24 sed -i "s@10.96.232.136@${CLUSTER_IP}@; s@192.168.0.0/16@${POD_NETWORK_CIDR}@" \
25   "${SCRIPTS_DIR}/cni/calico/calico.yaml"
26 kubectl apply -f "${SCRIPTS_DIR}/cni/calico/calico.yaml"
27
28 # Remove the taints on master node
29 kubectl taint nodes --all node-role.kubernetes.io/master- || true