5 if [ -f "$HOME/.bashrc" ]; then
6 # shellcheck source=/dev/null
12 POD_NETWORK_CIDR=${2:-192.168.0.0/16}
13 CLUSTER_IP=${3:-172.16.1.136} # Align with the value in our K8s setup script
14 K8S_MASTER_IP=${4:-10.169.41.173}
15 SERVICE_CIDR=${5:-172.16.1.0/24}
18 SCRIPTS_DIR=$(dirname "${BASH_SOURCE[0]}")
21 # Install the Etcd Database
24 sed -i "s/10.96.232.136/${CLUSTER_IP}/" "${SCRIPTS_DIR}/cni/calico/${ETCD_YAML}"
25 kubectl apply -f "${SCRIPTS_DIR}/cni/calico/${ETCD_YAML}"
27 # Install the RBAC Roles required for Calico
28 kubectl apply -f "${SCRIPTS_DIR}/cni/calico/rbac.yaml"
30 # Install Calico to system
31 sed -i "s@10.96.232.136@${CLUSTER_IP}@; s@192.168.0.0/16@${POD_NETWORK_CIDR}@" \
32 "${SCRIPTS_DIR}/cni/calico/calico.yaml"
33 kubectl apply -f "${SCRIPTS_DIR}/cni/calico/calico.yaml"
37 # Install the flannel CNI
38 sed -i "s@10.244.0.0/16@${POD_NETWORK_CIDR}@" "${SCRIPTS_DIR}/cni/flannel/kube-flannel.yml"
39 kubectl apply -f "${SCRIPTS_DIR}/cni/flannel/kube-flannel.yml"
43 # Update vpp config file
44 ${SCRIPTS_DIR}/cni/contivpp/contiv-update-config.sh $DEV_NAME
46 # Install contivpp CNI
47 sed -i "s@10.1.0.0/16@${POD_NETWORK_CIDR}@" "${SCRIPTS_DIR}/cni/contivpp/contiv-vpp.yaml"
48 kubectl apply -f "${SCRIPTS_DIR}/cni/contivpp/contiv-vpp.yaml"
51 install_ovn_kubernetes(){
52 # Update the ovn-kubernetes yaml files
54 net_cidr_repl="{{ net_cidr | default('10.128.0.0/14/23') }}"
55 svc_cidr_repl="{{ svc_cidr | default('172.30.0.0/16') }}"
56 k8s_apiserver_repl="{{ k8s_apiserver.stdout }}"
58 k8s_apiserver="https://${K8S_MASTER_IP}:6443"
59 net_cidr="${POD_NETWORK_CIDR}"
60 svc_cidr="${SERVICE_CIDR}"
62 echo "net_cidr: ${net_cidr}"
63 echo "svc_cidr: ${svc_cidr}"
64 echo "k8s_apiserver: ${k8s_apiserver}"
66 sed "s,${net_cidr_repl},${net_cidr},
67 s,${svc_cidr_repl},${svc_cidr},
68 s,${k8s_apiserver_repl},${k8s_apiserver}," \
69 ${SCRIPTS_DIR}/cni/ovn-kubernetes/templates/ovn-setup.yaml.j2 > \
70 ${SCRIPTS_DIR}/cni/ovn-kubernetes/yaml/ovn-setup.yaml
72 # Install ovn-kubernetes by yaml files
73 # shellcheck source=/dev/null
74 source ${SCRIPTS_DIR}/cni/ovn-kubernetes/install-ovn-k8s.sh
78 install_multus_sriov_flannel(){
80 sed -i "s@10.244.0.0/16@${POD_NETWORK_CIDR}@" "${SCRIPTS_DIR}/cni/multus/multus-sriov-flannel/flannel-daemonset.yml"
81 # Install Multus Flannel+SRIOV by yaml files
82 # shellcheck source=/dev/null
83 source ${SCRIPTS_DIR}/cni/multus/multus-sriov-flannel/install.sh
87 install_multus_sriov_calico(){
89 sed -i "s@10.244.0.0/16@${POD_NETWORK_CIDR}@" \
90 "${SCRIPTS_DIR}/cni/multus/multus-sriov-calico/calico-daemonset.yaml"
91 # Install Multus Calico+SRIOV by yaml files
92 # shellcheck source=/dev/null
93 source ${SCRIPTS_DIR}/cni/multus/multus-sriov-calico/install.sh
98 ${SCRIPTS_DIR}/cni/danm/danm_install.sh
100 # Deploying DANM suite into K8s cluster
101 kubectl create -f ${SCRIPTS_DIR}/cni/danm/integration/crds/lightweight/
103 # Create the netwatcher DaemonSet
104 kubectl create -f ${SCRIPTS_DIR}/cni/danm/integration/manifests/netwatcher/
106 #flannel as bootstrap networking solution
111 ${SCRIPTS_DIR}/cni/cilium/cilium_install.sh
113 # Deploying cilium CNI
114 kubectl create -f ${SCRIPTS_DIR}/cni/cilium/quick-install.yaml
118 echo "Install calico ..."
122 echo "Install flannel ..."
126 echo "Install Contiv-VPP ..."
130 echo "Install Ovn-Kubernetes ..."
131 install_ovn_kubernetes
133 'multus-flannel-sriov')
134 echo "Install Flannel with SRIOV CNI by Multus-CNI ..."
135 install_multus_sriov_flannel
137 'multus-calico-sriov')
138 echo "Install Calico with SRIOV CNI by Multus-CNI ..."
139 install_multus_sriov_calico
142 echo "Install danm ..."
146 echo "Install cilium ..."
150 echo "${CNI_TYPE} is not supported"
155 # Remove the taints on master node
156 kubectl taint nodes --all node-role.kubernetes.io/master- || true