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

refactor: ir.TCPListener to support one to many listener to routes #1798

Closed
wants to merge 5 commits into from

Conversation

dboslee
Copy link
Contributor

@dboslee dboslee commented Aug 18, 2023

What this PR does / why we need it:
This change refactors the ir.TCPListener to be named directly after the corresponding gateway listener. The tcp/tls routes map to TCPRoutes attached to the TCPListener.

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

Signed-off-by: David Boslee <david@goteleport.com>
@dboslee dboslee requested a review from a team as a code owner August 18, 2023 21:36
@codecov
Copy link

codecov bot commented Aug 18, 2023

Codecov Report

Merging #1798 (cc2f5a7) into main (14a395a) will decrease coverage by 0.20%.
The diff coverage is 71.02%.

@@            Coverage Diff             @@
##             main    #1798      +/-   ##
==========================================
- Coverage   66.12%   65.93%   -0.20%     
==========================================
  Files          86       86              
  Lines       12868    12898      +30     
==========================================
- Hits         8509     8504       -5     
- Misses       3832     3864      +32     
- Partials      527      530       +3     
Files Changed Coverage Δ
internal/ir/zz_generated.deepcopy.go 13.17% <5.00%> (-0.30%) ⬇️
internal/xds/translator/translator.go 80.00% <68.42%> (+0.07%) ⬆️
internal/xds/translator/listener.go 82.75% <71.42%> (ø)
internal/ir/xds.go 73.57% <75.00%> (-0.11%) ⬇️
internal/gatewayapi/route.go 88.30% <97.36%> (-0.09%) ⬇️
internal/gatewayapi/helpers.go 81.13% <100.00%> (ø)
internal/gatewayapi/listener.go 97.87% <100.00%> (+0.08%) ⬆️

... and 2 files with indirect coverage changes

Signed-off-by: David Boslee <david@goteleport.com>
@arkodg
Copy link
Contributor

arkodg commented Aug 18, 2023

thanks for fixing this, heads up, there are 2 PRs approved and ready to be merged #1702 #1788 that might require rebasing here.
pro tip, a quick way to generate golden test file data is to run make testdata, looks like youve already found it 🎉

@dboslee dboslee changed the title refactor: ir.TLSListener to support one to many listener to routes refactor: ir.TCPListener to support one to many listener to routes Aug 21, 2023
Signed-off-by: David Boslee <david@goteleport.com>
return fmt.Sprintf("%s/%s/%s", listener.gateway.Namespace, listener.gateway.Name, listener.Name)
}

func irTLSListenerName(listener *ListenerContext, tlsRoute *TLSRouteContext) string {
func irTLSRouteName(listener *ListenerContext, tlsRoute *TLSRouteContext) string {
Copy link
Contributor

Choose a reason for hiding this comment

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

does listener need to be part of the name, can this helper look more like irRouteName w/o the the matchIdx

return fmt.Sprintf("%s/%s/%s/%s", listener.gateway.Namespace, listener.gateway.Name, listener.Name, tlsRoute.Name)
}

func irTCPListenerName(listener *ListenerContext, tcpRoute *TCPRouteContext) string {
func irTCPRouteName(listener *ListenerContext, tcpRoute *TCPRouteContext) string {
Copy link
Contributor

Choose a reason for hiding this comment

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

does listener need to be part of the name, can this helper look more like irRouteName w/o the the matchIdx

@@ -119,6 +119,13 @@ func (t *Translator) ProcessListeners(gateways []*GatewayContext, xdsIR XdsIRMap
irListener.Hostnames = append(irListener.Hostnames, "*")
}
gwXdsIR.HTTP = append(gwXdsIR.HTTP, irListener)
case v1beta1.TCPProtocolType, v1beta1.TLSProtocolType:
Copy link
Contributor

Choose a reason for hiding this comment

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

@@ -679,7 +679,16 @@ type TCPListener struct {
Address string `json:"address" yaml:"address"`
// Port on which the service can be expected to be accessed by clients.
Port uint32 `json:"port" yaml:"port"`
// TLS holds information for configuring TLS on a listener
// Routes associated with TCP traffic to the listener.
Routes []*TCPRoute `json:"routes" yaml:"routes"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Routes []*TCPRoute `json:"routes" yaml:"routes"`
Routes []*TCPRoute `json:"routes,omitempty" yaml:"routes,omitempty"`

@arkodg
Copy link
Contributor

arkodg commented Aug 23, 2023

thanks @dboslee, looks mostly good, added some comments

@dboslee
Copy link
Contributor Author

dboslee commented Sep 7, 2023

Was OOO, I will circle back to this in the next few days.

@arkodg
Copy link
Contributor

arkodg commented Sep 12, 2023

np thanks @dboslee

@arkodg
Copy link
Contributor

arkodg commented Oct 10, 2023

@dboslee checking in to see if you are still actively working on this PR

arkodg added a commit to arkodg/gateway that referenced this pull request Oct 17, 2023
Takes forward PR envoyproxy#1798

Fixes: envoyproxy#1635

Signed-off-by: Arko Dasgupta <arko@tetrate.io>
arkodg added a commit to arkodg/gateway that referenced this pull request Oct 26, 2023
Takes forward PR envoyproxy#1798

Fixes: envoyproxy#1635

Signed-off-by: Arko Dasgupta <arko@tetrate.io>
Copy link

github-actions bot commented Nov 9, 2023

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. Please feel free to give a status update now, ping for review, when it's ready. Thank you for your contributions!

@github-actions github-actions bot added the stale label Nov 9, 2023
arkodg added a commit to arkodg/gateway that referenced this pull request Nov 14, 2023
Takes forward PR envoyproxy#1798

Fixes: envoyproxy#1635

Signed-off-by: Arko Dasgupta <arko@tetrate.io>
arkodg added a commit to arkodg/gateway that referenced this pull request Nov 15, 2023
Takes forward PR envoyproxy#1798

Fixes: envoyproxy#1635

Signed-off-by: Arko Dasgupta <arko@tetrate.io>
aoledk pushed a commit to aoledk/gateway that referenced this pull request Apr 25, 2024
Takes forward PR envoyproxy#1798

Fixes: envoyproxy#1635

Signed-off-by: Arko Dasgupta <arko@tetrate.io>
aoledk pushed a commit to aoledk/gateway that referenced this pull request Apr 25, 2024
Takes forward PR envoyproxy#1798

Fixes: envoyproxy#1635

Signed-off-by: Arko Dasgupta <arko@tetrate.io>
@arkodg
Copy link
Contributor

arkodg commented Apr 25, 2024

closing in favor of #3271

@arkodg arkodg closed this Apr 25, 2024
arkodg added a commit that referenced this pull request May 6, 2024
* Refactor IR creation for TLSRoute

Takes forward PR #1798

Fixes: #1635

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* pass lint

Signed-off-by: Dingkang Li <dingkang1743@gmail.com>

---------

Signed-off-by: Arko Dasgupta <arko@tetrate.io>
Signed-off-by: Dingkang Li <dingkang1743@gmail.com>
Co-authored-by: Arko Dasgupta <arko@tetrate.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor Xds Listener for TLSRoutes
3 participants