-
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
[BUG] AdminNetworkPolicyIngressRule.Ports has two nil values? #247
Comments
cc @astoycos |
We spoke about this in sig-network sync meeting today
But we need to check the KEP to ensure we didn't have a usecase for not doing minItems in ports maybe @Dyanngg or @astoycos know or remember?
that is how we meant it in the API but this is not super intuitive in API docs and hard for implementations to figure out. We are not really sure if there is a usecase for (1) ever? |
For future reference, the rationale for the existing semantics is:
So anyway, |
While reviewing our WIP implementation of ANP, I noticed that the Ports field is defined as
which means that it has two/three "empty" values:
(*[]AdminNetworkPolicyPort)(nil)
&([]AdminNetworkPolicyPort(nil))
&([]AdminNetworkPolicyPort{})
It's not clear what they're each supposed to mean, "If Ports is not set then the rule does not filter traffic via port". Clearly a nil pointer is "not set" but what about a pointer to an empty/nil slice? Would those mean "match no ports" (which in turn is a bit ambiguous since not all protocols have ports)?
I suggest dropping the extra pointer indirection and interpreting any zero-length slice (nil or otherwise) as "do not filter on ports". If we can't do that, we should at least document the meanings (where I think we should probably make them all mean "do not filter on ports").
The text was updated successfully, but these errors were encountered: