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: add HTTPRoute-rule name to envoy route metadata #4561

Merged
merged 5 commits into from
Nov 7, 2024

Conversation

Ido-Itz
Copy link
Contributor

@Ido-Itz Ido-Itz commented Oct 29, 2024

This PR adds route rule names to the Envoy route metadata (section-name) as described in #4551

This will allow various runtime flows (such as access logging) to have awareness of the matched route-rule.

Fixes #4551

Release Notes: No

@Ido-Itz Ido-Itz requested a review from a team as a code owner October 29, 2024 08:03
@Ido-Itz Ido-Itz changed the title feat: add HTTPRoute-rule name to envoy route metadata Feat: add HTTPRoute-rule name to envoy route metadata Oct 29, 2024
@lsjostro
Copy link
Contributor

would this mean I can target a http route rule section with a securitypolicy?
like this?

apiVersion: gateway.envoyproxy.io/v1alpha1
kind: SecurityPolicy
metadata:
  name: ext-auth-foo
spec:
  targetRefs:
    - group: gateway.networking.k8s.io
      kind: HTTPRoute
      name: foobar
      sectionName: mainRule
  extAuth:
    grpc:
      backendRefs:
        - name: authserver
          namespace: authserver
          port: 8080

Copy link

codecov bot commented Oct 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@44408dd). Learn more about missing BASE report.
Report is 12 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4561   +/-   ##
=======================================
  Coverage        ?   65.58%           
=======================================
  Files           ?      211           
  Lines           ?    31951           
  Branches        ?        0           
=======================================
  Hits            ?    20955           
  Misses          ?     9754           
  Partials        ?     1242           

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

guydc
guydc previously approved these changes Oct 29, 2024
Copy link
Contributor

@guydc guydc left a comment

Choose a reason for hiding this comment

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

LGTM

@guydc
Copy link
Contributor

guydc commented Oct 29, 2024

would this mean I can target a http route rule section with a securitypolicy?

@lsjostro - not yet. That is being tracked here #4085

@Ido-Itz
Copy link
Contributor Author

Ido-Itz commented Oct 29, 2024

/retest

@@ -362,6 +362,10 @@ func (t *Translator) processHTTPRouteRule(httpRoute *HTTPRouteContext, ruleIdx i
Name: irRouteName(httpRoute, ruleIdx, matchIdx),
SessionPersistence: sessionPersistence,
}
irRoute.Metadata = buildRouteMetadata(httpRoute)
if rule.Name != nil {
irRoute.Metadata.SectionName = string(*rule.Name)
Copy link
Member

@zhaohuabing zhaohuabing Oct 30, 2024

Choose a reason for hiding this comment

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

I didn't see the SectionName in the testdata outpout file. Did I miss anything?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right. I missed the scenario of matcher-less routes :p

@Ido-Itz
Copy link
Contributor Author

Ido-Itz commented Nov 5, 2024

Fixed the issue of routes with no matchers + added support for gRPC routes as well

@guydc guydc requested a review from zhaohuabing November 7, 2024 18:05
@arkodg arkodg merged commit a9636c8 into envoyproxy:main Nov 7, 2024
24 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.

Add route-rule name to xDS route metadata
5 participants