You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EG can support a custom BackendRef target, which will include a priority field, such as the proposed Backend API: API: Backend #3063
EG BackendTrafficPolicy can be used to assign priorities. For example, the policy will hold a map of BackendRefs to priorities. Or, the policy can attach directly to Service resources.
This could be used to solve #1909, though it may require further refinement. Specifically, the Envoy Gateway should allocate distinct priority levels to the same upstream endpoint, varying by the Envoy Pod’s location in different availability zones. For instance, for an identical endpoint in zone A, the Envoy Pod situated in zone A should be assigned priority 0, whereas Envoy Pods in zones B and C should be assigned priority 1.
Do you think Envoy Gateway will handle this? Or leave it to the user?
Do you think Envoy Gateway will handle this? Or leave it to the user?
We briefly discussed this scenario in the community meeting. It seems like this will require pushing different config to different envoy proxies based on zone information. For the time being, we'll focus on supporting the simpler use case described above.
thanks for outlining the steps @aoledk ! we currently have #3055 open to get explicit priority per backendRef and program that into the xds cluster resource.
In the future, we can use this issue to make sure we track the auto priority work, the field in k8s preferClose could be the knob for users to say they want to opt in to this feature
@arkodg One backendRef (mainly Service) will refer to endpoints from multiple zones, priority should not be applied on backendRef, unless we use selector to collect endpoints in same zone into single backendRef.
Besides, same endpoint will have different priority in Envoy.
So maybe we can't assign a fixed priority for backendRef, codes will be needed to assign right priority for specific Envoy.
the one you've highlighted where zones represent physical locations (done for HA purposes at the node level) so location aware routing reduces overall latency as well as cost (cross zone or region can be billed by cloud provider)
creating a primary and backup backendRef for HA cases (at the app/backend level)
@arkodg Can we add a new xDS Hook API, like PostEndpointModify(ClusterLoadAssignment, Node) which allow extension server to assign endpoint priority for individual envoy. Leave these tasks to EG adopters themselves.
hey @aoledk thanks for driving this work, before we implement this, we as a community need to align on what the feature is, is it
Auto Zone Aware Routing where a user sets a global field to enable this, and envoy proxy prioritizes endpoints in the same zone based on its zone ?
Open Questions:
is this granular enough ? there are only 2 levels here - local or not local
Priorites for BackendRefs - Prioritizes one backendRef over another backendRef within the same HTTP Rule
@arkodg I've quoted your #3538 (comment) here to continue discussion about priority. I'll freeze #3542 until we reach agreement.
Assuming two cases demonstrated in image below.
Case A: priority isn't in gateway-api, EG will generate #1, #2 LocalityLbEndpoints.
Case B: priority is in gateway-api, EG will generate #3, #4, #5, #6 LocalityLbEndpoints.
Code in xds/cache will be used to modify priority for individual envoy based on envoy's running topology.
We can have 2 options to enable topology aware routing ( NOTenvoy zone aware routing ) based on priority.
Option 1
Add knob into BackendTrafficPolicy to enable topology aware routing for affected BackendRefs.
If we enable in Case A, #1, #2 LocalityLbEndpoints for envoy running in zone a will be modified by xds/cache like this:
#1 P=0
#2 P=1
If we enable in Case B, #3, #4, #5, #6 LocalityLbEndpoints for envoy running in zone a will be modified by xds/cache like this:
#3 P=0
#4 P=1
#5 P=2
#6 P=3
But this option has several challenges.
Challenge 1
The new knob is accessible in xds/translator, but xds/translator only pass xds to xds/server, then to xds/cache, a new communication channel need to be setup to pass this particular knob to xds/cache. It will add additional dependency between those modules.
Challenge 2
Should we allow user to enable topology aware routing for BackendRefs specified with priority ?
If yes, that means xds/cache will modify LocalityLbEndpoints's priority specified by user.
Option 2
Add knob into EnvoyGateway to enable topology aware routing for all BackendRefs.
If enabled, #1, #2, #3, #4, #5, #6 LocalityLbEndpoints for envoy running in zone a will be modified by xds/cache like this:
#1 P=0
#2 P=1
#3 P=0
#4 P=1
#5 P=2
#6 P=3
Challenge 1
Same to Option 1's Challenge 2.
is this granular enough ? there are only 2 levels here - local or not local
LocalityLbEndpoints can be set with region / zone / sub_zone:
zone can be retrieved from EndpointSlice directly.
region can be retrieved like this: use nodeName in EndpointSlice to query Node, retrieve region from Node topology.kubernetes.io/region label.
sub_zone` can't be retrieved.
Envoy can be set with region / zone / sub_zone.
Since Pod downward API doesn't expose Pod zone, region and zone can be retrieved like this: use nodeName via Pod downward API to query Node, retrieve region and zone from Node topology.kubernetes.io/region and topology.kubernetes.io/zone labels.
sub_zone can't be retrieved.
So region can be used as level bigger than zone technically, we can discuss whether we need to use region on topology aware routing.
Sure, we can simplify and offer the same level of flexibility as done in GCP. So that via the API layer we expose just a boolean and manage as priority at the translation layer, allowing for a priority of: primary / backup (0,1).
also @alexwo another design decision is around when does an endpoint get removed from the load balancing pool and when does it get re added ? is the user responsible for setting up healthCheck (active or passive) which results in endpoints being removed/readded from the pool ?
For non-service backends (Unix Socket, FQDN, ...) - users must to define active/passive healthchecks in order for priorities to actually have an impact.
Activity
arkodg commentedon Apr 1, 2024
ideally prefer if this was in upstream
relates to kubernetes-sigs/gateway-api#2304 & kubernetes-sigs/gateway-api#1802
arkodg commentedon Apr 3, 2024
if we add into field into non xRoute backendRefs, we may need to pluraize existing instantiations to
backendRefscc @guydc @zirain
guydc commentedon Apr 3, 2024
Yes, also ext-proc. I don't object, and this is in-line with gateway-api. Do you think that we should consider a different intermediate approach?
arkodg commentedon Apr 4, 2024
I'd vote to pluraize the backendRefs for non xRoute asap while we are in alpha, which can be a good place to test the
priority/ standby use casegithub-actions commentedon May 4, 2024
This issue has been automatically marked as stale because it has not had activity in the last 30 days.
modatwork commentedon May 9, 2024
This could be used to solve #1909, though it may require further refinement. Specifically, the Envoy Gateway should allocate distinct priority levels to the same upstream endpoint, varying by the Envoy Pod’s location in different availability zones. For instance, for an identical endpoint in zone A, the Envoy Pod situated in zone A should be assigned priority 0, whereas Envoy Pods in zones B and C should be assigned priority 1.
Do you think Envoy Gateway will handle this? Or leave it to the user?
guydc commentedon May 15, 2024
We briefly discussed this scenario in the community meeting. It seems like this will require pushing different config to different envoy proxies based on zone information. For the time being, we'll focus on supporting the simpler use case described above.
aoledk commentedon May 24, 2024
As mentioned in #1909 (comment), Envoy in different zones may use same backend endpoint as different priority to reduce cross-zone cost.
It's a required feature for production adoption. Does community have roadmap on this feature ?
aoledk commentedon May 24, 2024
#1909 (comment) says:
@arkodg One backendRef (mainly Service) will refer to endpoints from multiple zones, priority should not be applied on backendRef, unless we use selector to collect endpoints in same zone into single backendRef.
Besides, same endpoint will have different priority in Envoy.
So maybe we can't assign a fixed priority for backendRef, codes will be needed to assign right priority for specific Envoy.
arkodg commentedon May 24, 2024
there are two use cases for priority
zonesrepresent physical locations (done for HA purposes at the node level) so location aware routing reduces overall latency as well as cost (cross zone or region can be billed by cloud provider)aoledk commentedon May 30, 2024
@arkodg Can we add a new xDS Hook API, like
PostEndpointModify(ClusterLoadAssignment, Node)which allow extension server to assign endpoint priority for individual envoy. Leave these tasks to EG adopters themselves.aoledk commentedon Jun 7, 2024
@arkodg I've quoted your #3538 (comment) here to continue discussion about priority. I'll freeze #3542 until we reach agreement.
Assuming two cases demonstrated in image below.
Case A: priority isn't in gateway-api, EG will generate
#1,#2LocalityLbEndpoints.Case B: priority is in gateway-api, EG will generate
#3,#4,#5,#6LocalityLbEndpoints.Code in
xds/cachewill be used to modify priority for individual envoy based on envoy's running topology.gateway/internal/xds/cache/snapshotcache.go
Lines 92 to 96 in 33fceb0
We can have 2 options to enable topology aware routing ( NOT envoy zone aware routing ) based on priority.
Option 1
Add knob into BackendTrafficPolicy to enable topology aware routing for affected BackendRefs.
If we enable in Case A,
#1,#2LocalityLbEndpoints for envoy running in zone a will be modified byxds/cachelike this:#1P=0#2P=1If we enable in Case B,
#3,#4,#5,#6LocalityLbEndpoints for envoy running in zone a will be modified byxds/cachelike this:#3P=0#4P=1#5P=2#6P=3But this option has several challenges.
Challenge 1
The new knob is accessible in
xds/translator, butxds/translatoronly passxdstoxds/server, then toxds/cache, a new communication channel need to be setup to pass this particular knob toxds/cache. It will add additional dependency between those modules.Challenge 2
Should we allow user to enable topology aware routing for BackendRefs specified with priority ?
If yes, that means
xds/cachewill modify LocalityLbEndpoints's priority specified by user.Option 2
Add knob into EnvoyGateway to enable topology aware routing for all BackendRefs.
If enabled,
#1,#2,#3,#4,#5,#6LocalityLbEndpoints for envoy running in zone a will be modified byxds/cachelike this:#1P=0#2P=1#3P=0#4P=1#5P=2#6P=3Challenge 1
Same to Option 1's Challenge 2.
LocalityLbEndpoints can be set with
region/zone/sub_zone:zonecan be retrieved from EndpointSlice directly.regioncan be retrieved like this: use nodeName in EndpointSlice to query Node, retrieve region from Nodetopology.kubernetes.io/regionlabel.Envoy can be set with
region/zone/sub_zone.regionandzonecan be retrieved like this: use nodeName via Pod downward API to query Node, retrieve region and zone from Nodetopology.kubernetes.io/regionandtopology.kubernetes.io/zonelabels.sub_zonecan't be retrieved.So
regioncan be used as level bigger thanzonetechnically, we can discuss whether we need to useregionon topology aware routing.9 remaining items
alexwo commentedon Aug 13, 2024
Sure, we can simplify and offer the same level of flexibility as done in GCP. So that via the API layer we expose just a boolean and manage as priority at the translation layer, allowing for a priority of: primary / backup (0,1).
arkodg commentedon Aug 13, 2024
nginx has a
backupkeyword It uses https://nginx.org/en/docs/http/ngx_http_upstream_module.htmlI'm a +1 for the boolean option
also @alexwo another design decision is around when does an endpoint get removed from the load balancing pool and when does it get re added ? is the user responsible for setting up
healthCheck(active or passive) which results in endpoints being removed/readded from the pool ?guydc commentedon Aug 13, 2024
+1 for a boolean as well.
alexwo commentedon Aug 14, 2024
Sounds good @arkodg / @guydc,
I have updated: #4033 to reflect the “designated failover backend” boolean approach.
[api] Add Failover field to Backend
[api] Add Failover field to Backend (#4099)
github-actions commentedon Sep 13, 2024
This issue has been automatically marked as stale because it has not had activity in the last 30 days.
feat: implement fallback for the Backend API
feat: implement fallback for the Backend API (#4461)
arkodg commentedon Oct 18, 2024
docs and e2e is left, moving this to the v1.2.0 milestone