network-policy-api icon indicating copy to clipboard operation
network-policy-api copied to clipboard

[ENHANCEMENT] Resolve ambiguity in APIs around matching traffic

Open shashankram opened this issue 7 months ago • 3 comments

Is your enhancement request related to a problem? Please describe. The match criteria in the APIs are a bit ambiguous. For e.g., consider the AdminNetworkPolicyIngressRule https://github.com/kubernetes-sigs/network-policy-api/blob/f6c1cf24c0488f12c21920d2d9286fe0a380dd76/apis/v1alpha1/adminnetworkpolicy_types.go#L105, where it could be unclear which fields define the matching semantics for traffic. It's a bit simple at the moment with just peer and ports defined, but can get complex if additional matching properties are introduced.

Describe the solution you'd like Similar to the Action field, I would like to see a Matches field instead, which can be extended in the future to define match semantics (and, or, etc.). This would make the match criteria explicit instead of leaving the interpretation to the user based on field documentation.

Describe alternatives you've considered Alternative would be to improve the documentation to describe the fields that are responsible for the match criteria and the associated match semantics.

shashankram avatar Nov 17 '23 17:11 shashankram