-
Notifications
You must be signed in to change notification settings - Fork 260
[NPM] Adding prefixes to IPSets in dataplane #1047
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
huntergregory
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.
Changes look great. Noted a couple things about dataplane
npm/pkg/dataplane/dataplane.go
Outdated
| // Check if any 2nd level IPSets are generated by Controller with members | ||
| // Apply members to the list set | ||
| if set.Kind == ipsets.ListSet { | ||
| if ipsets.GetSetKind(set.Metadata.Type) == ipsets.ListSet { |
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.
mismatched types Type and Kind
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 do a check in the first loop to see if len(set.MemberIPSets) > 0, then the metadata Type needs to be a list kind or we throw an error?
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.
same comments apply to deleteIPSetsAndReferences
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.
Actually we missed a case which if forgot to add, CIDR ipsets can be translated and provided to us, i will need to add CIDR block ips to corresponding IPSets, so we should not be throwing an error if it is not list
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.
But a CIDR is a hash set, right? why not make the members/list check still?
| IpsetNomatch string = "nomatch" | ||
|
|
||
| // Prefixes for ipsets | ||
| NamedPortIPSetPrefix string = "namedport:" |
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 there a reason to have ":" instead of "-" for NamedPortIPsetPrefix?
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.
We used ":" name for this alone because k8s would not allow adding a ":" in labels. keeping it same in v2 even though there is no other reason apart from being backward compatible
| // Copyright 2017 Microsoft. All rights reserved. | ||
| // MIT License | ||
|
|
||
| //go:build windows |
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 add the _windows suffix to this filename?
This PR includes changes to distinguish different kinds of IPSets by expanding on existing prefixes we use. This PR also updates the existing Dataplane APIs now to take in IPSetMetaData struct instead of strings