Skip to content

Prefer the load_balancing_policy cluster field over lb_policy#18419

Merged
lizan merged 9 commits intoenvoyproxy:mainfrom
temawi:new_lb_policy
Oct 27, 2021
Merged

Prefer the load_balancing_policy cluster field over lb_policy#18419
lizan merged 9 commits intoenvoyproxy:mainfrom
temawi:new_lb_policy

Conversation

@temawi
Copy link
Copy Markdown
Contributor

@temawi temawi commented Oct 4, 2021

This change updates Envoy to consider the load balancing configuration
set in load_balancing_policy, regardless of what is set in lb_policy.
Previously the load_balancing_policy field was only considered if lb_policy
was set to LOAD_BALANCING_POLICY_CONFIG.

Going forward the approach is to only use the load_balancing_policy field
and the extensible configuration mechanism it provides to configure
all load balancing policies, which makes lb_policy deprecated.

This change still preserves backward compatibility, allowing old clients
to continue using the lb_policy field and new ones to switch to just
considering load_balancing_policy.

Commit Message: Prefer the load_balancing_policy cluster field over lb_policy
Additional Description: This change updates Envoy to consider the load
balancing configuration set in load_balancing_policy, regardless of what
is set in lb_policy.
Risk Level: Low
Testing: New unit tests for upstream_impl.cc
Docs Changes: Documentation to follow once consensus on this
change is reached.
Release Notes: Not currently user impacting as backward compatibility
is maintained.
Platform Specific Features: None.
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

@repokitteh-read-only
Copy link
Copy Markdown

Hi @temawi, welcome and thank you for your contribution.

We will try to review your Pull Request as quickly as possible.

In the meantime, please take a look at the contribution guidelines if you have not done so already.

🐱

Caused by: #18419 was opened by temawi.

see: more, trace.

@repokitteh-read-only
Copy link
Copy Markdown

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #18419 was opened by temawi.

see: more, trace.

@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to api/envoy/.
envoyproxy/api-shepherds assignee is @markdroth
CC @envoyproxy/api-watchers: FYI only for changes made to api/envoy/.

🐱

Caused by: #18419 was opened by temawi.

see: more, trace.

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.

Naming this is hard! This is the best I could think of, but it's still a bit confusing as it's somewhat overloaded with the LOAD_BALANCING_POLICY_CONFIG enum value.

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.

Yeah, this name is probably fine.

