Skip to content
Merged
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: 1 addition & 1 deletion npm/pkg/dataplane/dataplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func (dp *DataPlane) UpdatePolicy(policy *policies.NPMNetworkPolicy) error {
klog.Infof("[DataPlane] Update Policy called for %s", policy.PolicyKey)
ok := dp.policyMgr.PolicyExists(policy.PolicyKey)
if !ok {
klog.Infof("[DataPlane] Policy %s is not found. Might been deleted already", policy.PolicyKey)
klog.Infof("[DataPlane] Policy %s is not found.", policy.PolicyKey)
return dp.AddPolicy(policy)
}

Expand Down
5 changes: 4 additions & 1 deletion npm/pkg/dataplane/dataplane_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ func (dp *DataPlane) updatePod(pod *updateNPMPod) error {
// Check if pod is already present in cache
endpoint, ok := dp.endpointCache[pod.PodIP]
if !ok {
return fmt.Errorf("[DataPlane] did not find endpoint with IPaddress %s", pod.PodIP)
// ignore this err and pod endpoint will be deleted in ApplyDP
// if the endpoint is not found, it means the pod is not part of this node or pod got deleted.
klog.Warningf("[DataPlane] did not find endpoint with IPaddress %s", pod.PodIP)
return nil
}

if endpoint.IP != pod.PodIP {
Expand Down
30 changes: 22 additions & 8 deletions npm/pkg/dataplane/policies/policy_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,34 @@ func (acl *ACLPolicy) convertToAclSettings() (*NPMACLPolSettings, error) {

// HNS has confusing Local and Remote address defintions
// For Traffic Direction INGRESS
// LocalAddresses = Source IPs
// LocalAddresses = Source Sets
// RemoteAddresses = Destination Sets
// LocalPorts = Destination Ports
// RemotePorts = Source Ports

// For Traffic Direction EGRESS
// LocalAddresses = Source Sets
// RemoteAddresses = Destination Sets
// LocalPorts = Source Ports
// RemotePorts = Destination Ports

// If we use IPs in ACLs, then INGRESS mapping is same, but EGRESS mapping will change to below
// For Traffic Direction INGRESS
// LocalAddresses = Source IPs
// RemoteAddresses = Destination IPs
// For Traffic Direction EGRESS
// LocalAddresses = Destination IPs
// LocalAddresses = Destination IPs
// RemoteAddresses = Source IPs

policySettings.LocalAddresses = srcListStr
policySettings.RemoteAddresses = dstListStr
policySettings.RemotePorts = dstPortStr
policySettings.LocalPorts = ""

// Switch ports based on direction
policySettings.RemotePorts = ""
policySettings.LocalPorts = dstPortStr
if policySettings.Direction == hcn.DirectionTypeOut {
policySettings.LocalAddresses = dstListStr
policySettings.LocalPorts = dstPortStr
policySettings.RemotePorts = ""
policySettings.RemoteAddresses = srcListStr
policySettings.LocalPorts = ""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we do something for IP mode too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we have de-prioritized IpMode. No need to do it.

policySettings.RemotePorts = dstPortStr
}

return policySettings, nil
Expand Down