solo-io / gloo

The Feature-rich, Kubernetes-native, Next-Generation API Gateway Built on Envoy
https://docs.solo.io/
Apache License 2.0
4.07k stars 435 forks source link

Simplify VirtualService API, possibly other APIs #1171

Closed kdorosh closed 4 years ago

kdorosh commented 5 years ago

Virtual Service API can be cleaned up:

Ticket is to determine the difficulty of implementation and whether the changes will have an acceptable payoff in the long run.

Other ideas include moving the entire RoutePlugins config up one level: https://github.com/solo-io/gloo/blob/master/projects/gateway/api/v1/virtual_service.proto#L215

Open to concrete ideas/suggestions for other simplifications here.

Anything come to mind @rickducott @yuval-k @ilackarms @EItanya @mitchdraft ?

ilackarms commented 5 years ago

there are a number of breaking changes that i'm tracking:

there may be more i detect as i go through, but this is the list i have currently

mitchdraft commented 5 years ago

+1 to array of destinations. All sounds good to me. Two comments:

rickducott commented 5 years ago
kdorosh commented 4 years ago

Adding to the list here:

kdorosh commented 4 years ago

after discussion with @ilackarms and @yuval-k , leaning towards a rename of plugins rather than a complete removal/flattening of the plugins API.

Flattening would be challenging, and possibly more trouble than it's worth because we'd have to flatten plugins to two different messages for VirtualHosts and Routes:

This means that every plugin we add in the future would have to be added and documented twice, and would lead to large amounts of API bloat. (proto3 any and writing our own marshal/unmarshal logic for gogoproto are even uglier alternatives)

The reason for the near-duplicate messages is to keep the Gloo/Gateway abstraction -- Gloo Routes (and therefore Gloo VirtualHosts with Gloo Routes) don't need to and shouldn't know about route delegation (the differing config on the Route messages).

A proper rename addresses all of @rickducott 's concerns (bar the unnecessary nesting, which I'm arguing here is necessary)

rickducott commented 4 years ago

What is the proposed name?

Just to be clear, this is what we have now:

plugins:
  hostRewrite: 
    hostRewrite: foo
  prefixRewrite:
    prefixRewrite: bar
  ...

And after the change, we will have:

newName: 
  hostRewrite: foo
  prefixRewrite: bar
  ...

Is that right?

kdorosh commented 4 years ago

Initial rename idea is trafficPolicy.

Yes, we would still be flattening the host/prefix rewrites.

kdorosh commented 4 years ago

Another recent @ilackarms idea is to delete the VirtualHost abstraction altogether from the Gateway API, looking into it more

edit: I'm a big fan of this idea -- as it flattens nesting while making it clearer that our VirtualService API translates (eventually) to Envoy's VirtualHost API

ilackarms commented 4 years ago

@kdorosh we can remove the virtualHost field from the Virtual Service entirely + move field in the VirtualHost up one level.

the current structure exists because the original virtualHost was imported directly from gloo

ilackarms commented 4 years ago

@rickducott @kdorosh personally i like options as a replacement for plugins. it communicates that these are optional fields which extend the basic functionality (route to a destination)

ilackarms commented 4 years ago

another api break worth considering:

marcogschmidt commented 4 years ago
message Destination {

    oneof destination_type {
        core.solo.io.ResourceRef upstream = 10;
        KubernetesServiceDestination kube = 11;
        ConsulServiceDestination consul = 12;
    }

    DestinationSpec destination_spec = 2;
    Subset subset = 3;
}

My concerns:

I think we can make this central part of our APIs much more user-friendly. Such a refactor will however require vast changes to most of Gloo's components, e.g. FDS, UDS, a good number of plugins, and all the Gloo translation logic.

ilackarms commented 4 years ago
ilackarms commented 4 years ago
kdorosh commented 4 years ago
ilackarms commented 4 years ago

linking

as relevant (potentialy breaking) changes

kdorosh commented 4 years ago

duplicate of https://github.com/solo-io/gloo/issues/1932

kdorosh commented 4 years ago

I opened individual issues for each unfinished bullet point to track any remaining open work.

No need to track progress on this epic anymore now that Gloo 1.0 is out.