Skip to content

feat(policy): Adding BTP support for UDP/TCPRoute#3004

Merged
guydc merged 19 commits intoenvoyproxy:mainfrom
alexwo:btp_support_for_tcp_udp_routes
Mar 26, 2024
Merged

feat(policy): Adding BTP support for UDP/TCPRoute#3004
guydc merged 19 commits intoenvoyproxy:mainfrom
alexwo:btp_support_for_tcp_udp_routes

Conversation

@alexwo
Copy link
Copy Markdown
Contributor

@alexwo alexwo commented Mar 24, 2024

What this PR does / why we need it:
Enables the application of BTP rules on gateway and TCP/UDP routes.
Modifications have been incorporated into the IR mapper and XDS translator.

Adds below BTP rules for tcp and tls routes:

  • LoadBalancer
  • Timeout
  • TCPKeepalive
  • CircuitBreaker
  • HealthCheck
  • ProxyProtcol

Adds below BTP rules for UDP routes:

  • LoadBalancer
  • Timeout

Which issue(s) this PR fixes:
#2880

@alexwo alexwo changed the title feat(policy): Adding BTP support for TCPRoute feat(policy): Adding BTP support for UDP/TCPRoute Mar 24, 2024
alexwo added 3 commits March 24, 2024 18:20
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
…lexwo/gateway into btp_support_for_tcp_udp_routes

Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 24, 2024

Codecov Report

Attention: Patch coverage is 62.60870% with 43 lines in your changes are missing coverage. Please review.

Project coverage is 64.52%. Comparing base (d020ce7) to head (e047aee).

Files Patch % Lines
internal/ir/zz_generated.deepcopy.go 0.00% 28 Missing and 7 partials ⚠️
internal/gatewayapi/backendtrafficpolicy.go 84.61% 4 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3004      +/-   ##
==========================================
- Coverage   64.55%   64.52%   -0.04%     
==========================================
  Files         121      121              
  Lines       21235    21344     +109     
==========================================
+ Hits        13709    13772      +63     
- Misses       6672     6706      +34     
- Partials      854      866      +12     

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

Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
@alexwo
Copy link
Copy Markdown
Contributor Author

alexwo commented Mar 24, 2024

/retest

@alexwo alexwo marked this pull request as ready for review March 24, 2024 19:47
@alexwo alexwo requested a review from a team as a code owner March 24, 2024 19:47
@zhaohuabing
Copy link
Copy Markdown
Member

zhaohuabing commented Mar 25, 2024

Should we enforce BTP setting validation on TCP/UDP route and update the status?

For example, HTTP-related settings such as FaultInjection, Retries, etc., can't be set when the targeting xRoute is TCP/UDP route or the targeting gateway doesn't contain HTTPRoute.

@JuniorJPDJ
Copy link
Copy Markdown
Contributor

Can I also please ask to add TLSRoute support too?

@alexwo
Copy link
Copy Markdown
Contributor Author

alexwo commented Mar 25, 2024

Can I also please ask to add TLSRoute support too?
@JuniorJPDJ
This is already included in the current pull request. Once merged, It will be possible to apply BTP either to specific TLS routes or to the entire gateway.

@alexwo
Copy link
Copy Markdown
Contributor Author

alexwo commented Mar 25, 2024

Should we enforce BTP setting validation on TCP/UDP route and update the status?

For example, HTTP-related settings such as FaultInjection, Retries, etc., can't be set when the targeting xRoute is TCP/UDP route or the targeting gateway doesn't contain HTTPRoute.

Sounds good to me. Alternatively, we could update the status of each route to indicate which policies from the BTP are in effect, providing clarity to the user on how their route is affected.

Since this functionality isn't available currently, it might be best to introduce it through a separate change.
WDYT?

@zhaohuabing
Copy link
Copy Markdown
Member

Should we enforce BTP setting validation on TCP/UDP route and update the status?
For example, HTTP-related settings such as FaultInjection, Retries, etc., can't be set when the targeting xRoute is TCP/UDP route or the targeting gateway doesn't contain HTTPRoute.

Sounds good to me. Alternatively, we could update the status of each route to indicate which policies from the BTP are in effect, providing clarity to the user on how their route is affected.

Since this functionality isn't available currently, it might be best to introduce it through a separate change. WDYT?

Sounds good. Could you please raise an issue to track this?

@arkodg
Copy link
Copy Markdown
Contributor

arkodg commented Mar 26, 2024

