Skip to content

docs: Conceptual documentation for CTP, BTP, SecurityPolicy & Gateway API Extensions#5946

Closed
melsal13 wants to merge 10 commits intoenvoyproxy:mainfrom
melsal13:docs-con-ctp-btp
Closed

docs: Conceptual documentation for CTP, BTP, SecurityPolicy & Gateway API Extensions#5946
melsal13 wants to merge 10 commits intoenvoyproxy:mainfrom
melsal13:docs-con-ctp-btp

Conversation

@melsal13
Copy link
Contributor

@melsal13 melsal13 commented May 7, 2025

What type of PR is this?
Conceptual documentation explaining ClientTrafficPolicy, BackendTrafficPolicy, SecurityPolicy and Gateway API Extensions.

What this PR does / why we need it:
Helps onboard new users.

Which issue(s) this PR fixes:
Fixes #2070
Fixes #5949
Fixes #2072
Fixes #5948

Release Notes: No

melsal13 added 5 commits May 6, 2025 11:59
Signed-off-by: melsal13 <mmvsal13@gmail.com>
Signed-off-by: melsal13 <mmvsal13@gmail.com>
Signed-off-by: melsal13 <mmvsal13@gmail.com>
Signed-off-by: melsal13 <mmvsal13@gmail.com>
@codecov
Copy link

codecov bot commented May 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 65.86%. Comparing base (da98c66) to head (6e429ca).
Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5946      +/-   ##
==========================================
+ Coverage   65.82%   65.86%   +0.03%     
==========================================
  Files         217      217              
  Lines       36016    36020       +4     
==========================================
+ Hits        23709    23726      +17     
+ Misses      10832    10818      -14     
- Partials     1475     1476       +1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

melsal13 added 2 commits May 7, 2025 13:46
Signed-off-by: melsal13 <mmvsal13@gmail.com>
Signed-off-by: melsal13 <mmvsal13@gmail.com>
@melsal13 melsal13 changed the title docs: Conceptual documentation for CTP, BTP & Gateway Extensions docs: Conceptual documentation for CTP, BTP, SecurityPolicy & Gateway API Extensions May 7, 2025
update branch with changes from upstream
@melsal13 melsal13 marked this pull request as ready for review May 7, 2025 21:59
@melsal13 melsal13 requested a review from a team as a code owner May 7, 2025 21:59

Lastly, it's important to note that even when you apply a policy to a Gateway, the policy's effects are tracked separately for each backend service referenced in your routes. For example, if you set up circuit breaking on a Gateway with multiple backend services, each backend service will have its own independent circuit breaker counter. This ensures that issues with one backend service don't affect the others.

## Best Practices
Copy link
Contributor

Choose a reason for hiding this comment

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

imo best practices without being prescriptive is not very helpful

Copy link
Contributor

Choose a reason for hiding this comment

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

lets add it once each step can be computed using a cmd

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense! Considering removing Best Practices section from concept template completely.

Copy link
Contributor

Choose a reason for hiding this comment

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

great, can we track that with a GH issue


`BackendTrafficPolicy` is part of the Envoy Gateway API suite, which extends the Kubernetes Gateway API with additional capabilities. It's implemented as a Custom Resource Definition (CRD) that you can use to configure how Envoy Gateway manages traffic to your backend services.

`BackendTrafficPolicy` uses the `targetRefs` field to specify which Gateway API resources the policy should apply to. You can target:
Copy link
Contributor

Choose a reason for hiding this comment

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

or targetSelectors to specify using labels

- A Gateway: to apply the policy to all routes in that gateway
- A specific Route (HTTPRoute or GRPCRoute): to apply the policy to that route's traffic

When multiple policies target the same resource, the most specific configuration wins.
Copy link
Contributor

Choose a reason for hiding this comment

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

example explaining this would be very helpful

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added examples to CTP, BTP and SP


## Overview

`ClientTrafficPolicy` is an extension to the Kubernetes Gateway API that controls how Envoy Gateway handles incoming traffic from clients. It can configure connection behavior, security settings, and protocol optimizations at the gateway level.
Copy link
Contributor

Choose a reason for hiding this comment

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

lets rm security settings from here

Copy link
Contributor

Choose a reason for hiding this comment

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

instead of protocol optimizations, can we say protocol specific configuration

Copy link
Contributor

Choose a reason for hiding this comment

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

my bad things, there's a section on tls in there, can we explicitly say TLS settings instead


`ClientTrafficPolicy` is an extension to the Kubernetes Gateway API that controls how Envoy Gateway handles incoming traffic from clients. It can configure connection behavior, security settings, and protocol optimizations at the gateway level.

It can act as a gatekeeper that manages how external clients connect to your services, helping you maintain security, performance, and stability.
Copy link
Contributor

Choose a reason for hiding this comment

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

this isnt right, its similar to a traffic controller analogy that you used for BTP, but b/w external clients and the gateway

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated and referenced the doc you provided!

`ClientTrafficPolicy` is particularly useful in scenarios where you need to:

- **Strengthen security:** Implement IP allow/deny lists and authenticate clients with mutual TLS
- **Optimize performance:** Enable HTTP/3 and fine-tune connection settings
Copy link
Contributor

Choose a reason for hiding this comment

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

this entire section doesnt look right

Copy link
Contributor

