aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rw-r--r--build/Dockerfile2
-rwxr-xr-xbuild/bin/entrypoint10
2 files changed, 11 insertions, 1 deletions
diff --git a/build/Dockerfile b/build/Dockerfile
index af88d13..eefdeb3 100644
--- a/build/Dockerfile
+++ b/build/Dockerfile
@@ -7,7 +7,7 @@ ENV http_proxy $HTTP_PROXY
ENV https_proxy $HTTPS_PROXY
ENV no_proxy $NO_PROXY
-RUN apt-get update && apt-get install -y -qq apt-transport-https make curl net-tools iproute2 \
+RUN apt-get update && apt-get install -y -qq apt-transport-https make curl net-tools iproute2 iptables \
wget software-properties-common setpriv dpkg-dev netcat jq
RUN mkdir -p /opt/ovn4nfv-k8s-plugin/dist/ubuntu/deb
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.