From ce14abc0128d4c55a7805c52ea199e2ce6159428 Mon Sep 17 00:00:00 2001 From: Kuralamudhan Ramakrishnan Date: Mon, 6 Jul 2020 16:10:19 -0700 Subject: Adding node interface, SNAT and OVN Node switch port - Adding nfn proto for node interface MAC and IP address - Adding node switch ports in NFN Operator - Adding grpc client in nfn agent to get mac and IP address for node interface - Adding feature to create Node interface with OVS internal port - Make sure pod controller requeue the pod request for empty node field in pod spec - Unique node interface name using SHA and maintain 15 charactor for OVS switch port - Adding SNAT for default interface in each node - Adding iptables modules for SNAT rules Signed-off-by: Kuralamudhan Ramakrishnan Change-Id: I6cfa36e45007e796eb651345f9f0751329defcf7 --- build/bin/entrypoint | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'build/bin') diff --git a/build/bin/entrypoint b/build/bin/entrypoint index c9646a0..b8ac7db 100755 --- a/build/bin/entrypoint +++ b/build/bin/entrypoint @@ -66,6 +66,15 @@ install_cni_plugins() { rm -rf cni-plugins-linux-$IMAGE_ARC-$CNI_VERSION.tgz } +set_snat_default_inteface() { + default_interface=$(awk '$2 == 00000000 { print $1 }' /proc/net/route) + + # Checking the SNAT for default interfaces + if ! iptables -t nat -C POSTROUTING -o $default_interface -j MASQUERADE 2>/dev/null ; then + iptables -t nat -A POSTROUTING -o $default_interface -j MASQUERADE + fi +} + cmd=${1:-""} case ${cmd} in @@ -80,6 +89,7 @@ case ${cmd} in cp -f $OVN4NFV_BIN_FILE $CNI_BIN_DIR cp -f $OVN4NFV_CONF_FILE $OVN4NFV_CONF_DIR cp -f $OVN4NFV_NET_CONF_FILE $CNI_CONF_DIR + set_snat_default_inteface create_kubeconfig install_cni_plugins # Sleep forever. -- cgit 1.2.3-korg