Skip to content

Commit

Permalink
hack: add setup_node_nft_masq
Browse files Browse the repository at this point in the history
  • Loading branch information
mcluseau committed Apr 30, 2021
1 parent d3f47f2 commit 801e754
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hack/kpng-local-up.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
# build the kpng image...

IMAGE="jayunit100/kpng-server:latest"
: ${IMAGE:="jayunit100/kpng-server:latest"}

function setup_k8s {
# make a gopath if not one existing...
Expand Down Expand Up @@ -32,6 +32,7 @@ function build {

function install {
# substitute it with your changes...
echo "Applying template with KPNG_IMAGE=$IMAGE"
cat kpng-deployment-ds.yaml.tmpl | sed "s,KPNG_IMAGE,$IMAGE," > kpng-deployment-ds.yaml

kubectl -n kube-system create sa kpng
Expand Down
21 changes: 21 additions & 0 deletions hack/setup_node_nft_masq
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#! /bin/sh
# this script sets a basic masquerading for pods to reach the outside

set -ex
apt update
apt install -y nftables

nft -f - <<EOF
table ip filter {
chain postrouting {
type nat hook postrouting priority 0; policy accept;
oif "eth0" masquerade
}
}
table ip6 filter6 {
chain postrouting {
type nat hook postrouting priority 0; policy accept;
oif "eth0" masquerade
}
}
EOF

0 comments on commit 801e754

Please sign in to comment.