add the ability to skip creation of MASQUERADE rules via iptables when executing weave expose command

This commit is contained in:
Aaron Hurt committed 2018-08-31 11:46:31 -05:00
1 parent ad4e4238a5
commit 4b9c533b94
6 files changed
+42 -15

No files matched your search

+20 -8
View File
@@ -69,7 +69,7 @@ weave attach [--without-dns] [--rewrite-hosts] [--no-multicast-route]
[<addr> ...] <container_id>
detach [<addr> ...] <container_id>
weave expose [<addr> ...] [-h <fqdn>]
weave expose [<addr> ...] [-h <fqdn>] [--without-masquerade]
hide [<addr> ...]
weave dns-add [<ip_address> ...] <container_id> [-h <fqdn>] |
@@ -430,9 +430,10 @@ EOF
}
expose_ip() {
[ -z $WITHOUT_MASQUERADE ] || skipNAT="/true"
ipam_cidrs allocate_no_check_alive weave:expose $CIDR_ARGS
for CIDR in $ALL_CIDRS ; do
call_weave "POST" "/expose/$CIDR"
call_weave "POST" "/expose/$CIDR$skipNAT"
[ -z "$FQDN" ] || when_weave_running put_dns_fqdn_no_check_alive weave:expose $FQDN $CIDR
done
@@ -1475,14 +1476,25 @@ case "$COMMAND" in
dig @$DOCKER_BRIDGE_IP +short $1
;;
expose)
WITHOUT_MASQUERADE=
FQDN=
collect_cidr_args "$@"
shift $CIDR_ARG_COUNT
if [ $# -eq 0 ] ; then
FQDN=""
else
[ $# -eq 2 -a "$1" = "-h" ] || usage
FQDN="$2"
fi
while [ $# -gt 0 ]; do
case "$1" in
-h)
[ -z $FQDN ] && FQDN=$2 && shift || usage
;;
--without-masquerade)
WITHOUT_MASQUERADE=1
;;
*)
break
;;
esac
shift
done
[ $# -eq 0 ] || usage
expose_ip
show_addrs $ALL_CIDRS
;;