calico: Align IPv4 pool CIDR with k8s_master 27/427/1
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Thu, 28 Feb 2019 16:32:50 +0000 (17:32 +0100)
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Thu, 28 Feb 2019 16:32:50 +0000 (17:32 +0100)
When a non-default pod-network-cidr is used for `kubeadm init`, the
same CIDR should be used by Calico in CALICO_IPV4POOL_CIDR.
Otherwise we will run into issues like those described in [1].

[1] https://github.com/projectcalico/calico/issues/683

Change-Id: Ifc5cd2847f12e85b23716d4b279fd635988132ef
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
scripts/setup-cni.sh

index 8b9730c..643f157 100755 (executable)
@@ -3,6 +3,7 @@ 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
@@ -20,7 +21,8 @@ kubectl apply -f "${SCRIPTS_DIR}/cni/calico/${ETCD_YAML}"
 kubectl apply -f "${SCRIPTS_DIR}/cni/calico/rbac.yaml"
 
 # Install Calico to system
-sed -i "s/10.96.232.136/${CLUSTER_IP}/" "${SCRIPTS_DIR}/cni/calico/calico.yaml"
+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