endpoint: Push L4-only policies into BPF maps#2992
Conversation
|
test-me-please |
|
For egress path in future, it would be nice to instead map down the wildcard selector as |
There was a problem hiding this comment.
Why not use filter.FromEndpoints directly? ohh I see, you're adding a L3 wildcard if L3 is not defined. Can you please add a comment for that?
There was a problem hiding this comment.
Out of curiosity, does this means all SecIDs will be selected?
There was a problem hiding this comment.
For the case where the endpoint selector is empty, the new code inserts a wildcard selector which should select all SecIDs, yes.
|
I think this fix is not wrong but incomplete and in order to complete we will run into a problem. First of all, it's contrary to what we have documented right now: However, I agree that going this route is correct but I think we need to do it differently, because what you fix here must also apply to Then this would have to translate into something like this: Assuming the above model, it then raises the question, how do to define a rule which only allows ingress from label "foo" without any further privileges granted? This is why we currently have a difference between empty selector to wildcard and nil. I agree that it is confusing and that we have to change it. The good news is that we can change it while preserving backwards compatibility by bumping to v3 and converting from v2 to v3. I suggest we do the following:
Example: |
|
After further discussion: I will open an issue to propose the above proposal for a policy v3 and we fix this in v2 in the following way:
|
|
Sounds good, I'll get to that this week. |
|
@tgraf I looked into it, we don't have such information at the
|
|
@joestringer OK, I would pick 1) then and solve this properly via #3005 |
The description of `L4Filter.FromEndpoints` is as follows: // FromEndpoints limit the source labels for allowing traffic. If // FromEndpoints is empty, then it selects all endpoints. However, to date when pushing L4Filters into the BPF maps, we were treating an empty `FromEndpoints` slice as selecting nothing. This lead to L4-only policies not allowing traffic on ingress, and with upcoming egress label-based policies implementations, would also break the current workflow for specifying `ToPorts` policies on egress (ie, without a wildcard EndpointSelector). Treat the empty L4Filter selector list as a wildcard and push a label-dependent l4 map entry into the datapath for each known endpoint in the node. While we're at it, extend the L4 policy tests to cover egress as well. Fixes: cilium#2907 Signed-off-by: Joe Stringer <joe@covalent.io>
c7e52ab to
f8b5e4c
Compare
|
test-me-please |
|
Addressed the comments and rebased, ready for review. The comment in the patch assumes merging of #3015, but I believe this should fix the issue as-is. |
The description of
L4Filter.FromEndpointsis as follows:However, to date when pushing L4Filters into the BPF maps, we were
treating an empty
FromEndpointsslice as selecting nothing. This leadto L4-only policies not allowing traffic on ingress, and with upcoming
egress label-based policies implementations, would also break the
current workflow for specifying
ToPortspolicies on egress (ie,without a wildcard EndpointSelector).
Treat the empty L4Filter selector list as a wildcard and push a
label-dependent l4 map entry into the datapath for each known identity
in the node.
While we're at it, extend the L4 policy tests to cover egress as well.
Fixes: #2907
Signed-off-by: Joe Stringer joe@covalent.io