X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=src%2Ffoundation%2Fscripts%2Fsetup-cni.sh;fp=src%2Ffoundation%2Fscripts%2Fsetup-cni.sh;h=643f157cbcaf724f5e2f7d79f3bea3e63c9129a0;hb=38539411e0db414bd281be6313e080cbff7bab13;hp=0000000000000000000000000000000000000000;hpb=213fe20e6996b570081a86926ceafe4240ca983f;p=iec.git diff --git a/src/foundation/scripts/setup-cni.sh b/src/foundation/scripts/setup-cni.sh new file mode 100755 index 0000000..643f157 --- /dev/null +++ b/src/foundation/scripts/setup-cni.sh @@ -0,0 +1,29 @@ +#!/bin/bash +set -o xtrace +set -e + +CLUSTER_IP=${1:-172.16.1.136} # Align with the value in our K8s setup script +POD_NETWORK_CIDR=${2:-192.168.0.0/16} + +# Install the Etcd Database +if [ "$(uname -m)" == 'aarch64' ]; then + ETCD_YAML=etcd-arm64.yaml +else + ETCD_YAML=etcd-amd64.yaml +fi + +SCRIPTS_DIR=$(dirname "${BASH_SOURCE[0]}") + +sed -i "s/10.96.232.136/${CLUSTER_IP}/" "${SCRIPTS_DIR}/cni/calico/${ETCD_YAML}" +kubectl apply -f "${SCRIPTS_DIR}/cni/calico/${ETCD_YAML}" + +# Install the RBAC Roles required for Calico +kubectl apply -f "${SCRIPTS_DIR}/cni/calico/rbac.yaml" + +# Install Calico to system +sed -i "s@10.96.232.136@${CLUSTER_IP}@; s@192.168.0.0/16@${POD_NETWORK_CIDR}@" \ + "${SCRIPTS_DIR}/cni/calico/calico.yaml" +kubectl apply -f "${SCRIPTS_DIR}/cni/calico/calico.yaml" + +# Remove the taints on master node +kubectl taint nodes --all node-role.kubernetes.io/master- || true