Please add a [#not-implemented-hide:] annotation here to hide this from the Envoy docs until it is actually implemented in Envoy.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd like to push back on the name a bit. I feel it's just too easy to confuse this with the existing same-typed field.

Why can't we just change semantics of the existing field such that if a non-LOAD_BALANCING_POLICY_CONFIG policy is set, and load_balancing_policy is set as well, that we have the intended fallback behaviors?

This would have the same behavior as today if LOAD_BALANCING_POLICY_CONFIG and load_balancing_policy are set and still provide the desired fallback behavior for older clients?

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.

That sounds okay to me. The only real impact of that would be that if the control plane populates the load_balancing_policy field but does not set the enum to LOAD_BALANCING_POLICY_CONFIG, then very recent versions of Envoy that include #17400 would react as if they did not support load_balancing_policy at all.

@pianiststickman, does that sound okay to you?

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.

I believe we have consensus on reusing the existing load_balancing_config field. Old clients will look at the field if LOAD_BALANCING_POLICY_CONFIG is set in lb_policy, but this approach is getting marked as deprecated in this PR. The approach going forward is to only consider load_balancing_config for all LB configuration. Please take a look if the changes I made look ok.

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.

Sorry for the late reply - yes, that sounds fine to me. AIUI there is no change if the management server still populates load_balancing_policy and continues to set the enum to LOAD_BALANCING_POLICY_CONFIG.

Of course that raises a different question - if eventually the client will just look at load_balancing_policy and not at the enum value, then does LOAD_BALANCING_POLICY_CONFIG really have a purpose? Should it be deprecated?

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.

No, LOAD_BALANCING_POLICY_CONFIG is no longer needed. We're deprecating it as part of this PR.

Copy link
Copy Markdown
Contributor

@markdroth markdroth left a comment

Choose a reason for hiding this comment

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

Thanks for doing this!

Note that you'll need to run ./ci/run_envoy_docker.sh './ci/do_ci.sh fix_format' to generate the shadow proto files and add the changes to this PR.

Please let me know if you have any questions. Thanks!

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.

Yeah, this name is probably fine.

Please add a [#not-implemented-hide:] annotation here to hide this from the Envoy docs until it is actually implemented in Envoy.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No value at all of what?

Copy link
Copy Markdown
Contributor

@markdroth markdroth left a comment

Choose a reason for hiding this comment

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

I'm wondering if we can make the code change to Envoy to always prefer load_balancing_policy to lb_policy as part of this PR. Ideally, that should be fairly simple to do, but if we let this go for a long time before making that change, it will make life much harder for control planes.

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.

I think we should just change this comment to say:

If this field is set and is supported by the client, it will supercede the value of
:ref:`lb_policy<envoy_v3_api_field_config.cluster.v3.Cluster.lb_policy>`.

@htuch
Copy link
Copy Markdown
Member

htuch commented Oct 13, 2021

To @markdroth's point, the change to do this in Envoy would be very small, probably a few lines in upstream_impl.cc where load_balancing_policy is referenced and upstream_impl_test.cc unit tests.

@repokitteh-read-only repokitteh-read-only bot added the deps Approval required for changes to Envoy's external dependencies label Oct 18, 2021
@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/dependency-shepherds: Your approval is needed for changes made to (bazel/.*repos.*\.bzl)|(bazel/dependency_imports\.bzl)|(api/bazel/.*\.bzl)|(.*/requirements\.txt)|(.*\.patch).

🐱

Caused by: #18419 was synchronize by temawi.

see: more, trace.

@temawi
Copy link
Copy Markdown
Contributor Author

temawi commented Oct 21, 2021

I'm wondering if we can make the code change to Envoy to always prefer load_balancing_policy to lb_policy as part of this PR. Ideally, that should be fairly simple to do, but if we let this go for a long time before making that change, it will make life much harder for control planes.

I made the change and added some unit tests.

@temawi temawi marked this pull request as ready for review October 21, 2021 21:39
@htuch
Copy link
Copy Markdown
Member

htuch commented Oct 22, 2021

@lizan can you provide non-Googler API and implementation review coverage on this one? Thanks.

@markdroth
Copy link
Copy Markdown
Contributor

Thanks for making that change -- this looks great!

It looks like there are some CI failures to be resolved.

@temawi temawi changed the title config: add new field for load balancing policy. Prefer the load_balancing_policy cluster field over lb_policy Oct 25, 2021
lizan
lizan previously approved these changes Oct 25, 2021
@lizan
Copy link
Copy Markdown
Member

lizan commented Oct 25, 2021

Changes looks good, can you fix DCO?

This adds a new LB policy mechanism over the existing lb_policy and
load_balancing_policy fields, which it deprecates.

This change allows for a more flexible configuration of defining a
heterogenous list of built-in and custom load balancers while still
preserving backward compatibility, allowing the old fields to be
used by older clients .

Signed-off-by: Terry Wilson <tmwilson@google.com>
This adds a new LB policy mechanism over the existing lb_policy and
load_balancing_policy fields, which it deprecates.

This change allows for a more flexible configuration of defining a
heterogenous list of built-in and custom load balancers while still
preserving backward compatibility, allowing the old fields to be
used by older clients .

Signed-off-by: Terry Wilson <tmwilson@google.com>
Signed-off-by: Terry Wilson <tmwilson@google.com>
Signed-off-by: Terry Wilson <tmwilson@google.com>
Not supported in enum values.

Signed-off-by: Terry Wilson <tmwilson@google.com>
Signed-off-by: Terry Wilson <tmwilson@google.com>
Signed-off-by: Terry Wilson <tmwilson@google.com>
Signed-off-by: Terry Wilson <tmwilson@google.com>
Signed-off-by: Terry Wilson <tmwilson@google.com>
@temawi
Copy link
Copy Markdown
Contributor Author

temawi commented Oct 26, 2021

@lizan DCO is now taken care of but I ended up dismissing your approval by making some formatting changes. Can you re-approve, please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deps Approval required for changes to Envoy's external dependencies

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants