-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
add NetworkPolicy plugin #12448
add NetworkPolicy plugin #12448
Conversation
28de307
to
371c719
Compare
For reference, the spec is at https://github.com/kubernetes/community/blob/master/contributors/design-proposals/network-policy.md |
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. Really nice, clean, code. Thanks!
@dcbw can you find some time to look at this soon please? |
[test] |
371c719
to
b3c4828
Compare
Repushed to make the UPSTREAM commit include the entire corresponding upstream commit, and to remove (incorrect) support for string-valued NetworkPolicyPort values. Note that currently no tests get run with the networkpolicy plugin, so running tests doesn't actually tell you anything (except that the handful of changes outside of networkpolicy.go didn't break anything). |
} | ||
|
||
func (np *networkPolicyPlugin) watchNetworkPolicies() { | ||
RunEventQueue(np.node.kClient.ExtensionsClient.RESTClient(), NetworkPolicies, func(delta cache.Delta) 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.
We have said we need to stop using event queue. Adding more uses of it isn't helping :)
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.
The "EventQueue" used in pkg/sdn/plugin is a wrapper around DeltaFIFO (#10070) not the old pkg/client/cache/eventqueue.go.
np.lock.Lock() | ||
defer np.lock.Unlock() | ||
|
||
namespaces, err := np.node.kClient.Namespaces().List(kapi.ListOptions{}) |
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 the only network policy that reads namespaces?
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. With the multitenant policy, everything it needs to track is on the NetNamespace object, but here we need to combine Namespace, NetNamespace, and NetworkPolicies.
pushed a fixup to get Services at least minimally working |
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.
The service changes look good. Do you expect to have the tests implemented soon?
LGTM |
Since this is tech preview and you have to opt in by manually creating the network policy objects, this feels okay to merge to get some mileage on it before the testing and docs stabilize. But we need to get those in ASAP. |
4a585c0
to
55ae2ce
Compare
Test change LGTM |
[merge] |
55ae2ce
to
2e37136
Compare
That was a pain to dig out... |
Implements DefaultDeny (with no NetworkPolicy objects), plus trivial NetworkPolicies ("allow all" and "deny all").
2e37136
to
0988c04
Compare
Evaluated for origin test up to 0988c04 |
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/13085/) (Base Commit: b46ecc5) |
[merge] |
Evaluated for origin merge up to 0988c04 |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/13127/) (Base Commit: 766ada8) (Image: devenv-rhel7_5740) |
This adds a new plugin,
redhat/openshift-ovs-networkpolicy
, which implements NetworkPolicy (and does not implement traditional openshift-sdn multitenancy). This is considered "tech preview" for 3.5 so it doesn't have to be completely flawless (eg, the pod watching code is currently not very scalable; there's a trello card about that).Still to do:
@openshift/networking PTAL