gateway icon indicating copy to clipboard operation
gateway copied to clipboard

feat: add ipv4/ipv6 dual stack support

Open juwon8891 opened this issue 1 year ago • 6 comments

What type of PR is this?

feat: add ipv4/ipv6 dual stack support

What this PR does / why we need it: This PR adds IPv4/IPv6 dual stack support to Envoy Gateway. It implements test cases for routing to IPv6-only, dual-stack, and IPv4-only services using HTTPRoute resources. This enhancement is crucial for supporting modern network environments and ensuring compatibility with both IPv4 and IPv6 infrastructures.

Key changes include:

  1. New test file backend_dualstack.go for testing IPv6 and dual-stack backends
  2. New test file httproute_dualstack.go for testing HTTPRoute support with various IP versions
  3. New manifest files for defining resources used in dual-stack tests
  4. Implementation of getDnsLookupFamily function to control DNS lookup behavior

Which issue(s) this PR fixes:

Fixes #184

Additional Notes:

  • Tests are skipped in IPv4-only environments (IP_FAMILY=ipv4)
  • All tests run in IPv6 or dual-stack environments (IP_FAMILY=ipv6 or IP_FAMILY=dual)

juwon8891 avatar Sep 30 '24 16:09 juwon8891

hey @juwon8891 we probably also need to add some logic in https://github.com/envoyproxy/gateway/blob/4b8c2f56dc45534c42b6513b126082f49a009658/internal/gatewayapi/route.go#L1328 which selects specific endpoints based on the ipFamilyPolicy field

arkodg avatar Sep 30 '24 21:09 arkodg

Codecov Report

Attention: Patch coverage is 61.11111% with 7 lines in your changes missing coverage. Please review.

Project coverage is 65.80%. Comparing base (7188dad) to head (faa584b).

Files with missing lines Patch % Lines
internal/gatewayapi/helpers.go 36.36% 7 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4375      +/-   ##
==========================================
+ Coverage   65.78%   65.80%   +0.02%     
==========================================
  Files         210      210              
  Lines       31516    31557      +41     
==========================================
+ Hits        20732    20766      +34     
- Misses       9588     9594       +6     
- Partials     1196     1197       +1     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Oct 07 '24 13:10 codecov[bot]

hey @juwon8891 lint is failing


internal/xds/translator/testdata/in/xds-ir/tcp-listener-ipfamily.yaml
  Error: 7:5 [indentation] wrong indentation: expected 6 but found 4
  Error: 11:9 [indentation] wrong indentation: expected 10 but found 8
  Error: 12:11 [indentation] wrong indentation: expected 12 but found 10
  Error: 13:32 [new-line-at-end-of-file] no new line character at the end of file

arkodg avatar Oct 07 '24 23:10 arkodg

hey @juwon8891 looks like some gateway api tests got wiped out, can you add them back ?

arkodg avatar Oct 09 '24 05:10 arkodg

@juwon8891 Do you have time to address the comments this week? We want to ensure dual stack support is ready to be included in the coming v1.2.

zhaohuabing avatar Oct 14 '24 23:10 zhaohuabing

Yes, I'm working on it. I'll answer as soon as possible

juwon8891 avatar Oct 15 '24 00:10 juwon8891

hey @juwon8891, added some minor comments, but overall LGTM !

arkodg avatar Oct 22 '24 01:10 arkodg

@juwon8891 please run make gen-check to pass the gen-check CI.

zirain avatar Oct 22 '24 08:10 zirain

@juwon8891 DCO is failing, can you sign your commits

arkodg avatar Oct 22 '24 16:10 arkodg

/retest

guydc avatar Oct 24 '24 21:10 guydc