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

feat: Implement disableMergeSlashes and escapedSlashesAction #2413

Merged
merged 2 commits into from
Jan 10, 2024

Conversation

liorokman
Copy link
Contributor

What this PR does / why we need it:
This PR implements the APIs added in #2384

@liorokman liorokman requested a review from a team as a code owner January 6, 2024 08:23
Copy link

codecov bot commented Jan 6, 2024

Codecov Report

Attention: 10 lines in your changes are missing coverage. Please review.

Comparison is base (316a0a2) 64.67% compared to head (f105701) 64.66%.

Files Patch % Lines
internal/ir/zz_generated.deepcopy.go 10.00% 9 Missing ⚠️
internal/xds/translator/listener.go 93.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2413      +/-   ##
==========================================
- Coverage   64.67%   64.66%   -0.01%     
==========================================
  Files         115      115              
  Lines       17326    17364      +38     
==========================================
+ Hits        11206    11229      +23     
- Misses       5409     5423      +14     
- Partials      711      712       +1     

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

@@ -207,6 +207,8 @@ type HTTPListener struct {
// HTTP3 provides HTTP/3 configuration on the listener.
// +optional
HTTP3 *HTTP3Settings `json:"http3,omitempty"`
// Path contains settings for path URI manipulations
Path PathSettings `json:"path,omitempty"`
Copy link
Contributor

@shawnh2 shawnh2 Jan 6, 2024

Choose a reason for hiding this comment

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

ptr type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't make sense to have a pointer here. This is not an optional structure.

Copy link
Contributor

Choose a reason for hiding this comment

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

oops, my bad, not noticing

@@ -262,6 +264,22 @@ func (t TLSListenerConfig) Validate() error {
return errs
}

type PathEscapedSlashAction egv1a1.PathEscapedSlashAction
Copy link
Contributor

Choose a reason for hiding this comment

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

why not using egv1a1.PathEscapedSlashAction directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because if I use it directly, I would need to import egv1a1 into the XDS layer in order to translate the API constants into XDS constants.

@@ -104,6 +104,10 @@ func (t *Translator) ProcessListeners(gateways []*GatewayContext, xdsIR XdsIRMap
Address: "0.0.0.0",
Port: uint32(containerPort),
TLS: irTLSConfigs(listener.tlsSecrets),
Path: ir.PathSettings{
Copy link
Contributor

Choose a reason for hiding this comment

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

maintaining logic in two places in the gatewayapi layer may be harder to reason with for the next dev trying to figure out translation, thoughts ?
instead if ir.path is nil, the xds translator layer could set defaults

Copy link
Contributor Author

Choose a reason for hiding this comment

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

maintaining logic in two places in the gatewayapi layer may be harder to reason with for the next dev trying to figure out translation, thoughts ?

I think the IR should encapsulate what is expected of the XDS layer, and all defaults should be set in the IR layer. There should be no magic translations happening in the XDS layer - XDS translation should be a technical translation without filling in any controlled attribute.

instead if ir.path is nil, the xds translator layer could set defaults

By that logic, should I also remove the Address default of 0.0.0.0 in this structure (multiple places in the gatewayapi folder) and the default path being set in processAccessLog?

arkodg
arkodg previously approved these changes Jan 9, 2024
@zirain zirain merged commit e1f745f into envoyproxy:main Jan 10, 2024
17 checks passed
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.

4 participants