Skip to content
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

Add more configuration flexibility to Egress for user #7041

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jainpulkit22
Copy link
Contributor

@jainpulkit22 jainpulkit22 commented Mar 3, 2025

Added an immutable FailurePolicy field to the Egress spec. If this field is set to "NodeSNAT" then if the egress node
is not available due to any reason then the packet transfer or we can say the traffic will go via normal Node SNAT, while in the second case where this field is set to "Drop", and if egress node is not available packet won't go out and traffic will be stuck because of unavailability of egress node.

Fixes #6988.

@antrea-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@jainpulkit22
Copy link
Contributor Author

jainpulkit22 commented Mar 4, 2025

Points to note:

  1. In case of dynamic egress, if there is no node available then egress IP is also not assigned to the egress, and so no flows are installed and traffic goes through normal Node SNAT, so its not possible to add configurable parameter for dynamic egress because in case of no node available we don't have any egress, and we don't have any deciding condition on basis of which we can drop the traffic if we want to enable strict enforcement for dynamic egress.
  2. In case of static egress what happens is the Egress has an IP, but node is not guaranteed so we have two choices now that when egress node is not available for static egress we can either allow the traffic to go through normal Node SNAT(just similar to the working of dynamic egress), or we can drop the traffic.

My current implementation gives user the flexibility to decide whether to allow the traffic(best effort), or not(strict enforcement of egress policy).

But In ideal case won't this be too confusing for the end user that static egress is configurable and dynamic is not, so should we keep the behaviour of both the egress consistent and make sure that when there is no node available for static egress then instead of dropping the traffic/packet we should allow the traffic to pass through the normal Node SNAT, same as in the case of dynamic egress.

what's your opinion on this @tnqn @antoninbas

@jainpulkit22
Copy link
Contributor Author

jainpulkit22 commented Mar 4, 2025

Points to note:

  1. In case of dynamic egress, if there is no node available then egress IP is also not assigned to the egress, and so no flows are installed and traffic goes through normal Node SNAT, so its not possible to add configurable parameter for dynamic egress because in case of no node available we don't have any egress, and we don't have any deciding condition on basis of which we can drop the traffic if we want to enable strict enforcement for dynamic egress.
  2. In case of static egress what happens is the Egress has an IP, but node is not guaranteed so we have two choices now that when egress node is not available for static egress we can either allow the traffic to go through normal Node SNAT(just similar to the working of dynamic egress), or we can drop the traffic.

My current implementation gives user the flexibility to decide whether to allow the traffic(best effort), or not(strict enforcement of egress policy).

But In ideal case won't this be too confusing for the end user that static egress is configurable and dynamic is not, so should we keep the behaviour of both the egress consistent and make sure that when there is no node available for static egress then instead of dropping the traffic/packet we should allow the traffic to pass through the normal Node SNAT, same as in the case of dynamic egress.

what's your opinion on this @tnqn @antoninbas

@jainpulkit22 jainpulkit22 requested review from antoninbas and tnqn March 7, 2025 10:42
@jianjuns jianjuns self-requested a review March 11, 2025 05:28
Added an immutable FailurePolicy field to the Egress spec.
If this field is set to "NodeSNAT" then if the egress node
is not available due to any reason then the packet
transfer or we can say the traffic will go via normal
Node SNAT, while in the second case where this field
is set to "Drop", and if egress node is not available
packet won't go out and traffic will be stuck
because of unavailability of egress node.

Signed-off-by: Pulkit Jain <pulkit.jain@broadcom.com>
@jainpulkit22 jainpulkit22 force-pushed the configurable-snat-for-egress branch from e25f867 to a4d3382 Compare March 20, 2025 06:48
@jainpulkit22
Copy link
Contributor Author

@antoninbas @tnqn I have updated the code making both dynamic and static egress configurable, based on the set failurePolicy which is an enum field in Egress Spec and supports two values 1) "Drop" 2) "NodeSNAT", if the field is set to 1 then if the egress node is not available the packet will be dropped in both the kind of egresses, while if the field is set to 2 then if the egress node is not available the packet will be forwarded via local NodeSNAT.
The above field is currently set to be immutable, also if the egress node is available then the above field will not take any effect and the packet will go through the egress node.

@jainpulkit22 jainpulkit22 requested review from jianjuns and removed request for jianjuns March 20, 2025 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

To Support Configurable Default SNAT Behavior for Antrea Egress
2 participants