-
Notifications
You must be signed in to change notification settings - Fork 32
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
v0.1.6 api review #235
v0.1.6 api review #235
Conversation
// implementation can apply any of the matching policies to the connection, and | ||
// there is no way for the user to reliably determine which one it will choose. |
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.
There are some implementations that are able to do this deterministically, I did it sorting by name here https://github.com/kubernetes-sigs/kube-network-policies/blob/db089bc6ed6c17a654ef0ea3f3a93d9122041c4e/pkg/networkpolicy/networkpolicyapi.go#L189-L196
I think we can guide users, and say that from the API point of view is difficult to define the exact behavior as it may depend on implementation details, but they should refer to the project implementing this API to understand what is the expected behavior
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.
This was hashed out in #216 and #229.
Individual implementations may do something deterministic, but they are not required to. The point of the explanation here is that if you want an "expected behavior", then you have to avoid having two ANPs with the same priority that both match the same packet. (But also, if you do have two ANPs with the same priority that both match the same packet, the "undefined-ness" is much more restricted than it was before; the implementation must obey one of the matching policies. It can't just "always deny", or ignore both policies, etc.)
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 was trying to point out that we can guide the users to ask their implementations about the behaviors, the way is worded now seems that "is impossible to know", when it really means "it is impossible to define a general behavior, but implementations may have a deterministic one"
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.
What it really means is "don't do that".
The only scenario that is not well-defined is when you have two ANPs at the same priority that attempt to take different actions on the same packet. No matter what the implementation does, it will fail to obey the administrator's intent, because the administrator has requested that it do two contradictory things. Don't do that. Don't ask which policy it's actually going to use in that case, just fix your policies.
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.
as a developer is clear, but as a user you can do it if the implementation you are using is deterministic
@@ -130,11 +162,16 @@ type AdminNetworkPolicyIngressRule struct { | |||
// AdminNetworkPolicyEgressRule describes an action to take on a particular | |||
// set of traffic originating from pods selected by a AdminNetworkPolicy's | |||
// Subject field. | |||
// <network-policy-api:experimental:validation> | |||
// +kubebuilder:validation:XValidation:rule="!(self.to.exists(peer, has(peer.networks) || has(peer.nodes)) && has(self.ports) && self.ports.exists(port, has(port.namedPort)))",message="networks/nodes peer cannot be set with namedPorts since there are no namedPorts for networks/nodes" |
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.
@thockin I think that you mention this to me at one point, about having a way to unit test or validate these expressions
// | ||
// Support: Core | ||
// | ||
To []AdminNetworkPolicyEgressPeer `json:"to"` |
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 now the differentiation between Ingress and Egress?
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 network selector was added to egress (egress controls by CIDR block). We didn't include Ingress yet due to the difficulties reliably determining the source IP of ingress traffic.
https://network-policy-api.sigs.k8s.io/npeps/npep-126-egress-traffic-control/#non-goals
// To be selected a Namespace must have all of the labels defined in SameLabels, | ||
// AND they must all have the same value as the subject of this policy. | ||
// If Samelabels is Empty then nothing is selected. | ||
Namespaces *metav1.LabelSelector `json:"namespaces,omitempty"` |
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.
much simpler
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
@astoycos should I help with this? I know last time we spoke we wanted to setup a meeting with going through the PR and hashing out API changes? |
/remove-lifecycle stale |
Signed-off-by: astoycos <[email protected]>
65d12fe
to
b5ff96c
Compare
@astoycos: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
/reopen |
@astoycos: Failed to re-open PR: state cannot be changed. The review-v0.1.6 branch was force-pushed or recreated. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
For some reason this won't let me re-open now 🤔 |
/reopen |
@astoycos: Failed to re-open PR: state cannot be changed. The review-v0.1.6 branch was force-pushed or recreated. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Opened #260 to replace this 🤔 Unless someone can figure out how to re-open we can continue the discussion there |
What type of PR is this?
/kind api-change
What this PR does / why we need it:
This PR is a diff of /apis from v0.1.6 (main branch) to v0.1.1 (release-v0.1.1 branch).
Note: This PR is purely to facilitate review, it is not intended to merge.
Note2: This does not include FQDN support from from @rahulkjoshi in #233, which will come in our next 0.2.0 release