rough draft of client policy traffic splitting#2021
Merged
hawkw merged 3 commits intoeliza/client-policy-apifrom Dec 6, 2022
Merged
rough draft of client policy traffic splitting#2021hawkw merged 3 commits intoeliza/client-policy-apifrom
hawkw merged 3 commits intoeliza/client-policy-apifrom
Conversation
This was referenced Dec 1, 2022
hawkw
added a commit
that referenced
this pull request
Dec 6, 2022
This branch adds a rough draft of a router for selecting client policy routes. Right now, once a route is selected, it just gets logged as a demo that route matching works. A follow-up PR will implement HTTPRoute traffic splitting once a route is matched. Depends on #2021
hawkw
added a commit
that referenced
this pull request
Dec 6, 2022
Depends on #2029 This branch builds on #2021 and #2029 to implement traffic splitting based on client policy HTTPRoute backends. This is everything necessary to implement header-based routing using HTTPRoutes, by creating a route that matches a header and routes to a different `backendRef`. In addition, this means that we can also now do other forms of traffic splitting (such as weights) with a HTTPRoute, as well. The implementation here is pretty straightforward. Currently, the traffic split middleware that's used for ServiceProfile traffic splits (and for the top-level list of backends in a client policy lookup, which are currently not used by the control plane) requires dynamically updating the split service when the set of backends in the traffic split changes. In the per-HTTPRoute case, however, this is not necessary, as the set of HTTPRoutes is being watched by the client policy router, and the whole stack for a route will be torn down and rebuilt if that route's definition changes. Therefore, I've factored out the fixed component of the traffic split (just shifting traffic across a weighted distribution of services) from the dynamically updating component, so that the client policy HTTPRoute traffic split can just build and destroy fixed split middlewares. The dynamically changing traffic split middleware is now implemented by mutating an inner fixed split middleware.
hawkw
added a commit
that referenced
this pull request
Dec 6, 2022
Depends on #1992 This branch adds a very rough implementation of traffic splitting based on client policy backends. Client policy traffic splitting is implemented by moving the existing traffic split implementation into the `linkerd-client-policy` crate, and changing it to operate on the `Backend` type. The `Target` struct stored in a ServiceProfile are replaced with the `Backend` type, so that the same traffic split layer can work with a list of backends provided by either a client policy or a ServiceProfile. The `Logical` target type has a new impl of `Param<Vec<Backend>>` and `Param<BackendStream>` that chooses whether to return backends from the client policy discovery or the ServiceProfile based on whether or not a client policy was discovered for that logical destination. This could use some polish, and some cases aren't yet implemented (client policy backends may be either a named address _or_ a direct endpoint address, which is not supported by ServiceProfiles, so we'll need to add additional switching code to handle that case). However, this should be a decent working steelthread.
hawkw
added a commit
that referenced
this pull request
Dec 6, 2022
This branch adds a rough draft of a router for selecting client policy routes. Right now, once a route is selected, it just gets logged as a demo that route matching works. A follow-up PR will implement HTTPRoute traffic splitting once a route is matched. Depends on #2021
hawkw
added a commit
that referenced
this pull request
Dec 6, 2022
This branch adds a rough draft of a router for selecting client policy routes. Right now, once a route is selected, it just gets logged as a demo that route matching works. A follow-up PR will implement HTTPRoute traffic splitting once a route is matched. Depends on #2021
hawkw
added a commit
that referenced
this pull request
Dec 6, 2022
Depends on #2029 This branch builds on #2021 and #2029 to implement traffic splitting based on client policy HTTPRoute backends. This is everything necessary to implement header-based routing using HTTPRoutes, by creating a route that matches a header and routes to a different `backendRef`. In addition, this means that we can also now do other forms of traffic splitting (such as weights) with a HTTPRoute, as well. The implementation here is pretty straightforward. Currently, the traffic split middleware that's used for ServiceProfile traffic splits (and for the top-level list of backends in a client policy lookup, which are currently not used by the control plane) requires dynamically updating the split service when the set of backends in the traffic split changes. In the per-HTTPRoute case, however, this is not necessary, as the set of HTTPRoutes is being watched by the client policy router, and the whole stack for a route will be torn down and rebuilt if that route's definition changes. Therefore, I've factored out the fixed component of the traffic split (just shifting traffic across a weighted distribution of services) from the dynamically updating component, so that the client policy HTTPRoute traffic split can just build and destroy fixed split middlewares. The dynamically changing traffic split middleware is now implemented by mutating an inner fixed split middleware.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #1992
This branch adds a very rough implementation of traffic splitting based
on client policy backends.
Client policy traffic splitting is implemented by moving the existing
traffic split implementation into the
linkerd-client-policycrate, andchanging it to operate on the
Backendtype. TheTargetstruct storedin a ServiceProfile are replaced with the
Backendtype, so that thesame traffic split layer can work with a list of backends provided by
either a client policy or a ServiceProfile. The
Logicaltarget typehas a new impl of
Param<Vec<Backend>>andParam<BackendStream>thatchooses whether to return backends from the client policy discovery or
the ServiceProfile based on whether or not a client policy was
discovered for that logical destination.
This could use some polish, and some cases aren't yet implemented
(client policy backends may be either a named address or a direct
endpoint address, which is not supported by ServiceProfiles, so we'll
need to add additional switching code to handle that case). However,
this should be a decent working steelthread.