From 68ab08ca0ae5314ea3f1e1937d1186903d537878 Mon Sep 17 00:00:00 2001 From: Yuvaraja Mariappan Date: Thu, 9 Aug 2018 19:09:08 -0700 Subject: [PATCH] Route added for pod_cidr to handle k8s probe in multi interface nodes In mulitple interfaces nodes, kubelet may use mgmt interface and vrouter may use the control data interface. If the default gw is mgmt, kubelet probes wont go via vrouter. Added route for pod_cidr to go via vhost0. Change-Id: If74f7bfbc7cb3d03f43a7bd5003a5f85ba513c8f Closes-bug: 1767094 --- containers/vrouter/agent/entrypoint.sh | 5 +++++ containers/vrouter/base/agent-functions.sh | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/containers/vrouter/agent/entrypoint.sh b/containers/vrouter/agent/entrypoint.sh index bedc5392e..b1dd7ea09 100755 --- a/containers/vrouter/agent/entrypoint.sh +++ b/containers/vrouter/agent/entrypoint.sh @@ -98,6 +98,11 @@ else pci_address=`cat $binding_data_dir/${phys_int}_pci` fi +if [ "$CLOUD_ORCHESTRATOR" == "kubernetes" ] && [ ! -z $VROUTER_GATEWAY ]; then + # dont need k8s_pod_cidr_route if default gateway is vhost0 + add_k8s_pod_cidr_route +fi + VROUTER_GATEWAY=${VROUTER_GATEWAY:-`get_default_gateway_for_nic 'vhost0'`} vrouter_cidr=$(get_cidr_for_nic 'vhost0') echo "INFO: Physical interface: $phys_int, mac=$phys_int_mac, pci=$pci_address" diff --git a/containers/vrouter/base/agent-functions.sh b/containers/vrouter/base/agent-functions.sh index f71c87fba..0c374faa5 100644 --- a/containers/vrouter/base/agent-functions.sh +++ b/containers/vrouter/base/agent-functions.sh @@ -744,3 +744,8 @@ function check_and_launch_dhcp_clients() { echo "WARNING: dhcp clients not running for vhost0. If this is not static configuration, connectivity will be lost" fi } + +function add_k8s_pod_cidr_route() { + local pod_cidr=${KUBERNETES_POD_SUBNETS:-"10.32.0.0/12"} + ip route add $pod_cidr via $VROUTER_GATEWAY dev vhost0 +}