Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions npm/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ func start(config npmconfig.Config, flags npmconfig.Flags) error {
options.FieldSelector = "spec.nodeName=" + models.GetNodeName()
}),
)
npmV2DataplaneCfg.IsL1VHNode = config.Toggles.IsL1VHNode
npmV2DataplaneCfg.EnableNPMLite = config.Toggles.EnableNPMLite
}
k8sServerVersion := k8sServerVersion(clientset)

Expand Down
2 changes: 2 additions & 0 deletions npm/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ var DefaultConfig = Config{
// NetPolInBackground is currently used in Linux to apply NetPol controller Add events in the background
NetPolInBackground: true,
EnableNPMLite: false,
IsL1VHNode: false,
},
}

Expand Down Expand Up @@ -96,6 +97,7 @@ type Toggles struct {
// NetPolInBackground
NetPolInBackground bool
EnableNPMLite bool
IsL1VHNode bool
}

type Flags struct {
Expand Down
3 changes: 2 additions & 1 deletion npm/examples/windows/azure-npm-lite-win.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ data:
"ApplyIPSetsOnNeed": false,
"ApplyInBackground": true,
"NetPolInBackground": true
"EnableNPMLite": true
"EnableNPMLite": true,
"IsL1VHNode": true
}
}
2 changes: 2 additions & 0 deletions npm/pkg/dataplane/dataplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ type Config struct {
NetPolInBackground bool
MaxPendingNetPols int
NetPolInterval time.Duration
IsL1VHNode bool
EnableNPMLite bool
*ipsets.IPSetManagerCfg
*policies.PolicyManagerCfg
}
Expand Down
8 changes: 8 additions & 0 deletions npm/pkg/dataplane/dataplane_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ func (dp *DataPlane) initializeDataPlane() error {
}
// Filter out any endpoints that are not in "AttachedShared" State. All running Windows pods with networking must be in this state.
filterMap := map[string]uint16{"State": hcnEndpointStateAttachedSharing}
klog.Info("State:hcnEndpointStateAttachedSharing ")

// if npm lite is enabled and running on l1vh node, filter out any endpoints that are not in "Attached" State
if dp.EnableNPMLite && dp.IsL1VHNode {
klog.Info("NPM lite is running on L1VH Node")
filterMap = map[string]uint16{"State": hcnEndpointStateAttached}
}

filter, err := json.Marshal(filterMap)
if err != nil {
return npmerrors.SimpleErrorWrapper("failed to marshal endpoint filter map", err)
Expand Down
Loading