-
Notifications
You must be signed in to change notification settings - Fork 689
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
Stops route sorting on HTTPProxy
CRD
#5772
Conversation
Contour generates the Envoy routes for each virtual host in the same order as they are in the `HTTPProxy`. This benefits users from having no suprises between the Envoy actual routing table and what they described in the CRD. * Change the underlying data structure in `dag.go` `VirtualHost` to be a slice such that we can maintain the order. * Change the sorting to be conditional on the caller wanting it. This is used to implement sorting for virtual hosts which are "partially" controlled by an Ingress so we can have ingress conformance. * Change the implementation of `expandPrefixMatches` to maintain the order of the original list. mechanical to switch it to do it. I don't have a strong opinion. I would prefer if we didnt but I am not familiar with any conformance requirements. I believe this would be a lot of work given the tests but I am not sure what the spec requires. Signed-off-by: Sotiris Nanopoulos <sotiris.nanopoulos@reddit.com>
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #5772 +/- ##
==========================================
- Coverage 78.56% 78.54% -0.03%
==========================================
Files 139 139
Lines 19614 19619 +5
==========================================
Hits 15410 15410
- Misses 3901 3906 +5
Partials 303 303
|
The Contour project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to the #contour channel in the Kubernetes Slack |
Signed-off-by: Sotiris Nanopoulos <sotiris.nanopoulos@reddit.com>
Signed-off-by: Sotiris Nanopoulos <sotiris.nanopoulos@reddit.com>
Not stale |
Signed-off-by: Sotiris Nanopoulos <sotiris.nanopoulos@reddit.com>
Signed-off-by: Sotiris Nanopoulos <sotiris.nanopoulos@reddit.com>
Signed-off-by: Sotiris Nanopoulos <sotiris.nanopoulos@reddit.com>
Signed-off-by: Sotiris Nanopoulos <sotiris.nanopoulos@reddit.com>
Signed-off-by: Sotiris Nanopoulos <sotiris.nanopoulos@reddit.com>
|
||
// Allows cluster operators to prevent the processor from sorting the routes | ||
// before sending them to Envoy. | ||
ShouldSortRoutes bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to try to keep this logic out of the various processors as much as possible and try to only make changes at the dag or xdscache level
e.g. we could have this sort of config on the dag.Builder
that would get passed down to dag.DAG.EnsureVirtualHost
and eventually dag.VirtualHost.AddRoute
to abstract this away from the processors (which tbh should maybe be in their own package at this point)
theoretically the processors should already be adding routes in list-order, and I thought we already did process includes in depth-first order, based on this recursion:
contour/internal/dag/httpproxy_processor.go
Line 726 in 6917d85
routes = append(routes, p.computeRoutes(incValidCond, rootProxy, includedProxy, append(conditions, include.Conditions...), visited, enforceTLS, defaultJWTProvider)...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
based on the different dag builder/DAG options, we could maybe keep both a list and map structures for routes on a vhost and only use one of the two based on the passed in config
just off the top of my head thoughts, not fully formed yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am open to the idea, still need to marinate the ramifications on test coverage for this. That being said I am not sure
how this would work because:
EnsureVirtualHost
which effectively constructs the vhost is not aware of the caller. And we have 3 cases
- The caller is an HTTPProxy with controller in
omitRoute
mode: in which case it should set it tofalse
- The caller is an Ingress with controller in
omitRoute
mode: in which case it should set it totrue
- The caller is an Ingress and an HTTPProxy with controller in
omitRoute
mode: in which case it should set it tofalse
So in that case it seems to me that it is the responsibility of the processor to communicate its preference. Basically the processor is aware
of the conformance requirements and declares if it needs them for the vhost
that it manages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
theoretically the processors should already be adding routes in list-order, and I thought we already did process includes in depth-first order, based on this recursion:
😅 actually they werent because expandPrefixMatches
was using a match internally and that re-ordered all routes
Signed-off-by: Sotiris Nanopoulos <sotiris.nanopoulos@reddit.com>
Signed-off-by: Sotiris Nanopoulos <sotiris.nanopoulos@reddit.com>
Signed-off-by: Sotiris Nanopoulos <sotiris.nanopoulos@reddit.com>
Signed-off-by: Sotiris Nanopoulos <sotiris.nanopoulos@reddit.com>
Signed-off-by: Sotiris Nanopoulos <sotiris.nanopoulos@reddit.com>
The Contour project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to the #contour channel in the Kubernetes Slack |
Stops route sorting on
HTTPProxy
CRDGoal:
Contour generates the Envoy routes for each virtual host in the same
order as they are in the
HTTPProxy
. This benefits users from having nosuprises between the Envoy actual routing table and what they described in the
CRD.
Core changes:
dag.go
andVirtualHost
to be a slice such that we can maintain the order.expandPrefixMatches
to maintain the order of the original list.Work Pending
Signed-off-by: Sotiris Nanopoulos sotiris.nanopoulos@reddit.com