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

xds: fix ipFamily always nil #4782

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

juwon8891
Copy link
Contributor

chore: fix ipFamily always nil

What this PR does / why we need it:
This PR improves IP family configuration handling across different listener types and updates the DNS lookup strategy for better dual-stack support.

  • Add consistent IP family handling across all listener types

Which issue(s) this PR fixes:
Fixes #4761

Copy link

codecov bot commented Nov 26, 2024

Codecov Report

Attention: Patch coverage is 70.49180% with 18 lines in your changes missing coverage. Please review.

Project coverage is 65.66%. Comparing base (526a05f) to head (f356ebf).

Files with missing lines Patch % Lines
internal/gatewayapi/helpers.go 18.18% 15 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4782      +/-   ##
==========================================
+ Coverage   65.60%   65.66%   +0.06%     
==========================================
  Files         211      211              
  Lines       31982    32030      +48     
==========================================
+ Hits        20983    21034      +51     
+ Misses       9758     9757       -1     
+ Partials     1241     1239       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -463,6 +463,7 @@ func (t *Translator) addRouteToRouteConfig(
ea := &ExtraArgs{
metrics: metrics,
http1Settings: httpListener.HTTP1,
ipFamily: httpListener.IPFamily,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is incorrect, you are using the listener level IPFamily value in the cluster
you should be deriving this value using a new IPFamily field in
https://github.com/envoyproxy/gateway/blame/48a0310082ceeaf4d3af17e6b6844c7d0fb5db0b/internal/ir/xds.go#L1297 instead and this should be set in the gateway api layer using the Backend Service / EndpointSlice info

Copy link
Contributor Author

@juwon8891 juwon8891 Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback! I’ve updated the code to use a new IPFamily field
cc @zirain

@zirain zirain changed the title chore: fix ipFamily always nil xds: fix ipFamily always nil Nov 27, 2024
@juwon8891 juwon8891 force-pushed the always-nil branch 2 times, most recently from f620e41 to 64f4832 Compare November 27, 2024 07:58
@@ -1261,9 +1261,11 @@ func (t *Translator) processDestination(backendRefContext BackendRefContext,
Protocol: protocol,
Endpoints: endpoints,
AddressType: addrType,
IPFamily: getIPFamily(envoyProxy),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getIPFamily gets the value from the envoyProxy which is the listener's IP Family, not the backend's. This value should be coming from https://kubernetes.io/docs/concepts/services-networking/dual-stack/#dual-stack-service-configuration-scenarios

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback! I’ve updated the code to use a new IPFamily field
cc @zirain

@@ -465,6 +465,10 @@ func (t *Translator) addRouteToRouteConfig(
http1Settings: httpListener.HTTP1,
}

if len(httpRoute.Destination.Settings) > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to have different IPFamily in destination settings?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's possible to have different IPFamily settings in destination configurations. I've also added test cases to confirm this behavior.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should can complete IPFamily from all destinations:

  1. if all v4, use v4
  2. if all v6, use v6
  3. if has both, use Dual?

cc @arkodg , WDYT?

Signed-off-by: Juwon Hwang (Kevin) <[email protected]>
Signed-off-by: Juwon Hwang (Kevin) <[email protected]>
Signed-off-by: Juwon Hwang (Kevin) <[email protected]>
Signed-off-by: Juwon Hwang (Kevin) <[email protected]>
Signed-off-by: Juwon Hwang (Kevin) <[email protected]>
Signed-off-by: Juwon Hwang (Kevin) <[email protected]>
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.

xdsClusterArgs.ipFamily always nil
3 participants