Skip to content

Commit e4dcf6d

Browse files
committed
adjust comments
1 parent c94a25e commit e4dcf6d

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

cni/network/invoker_cns.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,11 @@ func setHostOptions(ncSubnetPrefix *net.IPNet, options map[string]interface{}, i
243243
},
244244
}
245245

246+
// note: if changing any iptables rules here, make corresponding change in internalapi_linux.go on cns side
246247
azureDNSUDPMatch := fmt.Sprintf(" -m addrtype ! --dst-type local -s %s -d %s -p %s --dport %d", ncSubnetPrefix.String(), networkutils.AzureDNS, iptables.UDP, iptables.DNSPort)
247248
azureDNSTCPMatch := fmt.Sprintf(" -m addrtype ! --dst-type local -s %s -d %s -p %s --dport %d", ncSubnetPrefix.String(), networkutils.AzureDNS, iptables.TCP, iptables.DNSPort)
248249
azureIMDSMatch := fmt.Sprintf(" -m addrtype ! --dst-type local -s %s -d %s -p %s --dport %d", ncSubnetPrefix.String(), networkutils.AzureIMDS, iptables.TCP, iptables.HTTPPort)
249250

250-
//snatPrimaryIPJump := fmt.Sprintf("%s --to %s", iptables.Snat, info.ncPrimaryIP)
251251
// we need to snat IMDS traffic to node IP, this sets up snat '--to'
252252
snatHostIPJump := fmt.Sprintf("%s --to %s", iptables.Snat, info.hostPrimaryIP)
253253

cns/restserver/internalapi_linux.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ func (service *HTTPRestService) programSNATRules(req *cns.CreateNetworkContainer
2828
service.Lock()
2929
defer service.Unlock()
3030

31-
// Parse primary ip and ipnet from nnc
32-
// in podsubnet case, ncPrimaryIP is the pod subnet's primary ip
33-
// in vnet scale case, ncPrimaryIP is the node's ip
34-
// ncPrimaryIP, _, _ := net.ParseCIDR(req.IPConfiguration.IPSubnet.IPAddress + "/" + fmt.Sprintf("%d", req.IPConfiguration.IPSubnet.PrefixLength))
31+
// note: if changing any iptables rules here, make corresponding change in invoker_cns.go on cni side
3532
ipt, err := service.iptables.GetIPTables()
3633
if err != nil {
3734
return types.UnexpectedError, fmt.Sprintf("[Azure CNS] Error. Failed to create iptables interface : %v", err)

cns/restserver/internalapi_linux_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ func TestAddSNATRules(t *testing.T) {
4040
}{
4141
{
4242
// in pod subnet, the primary nic ip is in the same address space as the pod subnet
43+
// however, we now snat azure dns traffic to the node ip for consistency across scenarios
4344
name: "podsubnet",
4445
input: &cns.CreateNetworkContainerRequest{
4546
NetworkContainerid: ncID,

0 commit comments

Comments
 (0)