-
Notifications
You must be signed in to change notification settings - Fork 260
fix: [NPM] fix windows intersection of IPs #1385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| ) | ||
| } | ||
|
|
||
| if len(policyNetworkRequest.Policies) == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why move this check down ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the other check back, but this is a separate check. We can have 1+ setpolicysettings but have 0 policies if there are no setpolicies with the given policyType
e4cdb51 to
0dd8c55
Compare
npm/pkg/dataplane/ipsets/ipset.go
Outdated
| if set.Kind == HashSet { | ||
| result := make(map[string]struct{}, len(set.IPPodKey)) | ||
| for ip := range set.IPPodKey { | ||
| result[ip] = struct{}{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use the set.IPPodKey map directly ignore values instead of creating a map with the same keys?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thinking about this more, there are 2 scenarios:
- when determining which IPs to apply a new policy on, we use the full map
- when updating the IPSets that a pod is a part of, we only check to see if the Pod IP is in the map
The second scenario doesn't require the full map and could use O(1) space, but I'm not sure if this a worthwhile optimization if we already do the O(N) space option for another scenario
* fix windows intersection * test intersection * fix build * separate out children of pod selector and add translate UTs * address comments * address named return comment * optimize space/time for checking if an ip satisfies a pod selector
Used to never apply policies to endpoints if the policy selector involved a list set. Two changes to enable this:
Other change: fail the dataplane if a non "azure" network is specified or if IPPolicyMode is used, which is unimplemented.