Skip to content

clarify connection-based vs packet-based behavior #305

@danwinship

Description

@danwinship

NetworkPolicy was originally intended to apply only to connection establishment, not to every packet in a connection. However, like so many other things, this was not documented, and there is inconsistency between implementations currently. (For example, I know that kube-network-policies only checks NP on connection establishment, but ovn-kubernetes checks it on every packet.)

Only enforcing on connection establishment is more efficient, which is probably why we intended it to work that way. But there are users who definitely want the opposite semantics ("when I change policies, any existing connections that are no longer in-policy should be dropped"). That doesn't actually necessarily imply checking every packet: you could do it by deleting conntrack records for out-of-policy connections when policies change. (I think that might actually be what OVN does.)

We should probably say:

  • ANP should use packet-based semantics.
  • NP implementations may use either semantics
  • Future DNP or whatever should be consistent with ANP.

?

(cc @bowei re: #303 (comment))

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/documentationCategorizes issue or PR as related to documentation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions