Skip to content

feat: support LB priority for non xRoute endpoints - #4033

Merged
zirain merged 22 commits into
envoyproxy:mainfrom
alexwo:prio_support
Aug 17, 2024
Merged

zirain merged 22 commits into
envoyproxy:mainfrom
alexwo:prio_support

Conversation

@alexwo

@alexwo alexwo commented Aug 12, 2024 •

Copy link
Copy Markdown
Contributor

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 <[email protected]>
@alexwo
alexwo requested a review from a team as a code owner August 12, 2024 14:21
@codecov

codecov Bot commented Aug 12, 2024 •

Copy link
Copy Markdown

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 <[email protected]>
Signed-off-by: Alexander Volchok <[email protected]>
@alexwo

alexwo commented Aug 12, 2024

Copy link
Copy Markdown
Contributor Author

/retest

2 similar comments
@alexwo

alexwo commented Aug 12, 2024

Copy link
Copy Markdown
Contributor Author

/retest

@alexwo

alexwo commented Aug 13, 2024

Copy link
Copy Markdown
Contributor Author

/retest

Signed-off-by: Alexander Volchok <[email protected]>

@guydc guydc left a comment

Copy link
Copy Markdown
Contributor

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?

Comment thread api/v1alpha1/wasm_types.go Resolved
Comment thread api/v1alpha1/shared_types.go Resolved
alexwo added 6 commits August 15, 2024 09:41
Signed-off-by: Alexander Volchok <[email protected]>
Signed-off-by: Alexander Volchok <[email protected]>
Signed-off-by: Alexander Volchok <[email protected]>
Signed-off-by: Alexander Volchok <[email protected]>
Signed-off-by: Alexander Volchok <[email protected]>
Signed-off-by: Alexander Volchok <[email protected]>
@alexwo

alexwo commented Aug 15, 2024

Copy link
Copy Markdown
Contributor Author

/retest

@alexwo

alexwo commented Aug 15, 2024

Copy link
Copy Markdown
Contributor Author

Can we also add an XDS translation test?

added

@alexwo

alexwo commented Aug 15, 2024

Copy link
Copy Markdown
Contributor Author

/retest

@alexwo

alexwo commented Aug 15, 2024

Copy link
Copy Markdown
Contributor Author

Can we also add an XDS translation test?

added

@guydc

guydc commented Aug 15, 2024 •

Copy link
Copy Markdown
Contributor

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

alexwo commented Aug 15, 2024

Copy link
Copy Markdown
Contributor Author

/retest

Comment thread api/v1alpha1/shared_types.go Resolved
alexwo and others added 4 commits August 15, 2024 16:29
Co-authored-by: zirain <[email protected]>
Signed-off-by: Alex Volchok <[email protected]>
Signed-off-by: Alexander Volchok <[email protected]>
Signed-off-by: Alexander Volchok <[email protected]>
@alexwo

alexwo commented Aug 15, 2024

Copy link
Copy Markdown
Contributor Author

/retest

@arkodg arkodg changed the title [feat] support LB priority for endpoints [feat] support LB priority for non xRoute endpoints Aug 15, 2024
Comment thread api/v1alpha1/shared_types.go Outdated
// 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
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated

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
Copy Markdown
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%"

Comment thread internal/gatewayapi/securitypolicy.go Outdated
pnn := utils.NamespacedName(policy)
if ds, err = t.processExtServiceDestination(
backendRef,
&egv1a1.BackendRef{BackendObjectReference: *backendRef, Failover: priority},

Copy link
Copy Markdown
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)

@arkodg arkodg Aug 15, 2024 •

Copy link
Copy Markdown
Contributor

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

@alexwo alexwo Aug 16, 2024 •

Copy link
Copy Markdown
Contributor Author

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 <[email protected]>
@alexwo

alexwo commented Aug 16, 2024

Copy link
Copy Markdown
Contributor Author

/retest

@arkodg arkodg left a comment

Copy link
Copy Markdown
Contributor

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

zirain commented Aug 17, 2024

Copy link
Copy Markdown
Member

/retest

@zirain

zirain commented Aug 17, 2024

Copy link
Copy Markdown
Member

/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
@alexwo
alexwo deleted the prio_support branch August 17, 2024 09:15
arkodg pushed 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 <[email protected]>
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 <[email protected]>

* fix doc string

Signed-off-by: Arko Dasgupta <[email protected]>

* notImplementedHide

Signed-off-by: Arko Dasgupta <[email protected]>

---------

Signed-off-by: Arko Dasgupta <[email protected]>
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