Skip to content

Commit c0130eb

Browse files
committed
added npm lite default deny cni changes
1 parent 7e6e30d commit c0130eb

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

cni/network/invoker.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ type IPAMAddConfig struct {
2828
type IPAMAddResult struct {
2929
interfaceInfo map[string]network.InterfaceInfo
3030
// ncResponse and host subnet prefix were moved into interface info
31-
ipv6Enabled bool
31+
ipv6Enabled bool
32+
defaultDenyACL []cni.KVPair
3233
}
3334

3435
func (ipamAddResult IPAMAddResult) PrettyString() string {

cni/network/invoker_cns.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ type IPResultInfo struct {
5555
skipDefaultRoutes bool
5656
routes []cns.Route
5757
pnpID string
58+
defaultDenyACL []cni.KVPair
5859
}
5960

6061
func (i IPResultInfo) MarshalLogObject(encoder zapcore.ObjectEncoder) error {
@@ -159,6 +160,7 @@ func (invoker *CNSIPAMInvoker) Add(addConfig IPAMAddConfig) (IPAMAddResult, erro
159160
skipDefaultRoutes: response.PodIPInfo[i].SkipDefaultRoutes,
160161
routes: response.PodIPInfo[i].Routes,
161162
pnpID: response.PodIPInfo[i].PnPID,
163+
defaultDenyACL: response.PodIPInfo[i].DefaultDenyACL,
162164
}
163165

164166
logger.Info("Received info for pod",
@@ -444,6 +446,9 @@ func configureDefaultAddResult(info *IPResultInfo, addConfig *IPAMAddConfig, add
444446
Gw: ncgw,
445447
})
446448
}
449+
450+
addResult.defaultDenyACL = append(addResult.defaultDenyACL, info.defaultDenyACL...)
451+
447452
// if we have multiple infra ip result infos, we effectively append routes and ip configs to that same interface info each time
448453
// the host subnet prefix (in ipv4 or ipv6) will always refer to the same interface regardless of which ip result info we look at
449454
addResult.interfaceInfo[key] = network.InterfaceInfo{

cni/network/network.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,8 @@ func (plugin *NetPlugin) Add(args *cniSkel.CmdArgs) error {
589589
// sendEvent(plugin, fmt.Sprintf("Allocated IPAddress from ipam DefaultInterface: %+v, SecondaryInterfaces: %+v", ipamAddResult.interfaceInfo[ifIndex], ipamAddResult.interfaceInfo))
590590
}
591591

592+
logger.Info("The length of ipamAddResult defaultDenyACL's is", zap.Any("defaultDenyACLLength", ipamAddResult.defaultDenyACL))
593+
nwCfg.AdditionalArgs = append(nwCfg.AdditionalArgs, ipamAddResult.defaultDenyACL...)
592594
policies := cni.GetPoliciesFromNwCfg(nwCfg.AdditionalArgs)
593595
// moved to addIpamInvoker
594596
// sendEvent(plugin, fmt.Sprintf("Allocated IPAddress from ipam interface: %+v", ipamAddResult.PrettyString()))

cns/NetworkContainerContract.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"strconv"
88
"strings"
99

10+
"github.com/Azure/azure-container-networking/cni"
1011
"github.com/Azure/azure-container-networking/cns/types"
1112
"github.com/Azure/azure-container-networking/crd/nodenetworkconfig/api/v1alpha"
1213
"github.com/google/uuid"
@@ -503,6 +504,8 @@ type PodIpInfo struct {
503504
Routes []Route
504505
// PnpId is set for backend interfaces, Pnp Id identifies VF. Plug and play id(pnp) is also called as PCI ID
505506
PnPID string
507+
// Defauly Deny ACL's to configure on HNS endpoints for Swiftv2 window nodes
508+
DefaultDenyACL []cni.KVPair
506509
}
507510

508511
type HostIPInfo struct {

0 commit comments

Comments
 (0)