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

upstream group and subsets #601

Merged
merged 25 commits into from Mar 27, 2019
Merged

upstream group and subsets #601

merged 25 commits into from Mar 27, 2019

Conversation

yuval-k
Copy link
Member

@yuval-k yuval-k commented Mar 25, 2019

The draft for groups and subsets.
adding tests now, but figure you guys should take a look.

@ilackarms
Copy link
Member

personally i am not in favor of extending our api with new api objects, additions to core fields (upstream spec, destination spec) to support an api which increases the coupling between the route and the upstream (route must now know which subsets are available on the upstream)

my suggestion is to implement a new upstreamType for grouped upstreams which allow specifying a list of other upstreams which can be grouped. this is a far simpler means of achieving the same result without adding new solo-kit resources and modifying core api structs just to support a particular use case. this is the entire reason we have upstreamType - to support extending our upstream model without needing to bloat the core apis

@yuval-k
Copy link
Member Author

yuval-k commented Mar 25, 2019

to support envoy subsets route will have to know the subsets regardless; this has nothing to do with the upstream group.

I see a difference in semantic between an Upstream and an UpstreamGroup
Things that upstream has that upstream group doesn't have are sslConfig, and subset configuration.

Additionally making an upstream group a type of upstream will allow recursive upstream groups, which there is no need to have IMHO

Also unlike Upstream, UpstreamGroup is not translated to a cluster.

I see UpstreamGroup as an abstraction of the MultiDestionation part in the route.

I believe these semantic differences merits a new type of api object.

@ilackarms
Copy link
Member

to support envoy subsets route will have to know the subsets regardless; this has nothing to do with the upstream group.

this is the purpose for putting the subset only in one place (on the upstream). preserve semantics rather than making things more complex. want to route to a subset? create a route like normal, and select an upstream which represents a subset

Additionally making an upstream group a type of upstream will allow recursive upstream groups, which there is no need to have IMHO

i see this edge case as trivial, it can be easily verified with validation on the cli and translator levels. i prefer it to the complexity your proposal would add to the current api

Also unlike Upstream, UpstreamGroup is not translated to a cluster.

This is up to us to decide. the translator can easily be modified so that it does not create a cluster for every upstream

I see UpstreamGroup as an abstraction of the MultiDestionation part in the route.

I see UpstreamGroup as an Upstream which represents a set of weighted upstreams. It's taking the concept of a MultiDestination and moving it to the upstream itself rather than putting it on the route. i consider the following:

route:
  destination:
    single:
      upstream:
        my-upstream-group

to be an equivalent form for

route:
  destination:
    multi:
    - upstream:
        my-upstream-1
    - upstream:
        my-upstream-2

@yuval-k
Copy link
Member Author

yuval-k commented Mar 25, 2019

this the purpose for putting the subset only in one place (on the upstream). preserve semantics rather than making things more complex. want to route to a subset? create a route like normal, and select an upstream which represents a subset

There are subsets defined by discovery. This PR introduces a new type - subsets defined by the user.
The advantage of this:

  • we dont need to guess which subset the user needs
  • having the same endpoint in the multiple clusters will increase the amounts of health - checks. giving envoy the subset information (as this PR does) allows envoy being more efficient

i see this edge case as trivial, it can be easily verified with validation on the cli and translator levels. i prefer it to the complexity your proposal would add to the current api

Why allow configuration to have an invalid state if we can prevent that?

This is up to us to decide. the translator can easily be modified so that it does not create a cluster for every upstream

It is up for us to decide but it does introduce special cases to our code, so I think it nullifies i prefer it to the complexity your proposal would add to the current api as there is added complexity either way.

also consider that things that are general cluster concepts do not work will with an upstream group as an upstream type. things like:

  • ssl
  • subset configuration
  • load balancing algorithm
  • circuit breakers
  • health_checks
  • outlier_detection

// Sub set configuration. For discovery sources that has labels (like kubernetes). this
// configuration allows you to partition the upstream to a set of subsets.
// for each unique set of keys and values, a subset will be created.
SubsetConfig subset_config = 7;
Copy link
Member

@ilackarms ilackarms Mar 25, 2019

Choose a reason for hiding this comment

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

i think this functionality is already available through the use of the selector on the kubernetes upstream spec

Copy link
Member Author

Choose a reason for hiding this comment

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

The idea here is to allow subsets beyond the labels on the service.
In addition the user needs to be aware of what they are so at a minimum we need to write them here.
I'm not sure I 100% understand you here so let's discuss this tomorrow in person

@ilackarms
Copy link
Member

you make good points. taking a second look at the code, i think it makes sense to have a new crd for upstreams with ustreamgroup as an alternative type of destination. one thing i will say though is that i believe subset config being part of the generic upstream doesn't make sense to me. it only (as far as i can tell) applies to kubernetes, and the kubernetes service spec already has a selector which the user can manually configure for subset selection.

@yuval-k yuval-k marked this pull request as ready for review March 27, 2019 19:46
@soloio-bot
Copy link

Issues linked to changelog:
#601

.plugins.gloo.solo.io.ServiceSpec service_spec = 5;


// Sub set configuration. For discovery sources that has labels (like kubernetes). this

Choose a reason for hiding this comment

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

nit: subset

// message UpstreamGroupSpec {
repeated WeightedDestination destinations = 1;
// }
// UpstreamGroupSpec spec = 1;

Choose a reason for hiding this comment

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

Remove commented out stuff

option (gogoproto.equal_all) = true;

message Subset {
map<string, string> values =1;

Choose a reason for hiding this comment

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

nit: formatting -> "... values = 1;"

},
}
params.Snapshot.Upstreams["gloo-system"] = append(params.Snapshot.Upstreams["gloo-system"], upstream2)
params.Snapshot.Upstreamgroups = v1.UpstreamgroupsByNamespace{

Choose a reason for hiding this comment

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

Realize this is not related to this PR, but kinda annoying that solo-kit doesn't respect "UpstreamGroupsByNamespace"

Copy link
Member Author

Choose a reason for hiding this comment

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

yea..

rickducott
rickducott previously approved these changes Mar 27, 2019
@yuval-k
Copy link
Member Author

yuval-k commented Mar 27, 2019

/kick ssl flake

@soloio-bulldozer soloio-bulldozer bot merged commit 89aeddb into master Mar 27, 2019
@soloio-bulldozer soloio-bulldozer bot deleted the upstream-group branch March 27, 2019 22:45
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.

None yet

4 participants