hey @zhaohuabing we can't enforce validation here, because if the policy is applied to the Gateway, they could apply to HTTPRoutes as well as TCPRoutes

outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
upstreamConnectionOptions:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the test is for listener side keep alive, how did this config come here (cluster) ?

Copy link
Copy Markdown
Contributor Author

@alexwo alexwo Mar 26, 2024

Choose a reason for hiding this comment

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

The TCP keep-alive setting is specified in the IR, resulting in a keep-alive configuration for the TCP listener cluster. Typically, such settings are adjusted through a traffic policy, i'm not certain if this make sense in this context.

- name: "fourth-listener"
  address: "0.0.0.0"
  tcpKeepalive:
    probes: 10
  port: 10083
  destination:
    name: "tcp-route-dest"
    settings:
    - endpoints:
      - host: "1.2.3.4"
        port: 50000

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can you raise a follow up issue for this ?

}

if tcpkeepalive.Probes != nil {
if tcpkeepalive.IdleTime != nil {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thanks for catching this

if t.MergeGateways && gatewayName != policyTarget {
continue
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you probably also need some code similar to L500-510

			// If any of the features are already set, it means that a more specific
			// policy(targeting xRoute) has already set it, so we skip it.
			// TODO: zhaohuabing group the features into a struct and check if all of them are set
			if r.RateLimit != nil || r.LoadBalancer != nil ||
				r.ProxyProtocol != nil || r.HealthCheck != nil ||
				r.CircuitBreaker != nil || r.FaultInjection != nil ||
				r.TCPKeepalive != nil || r.Retry != nil ||
				r.Timeout != nil {
				continue
			}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

continue
}

udp.LoadBalancer = lb
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same as above comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

@arkodg
Copy link
Copy Markdown
Contributor

arkodg commented Mar 26, 2024

thanks for adding support for this @alexwo !

@zhaohuabing
Copy link
Copy Markdown
Member

zhaohuabing commented Mar 26, 2024

hey @zhaohuabing we can't enforce validation here, because if the policy is applied to the Gateway, they could apply to HTTPRoutes as well as TCPRoutes

Should we enforce validation when the target is a xRoute? It would be confusing if HTTP-related setting is configured for TCP/UDP route.

And it would be nice if we could allow users to know which settings in the BTP can be applied to which type of route. Probably add some comments to BTP settings?

@arkodg arkodg requested a review from a team March 26, 2024 09:50
@alexwo
Copy link
Copy Markdown
Contributor Author

alexwo commented Mar 26, 2024

/retest

1 similar comment
@alexwo
Copy link
Copy Markdown
Contributor Author

alexwo commented Mar 26, 2024

/retest

@alexwo
Copy link
Copy Markdown
Contributor Author

alexwo commented Mar 26, 2024

/retest

1 similar comment
@alexwo
Copy link
Copy Markdown
Contributor Author

alexwo commented Mar 26, 2024

/retest

guydc
guydc previously approved these changes Mar 26, 2024
@alexwo
Copy link
Copy Markdown
Contributor Author

alexwo commented Mar 26, 2024

/retest

Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
@alexwo alexwo dismissed stale reviews from guydc and arkodg via e047aee March 26, 2024 22:18
@alexwo
Copy link
Copy Markdown
Contributor Author

alexwo commented Mar 26, 2024

/retest

Copy link
Copy Markdown
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, thanks for fixing the coverage check!

@alexwo
Copy link
Copy Markdown
Contributor Author

alexwo commented Mar 26, 2024

/retest

@alexwo
Copy link
Copy Markdown
Contributor Author

alexwo commented Mar 26, 2024

/retest

@guydc
Copy link
Copy Markdown
Contributor

guydc commented Mar 26, 2024

/retest

@guydc guydc merged commit a11aa70 into envoyproxy:main Mar 26, 2024
@JuniorJPDJ
Copy link
Copy Markdown
Contributor

I just migrated to the latest commit and it works with TLSRoute! Thanks!

@alexwo alexwo deleted the btp_support_for_tcp_udp_routes branch March 27, 2024 05:09
yaelSchechter pushed a commit to yaelSchechter/envoy-gateway that referenced this pull request Mar 28, 2024
* Adding BTP support for UDP/TCP Routes

Signed-off-by: Alexander Volchok <alex.volchok@sap.com>

* fixining lint

Signed-off-by: Alexander Volchok <alex.volchok@sap.com>

* fix IdleTime check

Signed-off-by: Alexander Volchok <alex.volchok@sap.com>

* adding missing generates

Signed-off-by: Alexander Volchok <alex.volchok@sap.com>

* fixing code review comments

Signed-off-by: Alexander Volchok <alex.volchok@sap.com>

* incresing code coverage

Signed-off-by: Alexander Volchok <alex.volchok@sap.com>

---------

Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
Co-authored-by: zirain <zirain2009@gmail.com>
Co-authored-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>
arkodg added a commit that referenced this pull request Mar 28, 2024
* build(deps): bump github.com/prometheus/common from 0.50.0 to 0.51.1 (#3010)

Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.50.0 to 0.51.1.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](prometheus/common@v0.50.0...v0.51.1)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>

* docs: fix squash link (#3013)

Signed-off-by: zirain <zirain2009@gmail.com>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>

* api: support IdleTimeout in clientTrafficPolicy

Signed-off-by: Yael Shechter <yael.shechter@sap.com>

* build(deps): bump fortio.org/fortio from 1.63.4 to 1.63.5 (#3011)

Bumps [fortio.org/fortio](https://github.com/fortio/fortio) from 1.63.4 to 1.63.5.
- [Release notes](https://github.com/fortio/fortio/releases)
- [Commits](fortio/fortio@v1.63.4...v1.63.5)

---
updated-dependencies:
- dependency-name: fortio.org/fortio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>

* ci: trigger docs action (#3017)

Signed-off-by: zirain <zirain2009@gmail.com>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>

* ci: fix cherrypick permission (#2985)

Signed-off-by: zirain <zirain2009@gmail.com>
Co-authored-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>

* fix: set path prefix for http ext auth service (#3018)

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>

* feat: add Chinese language support for doc site (#2532)

* Add Chinese support for doc site

Signed-off-by: Wilson Wu <iwilsonwu@gmail.com>

* Add zh i18n for menus

Signed-off-by: Wilson Wu <iwilsonwu@gmail.com>

* Add zh content placeholders

Signed-off-by: Wilson Wu <iwilsonwu@gmail.com>

* Fix about zh page

Signed-off-by: Wilson Wu <iwilsonwu@gmail.com>

* Apply suggestions from code review

Co-authored-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: Wilson Wu <iwilsonwu@gmail.com>

* docs: `%s/Application/API/g` (#2929)

Signed-off-by: Wilson Wu <iwilsonwu@gmail.com>

* remove old version for zh content

Signed-off-by: Wilson Wu <iwilsonwu@gmail.com>

* Update the latest version link

Signed-off-by: Wilson Wu <iwilsonwu@gmail.com>

* Fix default content dir

Signed-off-by: Wilson Wu <iwilsonwu@gmail.com>

* Translate landing page and fix broken link

Signed-off-by: Wilson Wu <iwilsonwu@gmail.com>

* Fix broken link

Signed-off-by: Wilson Wu <iwilsonwu@gmail.com>

* Add a contribution page

Signed-off-by: Wilson Wu <iwilsonwu@gmail.com>

---------

Signed-off-by: Wilson Wu <iwilsonwu@gmail.com>
Co-authored-by: Huabing Zhao <zhaohuabing@gmail.com>
Co-authored-by: Arko Dasgupta <arkodg@users.noreply.github.com>
Co-authored-by: zirain <zirain2009@gmail.com>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>

* feat(translator): implement connection limit (#2952)

* implement connection limit

Signed-off-by: Guy Daich <guy.daich@sap.com>

* fix lint

Signed-off-by: Guy Daich <guy.daich@sap.com>

* fix lint 2

Signed-off-by: Guy Daich <guy.daich@sap.com>

* fix ir, coverage

Signed-off-by: Guy Daich <guy.daich@sap.com>

* fix lint 3

Signed-off-by: Guy Daich <guy.daich@sap.com>

* open more connection in e2e

Signed-off-by: Guy Daich <guy.daich@sap.com>

* fix error type

Signed-off-by: Guy Daich <guy.daich@sap.com>

* add additional connections

Signed-off-by: Guy Daich <guy.daich@sap.com>

* make limit value required

Signed-off-by: Guy Daich <guy.daich@sap.com>

* add error-flow unit test

Signed-off-by: Guy Daich <guy.daich@sap.com>

* fix lint 4

Signed-off-by: Guy Daich <guy.daich@sap.com>

* assert policy accepted in test

Signed-off-by: Guy Daich <guy.daich@sap.com>

* rename limit => connectionLimit

Signed-off-by: Guy Daich <guy.daich@sap.com>

---------

Signed-off-by: Guy Daich <guy.daich@sap.com>
Co-authored-by: zirain <zirain2009@gmail.com>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>

* docs: remove 0.1.0  from linkinator ignore list (#3015)

Signed-off-by: yuluo <karashouk.pan@gmail.com>
Co-authored-by: zirain <zirain2009@gmail.com>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>

* disable connection limit test (#3025)

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>

* fix: use correct connection limit attribute name in e2e, docs (#3028)

fix attribute name

Signed-off-by: Guy Daich <guy.daich@sap.com>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>

* docs: document patches in envoy proxy (#3027)

* docs: document patches in envoy proxy

Signed-off-by: Yael Shechter <yael.shechter@sap.com>

* fix linting issue

Signed-off-by: Yael Shechter <yael.shechter@sap.com>

* fix pr comment

Signed-off-by: Yael Shechter <yael.shechter@sap.com>

---------

Signed-off-by: Yael Shechter <yael.shechter@sap.com>

* feat(policy): Adding BTP support for UDP/TCPRoute (#3004)

* Adding BTP support for UDP/TCP Routes

Signed-off-by: Alexander Volchok <alex.volchok@sap.com>

* fixining lint

Signed-off-by: Alexander Volchok <alex.volchok@sap.com>

* fix IdleTime check

Signed-off-by: Alexander Volchok <alex.volchok@sap.com>

* adding missing generates

Signed-off-by: Alexander Volchok <alex.volchok@sap.com>

* fixing code review comments

Signed-off-by: Alexander Volchok <alex.volchok@sap.com>

* incresing code coverage

Signed-off-by: Alexander Volchok <alex.volchok@sap.com>

---------

Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
Co-authored-by: zirain <zirain2009@gmail.com>
Co-authored-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>

* fix: add missing http filters to the http filter chain (#2970)

* fix: add missing http filters to the http filter chain

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* refactor

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* fix lint

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* add comments

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* remove refactor

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* remove refactor

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* fix gen

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* fix lint

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>

---------

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>

* fix pr comment

Signed-off-by: Yael Shechter <yael.shechter@sap.com>

* ci: grant pull-requests permission to cherrypick action (#3039)

Signed-off-by: zirain <zirain2009@gmail.com>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>

* Update ADOPTERS.md for Airspace Link (#3045)

Signed-off-by: Fabrice Aneche <akhenakh@users.noreply.github.com>
Co-authored-by: zirain <zirain2009@gmail.com>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>

* feat: added option to specify resources on the OIDC security policy (#3030)

added option to specify resources on the OIDC filter

Signed-off-by: jaynis <kranz.jannis@googlemail.com>
Co-authored-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>

* run make commands

Signed-off-by: Yael Shechter <yael.shechter@sap.com>

* fix: allow websockets in url rewrite (#3022)

allow websockets in url rewrite

Signed-off-by: Jesse Haka <haka.jesse@gmail.com>
Co-authored-by: zirain <zirain2009@gmail.com>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>
Signed-off-by: zirain <zirain2009@gmail.com>
Signed-off-by: huabing zhao <zhaohuabing@gmail.com>
Signed-off-by: Wilson Wu <iwilsonwu@gmail.com>
Signed-off-by: Guy Daich <guy.daich@sap.com>
Signed-off-by: yuluo <karashouk.pan@gmail.com>
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: Fabrice Aneche <akhenakh@users.noreply.github.com>
Signed-off-by: jaynis <kranz.jannis@googlemail.com>
Signed-off-by: Jesse Haka <haka.jesse@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Huabing Zhao <zhaohuabing@gmail.com>
Co-authored-by: zirain <zirain2009@gmail.com>
Co-authored-by: Wilson Wu <iwilsonwu@gmail.com>
Co-authored-by: Arko Dasgupta <arkodg@users.noreply.github.com>
Co-authored-by: Guy Daich <guy.daich@sap.com>
Co-authored-by: YuLuo <karashouk.pan@gmail.com>
Co-authored-by: Alex Volchok <alex.volchok@sap.com>
Co-authored-by: Fabrice Aneche <akhenakh@users.noreply.github.com>
Co-authored-by: jaynis <kranz.jannis@googlemail.com>
Co-authored-by: Jesse Haka <haka.jesse@gmail.com>
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.

6 participants