Skip to content

upstream: allow a cluster to provide its own load balancer#7081

Merged
htuch merged 5 commits intomasterfrom
cluster_provided_lb
May 29, 2019
Merged

upstream: allow a cluster to provide its own load balancer#7081
htuch merged 5 commits intomasterfrom
cluster_provided_lb

Conversation

@mattklein123
Copy link
Member

Certain clusters have cluster specific load balancers. This change
allows a cluster to explicitly provide one, both allowing extension
clusters to easily provide a dedicated load balancer, as well as
allowing for future cleanup of the original DST LB configuration.

This change is needed for Redis Cluster as well as
#1606.

Risk Level: Low
Testing: New UTs and integration tests.
Docs Changes: N/A
Release Notes: N/A

Certain clusters have cluster specific load balancers. This change
allows a cluster to explicitly provide one, both allowing extension
clusters to easily provide a dedicated load balancer, as well as
allowing for future cleanup of the original DST LB configuration.

This change is needed for Redis Cluster as well as
#1606.

Signed-off-by: Matt Klein <mklein@lyft.com>
@mattklein123
Copy link
Member Author

@HenryYYang this should be what you need for Redis Cluster. I left you a TODO to implement. I will also build on this for #1606

Copy link
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

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

Looks good to me, just one minor comment

@HenryYYang
Copy link
Contributor

HenryYYang commented May 28, 2019

I ended up implementing something similar, except I didn't change the ClusterFactory, I put the loadBalancerFactory() method on the cluster object itself. #6895 . Sorry for the miscommunication.

@mattklein123
Copy link
Member Author

I ended up implementing something similar, except I didn't change the ClusterFactory, I put the loadBalancerFactory() method on the cluster object itself. #6895 . Sorry for the miscommunication.

@HenryYYang I considered doing it this way, but IMO it felt cleaner to have the factory return a single LB at cluster construction time since there should be a 1:1 correspondence between them, vs. an API hanging off a cluster that could be called multiple times. It's a minor point but it felt a bit cleaner to me. @snowp @HenryYYang WDYT?

Signed-off-by: Matt Klein <mklein@lyft.com>
@HenryYYang
Copy link
Contributor

I ended up implementing something similar, except I didn't change the ClusterFactory, I put the loadBalancerFactory() method on the cluster object itself. #6895 . Sorry for the miscommunication.

@HenryYYang I considered doing it this way, but IMO it felt cleaner to have the factory return a single LB at cluster construction time since there should be a 1:1 correspondence between them, vs. an API hanging off a cluster that could be called multiple times. It's a minor point but it felt a bit cleaner to me. @snowp @HenryYYang WDYT?

Yes, both way works. I'll change my code to build on top of this. Thanks 👍

@htuch
Copy link
Member

htuch commented May 29, 2019

@mattklein123 from an API perspective, I'm wondering how this interacts with general purpose LB extensibility (#5598). Let's say we want to be able to support:

  1. Custom cluster types
  2. Custom cluster types with custom LB.
  3. Baked in cluster types with custom LB.
    In the case of (3), we might have opaque configuration to feed in to the LB extension. I think with the API here, we might be able to support (3) by adding in some opaque LB config still later. Is this how you see it playing out?

@mattklein123
Copy link
Member Author

@htuch yes exactly. I think we can easily add custom LBs in a similar way that @HenryYYang added custom cluster support. I think in the end we will need all 3 extension points. This change is nice in that it removes a config hack in which a specific LB and cluster need to be configured together for things to work correctly.

Signed-off-by: Matt Klein <mklein@lyft.com>
Copy link
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

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

LGTM. +1 to this approach over adding it as a function on the cluster

@htuch
Copy link
Member

htuch commented May 29, 2019

@mattklein123 can we rename to CustomLb or something then, since it won't always be "cluster provided"? LGTM otherwise.

@mattklein123
Copy link
Member Author

@mattklein123 can we rename to CustomLb or something then, since it won't always be "cluster provided"? LGTM otherwise.

IMO these are different cases. In this case, we are saying that the cluster must provide the LB. I think this is different from a custom LB that applies to any cluster? I think in the latter case we would have different config? WDYT?

@htuch
Copy link
Member

htuch commented May 29, 2019

@mattklein123 ack, that's reasonable, we can have two enum values then. Ship it.

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