2 # shellcheck disable=SC1073,SC1072,SC1039,SC2059,SC2046
6 if [ -f "$HOME/.bashrc" ]; then
7 # shellcheck source=/dev/null
13 POD_NETWORK_CIDR=${2:-192.168.0.0/16}
14 K8S_MASTER_IP=${3:-10.169.41.173}
15 SERVICE_CIDR=${4:-172.16.1.0/24}
16 CLUSTER_IP=${5:-172.16.1.136} # Align with the value in our K8s setup script
19 SCRIPTS_DIR=$(dirname "${BASH_SOURCE[0]}")
22 # Install the Etcd Database
25 sed -i "s/10.96.232.136/${CLUSTER_IP}/" "${SCRIPTS_DIR}/cni/calico/${ETCD_YAML}"
26 kubectl apply -f "${SCRIPTS_DIR}/cni/calico/${ETCD_YAML}"
28 # Install the RBAC Roles required for Calico
29 kubectl apply -f "${SCRIPTS_DIR}/cni/calico/rbac.yaml"
31 # Install Calico to system
32 sed -i "s@10.96.232.136@${CLUSTER_IP}@; s@192.168.0.0/16@${POD_NETWORK_CIDR}@" \
33 "${SCRIPTS_DIR}/cni/calico/calico.yaml"
34 kubectl apply -f "${SCRIPTS_DIR}/cni/calico/calico.yaml"
38 # Install the flannel CNI
39 sed -i "s@10.244.0.0/16@${POD_NETWORK_CIDR}@" "${SCRIPTS_DIR}/cni/flannel/kube-flannel.yml"
40 kubectl apply -f "${SCRIPTS_DIR}/cni/flannel/kube-flannel.yml"
44 # Update vpp config file
45 ${SCRIPTS_DIR}/cni/contivpp/contiv-update-config.sh $DEV_NAME
47 # Install contivpp CNI
48 sed -i "s@10.1.0.0/16@${POD_NETWORK_CIDR}@" "${SCRIPTS_DIR}/cni/contivpp/contiv-vpp.yaml"
49 kubectl apply -f "${SCRIPTS_DIR}/cni/contivpp/contiv-vpp.yaml"
52 install_ovn_kubernetes(){
53 # Update the ovn-kubernetes yaml files
55 net_cidr_repl="{{ net_cidr }}"
56 svc_cidr_repl="{{ svc_cidr }}"
57 k8s_apiserver_repl="{{ k8s_apiserver }}"
58 mtu_repl="{{ mtu_value }}"
60 k8s_apiserver="https://${K8S_MASTER_IP}:6443"
61 net_cidr="${POD_NETWORK_CIDR}"
62 svc_cidr="${SERVICE_CIDR}"
65 echo "net_cidr: ${net_cidr}"
66 echo "svc_cidr: ${svc_cidr}"
67 echo "k8s_apiserver: ${k8s_apiserver}"
68 echo "mtu: ${mtu_def_value}"
70 sed "s,${net_cidr_repl},${net_cidr},
71 s,${svc_cidr_repl},${svc_cidr},
72 s,${k8s_apiserver_repl},${k8s_apiserver},
73 s,${mtu_repl},${mtu_def_value}," \
74 ${SCRIPTS_DIR}/cni/ovn-kubernetes/templates/ovn-setup.yaml.j2 > \
75 ${SCRIPTS_DIR}/cni/ovn-kubernetes/yaml/ovn-setup.yaml
77 # Install ovn-kubernetes by yaml files
78 # shellcheck source=/dev/null
79 source ${SCRIPTS_DIR}/cni/ovn-kubernetes/install-ovn-k8s.sh
83 install_multus_sriov_flannel(){
85 sed -i "s@10.244.0.0/16@${POD_NETWORK_CIDR}@" "${SCRIPTS_DIR}/cni/multus/multus-sriov-flannel/flannel-daemonset.yml"
86 # Install Multus Flannel+SRIOV by yaml files
87 # shellcheck source=/dev/null
88 source ${SCRIPTS_DIR}/cni/multus/multus-sriov-flannel/install.sh
92 install_multus_sriov_calico(){
94 sed -i "s@10.244.0.0/16@${POD_NETWORK_CIDR}@" \
95 "${SCRIPTS_DIR}/cni/multus/multus-sriov-calico/calico-daemonset.yaml"
96 # Install Multus Calico+SRIOV by yaml files
97 # shellcheck source=/dev/null
98 source ${SCRIPTS_DIR}/cni/multus/multus-sriov-calico/install.sh
103 ${SCRIPTS_DIR}/cni/danm/danm_install.sh
105 # Deploying DANM suite into K8s cluster
106 kubectl create -f ${SCRIPTS_DIR}/cni/danm/integration/crds/lightweight/
108 # Create the netwatcher DaemonSet
109 kubectl create -f ${SCRIPTS_DIR}/cni/danm/integration/manifests/netwatcher/
111 #flannel as bootstrap networking solution
117 ${SCRIPTS_DIR}/cni/cilium/cilium_install.sh
119 # Deploying cilium CNI
120 kubectl create -f ${SCRIPTS_DIR}/cni/cilium/quick-install.yaml
123 # Remove the taints on master node
124 # Taint master before installing the CNI for the case that there is
125 # only one master node
126 kubectl taint nodes --all node-role.kubernetes.io/master- || true
130 echo "Install calico ..."
134 echo "Install flannel ..."
138 echo "Install Contiv-VPP ..."
142 echo "Install Ovn-Kubernetes ..."
143 install_ovn_kubernetes
145 'multus-flannel-sriov')
146 echo "Install Flannel with SRIOV CNI by Multus-CNI ..."
147 install_multus_sriov_flannel
149 'multus-calico-sriov')
150 echo "Install Calico with SRIOV CNI by Multus-CNI ..."
151 install_multus_sriov_calico
154 echo "Install danm ..."
158 echo "Install cilium ..."
162 echo "${CNI_TYPE} is not supported"