Skip to content
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

feat: support LB priority for non xRoute endpoints #4033

Merged
merged 22 commits into from
Aug 17, 2024

Conversation

alexwo
Copy link
Contributor

@alexwo alexwo commented Aug 12, 2024

What does this PR do?

It enables users to configure failover backends.

How is this achieved?

The proposal involves adding a Failover boolean property to backend refs, what allows to indicate whether the backend is designated as a failover.

This approach is illustrated in this PR for external extProc.

As per issue #3055

Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
@alexwo alexwo requested a review from a team as a code owner August 12, 2024 14:21
Copy link

codecov bot commented Aug 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.92%. Comparing base (683b5b5) to head (9277ec6).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4033      +/-   ##
==========================================
+ Coverage   67.87%   67.92%   +0.05%     
==========================================
  Files         187      187              
  Lines       23023    23030       +7     
==========================================
+ Hits        15626    15644      +18     
+ Misses       6277     6271       -6     
+ Partials     1120     1115       -5     

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

alexwo added 2 commits August 12, 2024 21:27
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
@alexwo
Copy link
Contributor Author

alexwo commented Aug 12, 2024

/retest

2 similar comments
@alexwo
Copy link
Contributor Author

alexwo commented Aug 12, 2024

/retest

@alexwo
Copy link
Contributor Author

alexwo commented Aug 13, 2024

/retest

Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
Copy link
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.

Can we also add an XDS translation test?

api/v1alpha1/wasm_types.go Outdated Show resolved Hide resolved
api/v1alpha1/shared_types.go Outdated Show resolved Hide resolved
alexwo added 6 commits August 15, 2024 09:41
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
@alexwo
Copy link
Contributor Author

alexwo commented Aug 15, 2024

/retest

@alexwo
Copy link
Contributor Author

alexwo commented Aug 15, 2024

Can we also add an XDS translation test?

added

@alexwo
Copy link
Contributor Author

alexwo commented Aug 15, 2024

/retest

@alexwo
Copy link
Contributor Author

alexwo commented Aug 15, 2024

Can we also add an XDS translation test?

added

@guydc
Copy link
Contributor

guydc commented Aug 15, 2024

overall LGTM.

cc @arkodg

In terms of naming, I think that failover is a common industry term used by Akamai, Cloudflare, GCP, AWS and Azure in this context. Nginx and HAProxy use "backup".

I think that "backup" can be a bit vague in this context:

  • It's associated with data backup/restore operations
  • It doesn't express the fact that the "backup" backend will automatically handle traffic in case of primary backend failure. Users may anticipate that they need to "enable" a backup server as a primary in case of failure.

We need to follow up with an E2E and user docs that explain how priorities interact with Active/Passive healthchecks and discovery.

guydc
guydc previously approved these changes Aug 15, 2024
@alexwo
Copy link
Contributor Author

alexwo commented Aug 15, 2024

/retest

alexwo and others added 4 commits August 15, 2024 16:29
Co-authored-by: zirain <zirain2009@gmail.com>
Signed-off-by: Alex Volchok <alex.volchok@sap.com>
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
@alexwo
Copy link
Contributor Author

alexwo commented Aug 15, 2024

/retest

@arkodg arkodg changed the title [feat] support LB priority for endpoints [feat] support LB priority for non xRoute endpoints Aug 15, 2024
@@ -473,6 +473,10 @@ type BackendRef struct {
// BackendObjectReference references a Kubernetes object that represents the backend.
// Only Service kind is supported for now.
gwapiv1.BackendObjectReference `json:",inline"`
// Failover This indicates whether the backend is designated as a failover.
// Multiple failover backends can be configured for a single BackendService.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Multiple failover backends can be configured for a single BackendService.
// Multiple failover backends can be configured.

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

@@ -473,6 +473,10 @@ type BackendRef struct {
// BackendObjectReference references a Kubernetes object that represents the backend.
// Only Service kind is supported for now.
gwapiv1.BackendObjectReference `json:",inline"`
// Failover This indicates whether the backend is designated as a failover.
// Multiple failover backends can be configured for a single BackendService.
// +optional
Copy link
Contributor

Choose a reason for hiding this comment

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

"Its strongly recommended to configure active or passive healthchecks to ensure failover can be detected when the active backends are unhealthy and can be readjusted once the primary backends are healthy again. The overprovisioning factor is set to 1.4 i.e. the failover backends will receive traffic only once the health of the active backends drops below 72%"

@@ -851,7 +854,7 @@ func (t *Translator) buildExtAuth(policy *egv1a1.SecurityPolicy, resources *Reso
authority = backendRefAuthority(resources, backendRef, policy)
pnn := utils.NamespacedName(policy)
if ds, err = t.processExtServiceDestination(
backendRef,
&egv1a1.BackendRef{BackendObjectReference: *backendRef, Failover: priority},
Copy link
Contributor

Choose a reason for hiding this comment

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

can we modify this to Failover: ptr.Deref(grpc.BackendRefs[0].Failover , false)

Copy link
Contributor

@arkodg arkodg Aug 15, 2024

Choose a reason for hiding this comment

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

this line is typecasting from bool from int32 ? can we make it more explicit, no strong preference on using bool or int in IR

Copy link
Contributor Author

@alexwo alexwo Aug 16, 2024

Choose a reason for hiding this comment

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

we don't have to type cast (its bool type both in ir/ api), priority var should be renamed failover in this context

alexwo added 2 commits August 16, 2024 06:39
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
@alexwo
Copy link
Contributor Author

alexwo commented Aug 16, 2024

/retest

Copy link
Contributor

@arkodg arkodg 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 !

@arkodg arkodg requested review from a team August 16, 2024 19:48
@zirain
Copy link
Contributor

zirain commented Aug 17, 2024

/retest

@zirain
Copy link
Contributor

zirain commented Aug 17, 2024

/retest

@zirain zirain changed the title [feat] support LB priority for non xRoute endpoints feat: support LB priority for non xRoute endpoints Aug 17, 2024
@zirain zirain merged commit 7f2c151 into envoyproxy:main Aug 17, 2024
26 of 27 checks passed
@alexwo alexwo deleted the prio_support branch August 17, 2024 09:15
arkodg added a commit to arkodg/gateway that referenced this pull request Aug 22, 2024
Adds a `failover` field to Backend API so we can support Active/Passive
Failove backends within xRoutes similar to envoyproxy#4033

Relates to envoyproxy#3055

Signed-off-by: Arko Dasgupta <arko@tetrate.io>
arkodg added a commit that referenced this pull request Aug 27, 2024
* [api] Add Failover field to Backend

Adds a `failover` field to Backend API so we can support Active/Passive
Failove backends within xRoutes similar to #4033

Relates to #3055

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* fix doc string

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* notImplementedHide

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

---------

Signed-off-by: Arko Dasgupta <arko@tetrate.io>
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.

4 participants