Skip to content

Commit 3775827

Browse files
authored
[CNI] Bypassing POSTROUTING table for Swift POD traffic (#807)
* Bypassing POSTINGROUTING for Swift POD traffic * Adding the comment to remove this rule after cleaning AGentBaker
1 parent c5f7dcd commit 3775827

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cni/network/invoker_cns.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,14 @@ func setHostOptions(nwCfg *cni.NetworkConfig, hostSubnetPrefix *net.IPNet, ncSub
150150
}
151151

152152
azureDNSMatch := fmt.Sprintf(" -m addrtype ! --dst-type local -s %s -d %s -p %s --dport %d", ncSubnetPrefix.String(), iptables.AzureDNS, iptables.UDP, iptables.DNSPort)
153+
154+
// TODO remove this rule once we remove adding MASQUEARDE from AgentBaker, check below PR
155+
// https://github.com/Azure/AgentBaker/pull/367/files
156+
podTrafficAccept := fmt.Sprintf(" -m iprange ! --dst-range 168.63.129.16-168.63.129.16 -s %s ", ncSubnetPrefix.String())
153157
snatPrimaryIPJump := fmt.Sprintf("%s --to %s", iptables.Snat, info.ncPrimaryIP)
154158
options[network.IPTablesKey] = []iptables.IPTableEntry{
155159
iptables.GetCreateChainCmd(iptables.V4, iptables.Nat, iptables.Swift),
160+
iptables.GetInsertIptableRuleCmd(iptables.V4, iptables.Nat, iptables.Postrouting, podTrafficAccept, iptables.Accept),
156161
iptables.GetAppendIptableRuleCmd(iptables.V4, iptables.Nat, iptables.Postrouting, "", iptables.Swift),
157162
iptables.GetInsertIptableRuleCmd(iptables.V4, iptables.Nat, iptables.Swift, azureDNSMatch, snatPrimaryIPJump),
158163
}

0 commit comments

Comments
 (0)