If I understand you correctly, I thought the questions you raised were already answered (and with the answers you advocate). Please have a look at my attempt at a clearer write-up, https://docs.google.com/document/d/1cTA_c1qahzZ9nDI-h6Vp9-9_kCB-kk1cw91K0qRjI84 --- I think it clearly gives the answers you want.
--
You received this message because you are subscribed to the Google Groups "kubernetes-sig-network" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-sig-ne...@googlegroups.com.
To post to this group, send email to kubernetes-...@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-sig-network.
For more options, visit https://groups.google.com/d/optout.
> Shall the policy allow traffic from pods that match all the selectors or from pods that match any selector? I personally believe it should be "ANY" selector, as the selector construct itself expresses an AND condition.
Yep, so long as it matches ANY “from” selector the traffic will be allowed (limited to any specified ports).
> Second... for a policy with both namespace and pods selectors, I think traffic should be allowed only from pods in the selected namespaces which match the pod selector, whereas when the ns selector is not > specified, pods in all namespaces will be selected. The alternative would be to select pods in all namespaces according to the pod selector and then all pods in the namespaces selected by the namespace selector.
We explicitly did not support defining a namespace selector and pod selector in the same “from” rule in order to avoid this. At the moment, labels are only valid in a single namespace, so making them apply to other namespaces is not quite right. At the moment it is an error on the API to specify both for the same rule. If no “namespaces" is defined and “pods” is defined, then pods in the current namespace will be selected. If no “pods” is defined and “namespaces” is defined, all pods in the selected namespaces will be allowed. If both “pods” and “namespaces” are defined, it is an error.
If neither “pods” nor “namespaces” is defined, no sources are selected.
--
> Which I guess means that any source can access the specified protocol/ports! Sorry for being pedant but "no source are selected" could be read as "no source ip will match the policy".
Sorry – should have been more clear! There are two cases to talk about here, and I believe this is what we agreed for each:
- No “from” key is provided. In this case, all sources can reach the specified ports / protocols.
- A “from” key is provided with no selectors. In this case, no sources can access the pod on any port or protocol.
Does that make sense?