Choose a reason for hiding this comment

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

I copied the API content into chatgpt, here's what I got, which we got further tweak


1. Enforcing Secure Client Connections
When TLS termination is required at the edge, tls settings enable enforcement of secure protocols, mutual TLS (mTLS), and certificate validation policies to protect internal workloads.

2. Managing Long-Lived Connections
For applications that rely on persistent connections (e.g., IoT or streaming APIs), the tcpKeepalive field enables fine-tuned control of TCP keepalive behavior, helping to detect broken client connections and optimize resource usage.

4. Reliable Client IP Detection
With the clientIPDetection field, platform admins can configure trusted proxy chains to correctly resolve the client IP, improving audit logs and geo-based access control.

5. Path Normalization and Routing Safety
The path settings allow normalization or sanitization of incoming request paths, reducing ambiguity and ensuring compatibility with backend routing rules.

7. Fine-Tuned Connection Timeouts
The timeout field is useful for customizing idle timeouts, read timeouts, and handshake durations based on application latency characteristics.

8. Controlling HTTP Protocol Behavior
The http1, http2, and http3 sections enable protocol-specific tuning, essential for compatibility and performance tuning across clients.

9. Active Listener Health Checks
The healthCheck field provides configuration for proactive health signaling of listeners, allowing integration with load balancers and automated failover mechanisms.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated your suggestion to :

  1. Enforce TLS Security
    Configure TLS termination, mutual TLS (mTLS), and certificate validation at the edge.

  2. Manage Client Connections
    Control TCP keepalive behavior and connection timeouts for optimal resource usage.

  3. Handle Client Identity
    Configure trusted proxy chains to correctly resolve client IPs for logging and access control.

  4. Normalize Request Paths
    Sanitize incoming request paths to ensure compatibility with backend routing rules.

  5. Tune HTTP Protocols
    Configure HTTP/1, HTTP/2, and HTTP/3 settings for compatibility and performance.

  6. Monitor Listener Health
    Set up health checks for integration with load balancers and failover mechanisms.


This separation ensures that different types of traffic can be managed independently while still maintaining overall control over gateway resources.

## Best Practices
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

Copy link
Contributor

Choose a reason for hiding this comment

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

re thinking, it may be best to create a new top level section called Best Practices so we can include specific things like #5851 in there


You can apply a `ClientTrafficPolicy` to a Gateway resource, and it will affect how that gateway handles client connections. The policy's effects are applied at the listener level, with some important distinctions:

- For HTTP listeners: All HTTP listeners in a Gateway share a common connection counter
Copy link
Contributor

Choose a reason for hiding this comment

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

this doesnt seem very useful


`ClientTrafficPolicy` is part of the Envoy Gateway API suite, which extends the Kubernetes Gateway API with additional capabilities. It's implemented as a Custom Resource Definition (CRD) that you can use to configure how Envoy Gateway manages incoming client traffic.

You can apply a `ClientTrafficPolicy` to a Gateway resource, and it will affect how that gateway handles client connections. The policy's effects are applied at the listener level, with some important distinctions:
Copy link
Contributor

Choose a reason for hiding this comment

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

similar to BTP, can we add a note around how things are targeted, targetRefs and targetSelectors and what can be targeted - Gateway or Listener ( by sectionName). and that Listner policy / most specific policy wins

Envoy Gateway uses a policy attachment model, where custom policies are applied to standard Gateway API resources (like HTTPRoute or Gateway) without modifying the core API. This approach provides separation of concerns and makes it easier to manage configurations across teams.

These extensions are processed through Envoy Gateway’s control plane, which translates them into xDS configurations that are applied to Envoy Proxy instances. This layered architecture allows for consistent, scalable, and production-grade traffic control without needing to manage raw Envoy configuration directly.

Copy link
Contributor

@arkodg arkodg May 8, 2025

Choose a reason for hiding this comment

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

can we explicitly name each extension with a 1 liner and add a hyperlink so they link out to concepts and API reference ?

lets add

  • EnvoyExtensionPolicy
  • EnvoyProxy
  • HTTPRouteFIlter
  • Backend

here, and we can add a Concepts page for it later

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a one liner as a note. All link to their respective api refs.

As I create more conceptual docs, I'll link them in the related resources section
Screenshot 2025-05-08 at 12 07 25 PM

Copy link
Contributor

Choose a reason for hiding this comment

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

I missed mentioning EnvoyPatchPolicy 🙈


## Overview

Gateway Extensions are mechanisms that allow implementation-specific features to be added to the Kubernetes Gateway API without modifying its core specification. They enable Gateway API implementations like Envoy Gateway to expose their unique capabilities while maintaining compatibility with the standard API. Extensions follow defined patterns that preserve the role-oriented design of Gateway API while allowing for customization to address specific use cases not covered by the core API.
Copy link
Contributor

Choose a reason for hiding this comment

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

should we have a dedicated page for Gateway API Extensions or add it under https://gateway.envoyproxy.io/docs/concepts/concepts_overview/#envoy-gateway-eg-api-resources
cc @missBerg ?

updating branch with changes from main
Signed-off-by: melsal13 <mmvsal13@gmail.com>
@melsal13
Copy link
Contributor Author

melsal13 commented May 9, 2025

Closing this pr and replacing with the following:
#5981

@melsal13 melsal13 closed this May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants