-
Notifications
You must be signed in to change notification settings - Fork 260
[NPM] Generic Dataplane interface for windows and linux #984
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
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
| set.IpsetReferCount-- | ||
| } | ||
|
|
||
| func (set *IPSet) AddSelectorReference(netPolName string) { |
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.
different arg name (below func too)?
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.
essentially what we are adding is the network policy name if its a selector ref or a normal ref.
matmerr
left a comment
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.
some comments
|
|
||
| const ( | ||
| ListSet SetKind = "list" | ||
| HashSet SetKind = "set" |
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.
tbh I think there's room for what defines a set here, taking linux vernacular could be misleading in windows, but I think in terms of platform agnostic, what about something like hashset is "set" and list is "superset" since it contains only "sets"(?)
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.
I like this "superset" since it is intuitive. But keeping list since we have been used to calling it as list. We can use "nestedset" which windows is using ?
| } | ||
| } | ||
|
|
||
| func getSetKind(setType SetType) SetKind { |
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.
is this still needed with properties?
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.
Yes we derive the kind from type of set input.
JungukCho
left a comment
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.
Before I put other comments, there are structural (i.e., architectural) comments of this PR.
I may misunderstand the codes and intentions, but some of them are different from what I expected.
-
I thought interface will be used for
ipsetmanageranddataplaneto abstract linux and windows. But it seems you use composition with concrete struct instead of interface. I think bothipsetmanageranddataplaneare nicely abstract with interface (Example in npm - https://github.com/Azure/azure-container-networking/blob/master/npm/iptm/ioshim.go).
Do I know why you decide this direction? -
There are many almost inline method (just one or two lines) for exposed members. In this case, if you want to keep methods, I think non-capitalizing members if possible since it is good to maintain code as our code base becomes bigger and bigger. In addition, some of them can be removed with interface direction instead of concrete struct.
I may be wrong, but I think function or method having one line is not very useful. wdyt? -
It would be nice to have UTs for
ipsetmanager_windows.goanddataplane_windows.goin this PR to guarantee their functionality, but as you said, it will be next PR. So, I think it is ok in this PR. -
While I read this PR, there are many common variables and const with
debugTools. I think it is good to remove redundant declarations by checkingdebugToolscode carefully. One examaple, isipset.goandrule.pb.gogenerated fromrule.proto.
|
@JungukCho thanks foe the comments
|
| return hcn.DirectionTypeIn | ||
| case Egress: | ||
| return hcn.DirectionTypeOut | ||
| case Both: |
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.
seems this case is not necessary.
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.
Windows dataplane does accept rules on both directions, in case of network policies with both ingress and egress rules i can use a DENY all with BOTH, that way we get away with single rule than 2
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.
I meant case Both is not necessary based on logic. Anyway, by default it returns ""
If they are almost identical, this approach seems reasonable. How about
Still I think those inline functions will be nicely removed with interface. Further more dataplane-specific functions will be added in next PRs. So, it will increase more these inline functions. I will check your above reference and let you know.
I am not sure it increases scope of the PR. I meant checking the existing variables and then reusing them to avoid redundant codes in this PR without touching existing logics. |
JungukCho
left a comment
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.
LGTM. Thank you for applying comments.
This PR will be foundation of next NPM!
matmerr
left a comment
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.
🚀
matmerr
left a comment
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.
🚀
JungukCho
left a comment
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.
lgtm
Reason for Change:
This PR helps outline the DataPlane interface which acts as an abstraction layer for similar functionalities in Windows and Linux.
a. Addition of new dataplane APIs for control plane to use
b. specific build target functions to convert ipsets and acl policies accoridngly
Issue Fixed:
Requirements:
Notes: