-
Notifications
You must be signed in to change notification settings - Fork 3.4k
egressgw: Stop CEGP parsing in case of non-empty invalid EgressIP #32868
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
egressgw: Stop CEGP parsing in case of non-empty invalid EgressIP #32868
Conversation
6f092fb
to
abb1e2c
Compare
hmm, how does this match up with https://github.com/pippolo84/cilium/blob/355f2ffef29ad30fbdfcbf3ff20b5356e7bc994e/pkg/egressgateway/policy.go#L224 ? |
That parsing swallows the error without giving the user any sign about a possible mistake in specifying the address. With this change, An alternative might be to stop the parsing with an error in case EgressIP is both non empty and invalid. But this would introduce a non backward-compatible change that might be harmful. In the end, a warning should be the best trade off. |
Ah and that's ok, because I think we can be more fool-proof, and move that specific
I think we can definitely expect some sanity from the user, as the |
Yeah, looking at the kubebuilder pattern I can't find any case where an invalid IP can pass the validation, so it is probably enough to reject the address and fail the entire parsing if, for some reason, something that the netip package doesn't like ends up there. |
2287eda
to
ce8a372
Compare
ce8a372
to
bdfb95e
Compare
I'll do you one better - could we also update the kubebuilder to use |
Definitely! 👍 |
/test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, thank you!
💡 The ipsec-e2e fail needs a rebase to pick up #31757. |
EgressIP field of CiliumEgressGatewayPolicy spec is optional, but if specified, it is used to SNAT egress traffic. Being an optional parameter, no error is logged in case the conversion to netip.Addr fails, and the field is silently ignored. To inform the user of the failure in setting the requested egress IP, fail the CEGP parsing in case of an invalid non-empty egress IP. Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
Instead of relying on a regex based kubebuilder validation pattern, use the ipv4 format to validate EgressIP field in CEGP. Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
e2bcfba
to
d2f9aa9
Compare
/test |
Conformance Ingress failure tracked here, rerunning |
EgressIP field of CiliumEgressGatewayPolicy spec is optional, but if specified, it is used to SNAT egress traffic. Being an optional parameter, no error is logged in case the conversion to netip.Addr fails, and the field is silently ignored.
To inform the user of the failure in setting the requested egress IP, log a warning in case of an invalid non-empty egress IP.