Skip to content

Commit

Permalink
add deprecated fields (#1127)
Browse files Browse the repository at this point in the history
* add deprecated fields
  • Loading branch information
ilackarms authored and soloio-bulldozer[bot] committed Sep 5, 2019
1 parent 90a4e5a commit c828a97
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 45 deletions.
3 changes: 3 additions & 0 deletions changelog/v0.18.34/restore-deprecated-field.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
changelog:
- type: NON_USER_FACING
description: add deprecated fields to gateway virtualhost for backwards compatibility
Original file line number Diff line number Diff line change
Expand Up @@ -151,17 +151,21 @@ Unlike the [Gloo Virtual Host]({{< ref "/v1/github.com/solo-io/gloo/projects/glo
Gateway* Virtual Hosts can **delegate** their routes to `RouteTables`.

```yaml
"name": string
"domains": []string
"routes": []gateway.solo.io.Route
"virtualHostPlugins": .gloo.solo.io.VirtualHostPlugins
"corsPolicy": .gloo.solo.io.CorsPolicy
```

| Field | Type | Description | Default |
| ----- | ---- | ----------- |----------- |
| `name` | `string` | deprecated. this field is ignored | |
| `domains` | `[]string` | The list of domains (i.e.: matching the `Host` header of a request) that belong to this virtual host. Note that the wildcard will not match the empty string. e.g. “*-bar.foo.com” will match “baz-bar.foo.com” but not “-bar.foo.com”. Additionally, a special entry “*” is allowed which will match any host/authority header. Only a single virtual host on a gateway can match on “*”. A domain must be unique across all virtual hosts on a gateway or the config will be invalidated by Gloo Domains on virtual hosts obey the same rules as [Envoy Virtual Hosts](https://github.com/envoyproxy/envoy/blob/master/api/envoy/api/v2/route/route.proto) | |
| `routes` | [[]gateway.solo.io.Route](../virtual_service.proto.sk#route) | The list of HTTP routes define routing actions to be taken for incoming HTTP requests whose host header matches this virtual host. If the request matches more than one route in the list, the first route matched will be selected. If the list of routes is empty, the virtual host will be ignored by Gloo. | |
| `virtualHostPlugins` | [.gloo.solo.io.VirtualHostPlugins](../../../../gloo/api/v1/plugins.proto.sk#virtualhostplugins) | Virtual host plugins contain additional configuration to be applied to all traffic served by the Virtual Host. Some configuration here can be overridden by Route Plugins. | |
| `corsPolicy` | [.gloo.solo.io.CorsPolicy](../../../../gloo/api/v1/proxy.proto.sk#corspolicy) | Defines a CORS policy for the virtual host If a CORS policy is also defined on the route matched by the request, the policies are merged. DEPRECATED set cors policy through the Virtual Host Plugin | |



Expand Down
7 changes: 7 additions & 0 deletions projects/gateway/api/v1/virtual_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ Unlike the [Gloo Virtual Host]({{< ref "/v1/github.com/solo-io/gloo/projects/glo
*/
message VirtualHost {
// deprecated. this field is ignored
string name = 1;

// The list of domains (i.e.: matching the `Host` header of a request) that belong to this virtual host.
// Note that the wildcard will not match the empty string. e.g. “*-bar.foo.com” will match “baz-bar.foo.com”
// but not “-bar.foo.com”. Additionally, a special entry “*” is allowed which will match any host/authority header.
Expand All @@ -164,6 +167,10 @@ message VirtualHost {
// Some configuration here can be overridden by Route Plugins.
gloo.solo.io.VirtualHostPlugins virtual_host_plugins = 4;

// Defines a CORS policy for the virtual host
// If a CORS policy is also defined on the route matched by the request, the policies are merged.
// DEPRECATED set cors policy through the Virtual Host Plugin
gloo.solo.io.CorsPolicy cors_policy = 5;
}

/*
Expand Down
119 changes: 74 additions & 45 deletions projects/gateway/pkg/api/v1/virtual_service.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions projects/gateway/pkg/translator/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ func convertVirtualHost(vs core.ResourceRef, ours *v1.VirtualHost, tables v1.Rou
Domains: ours.Domains,
Routes: routes,
VirtualHostPlugins: ours.VirtualHostPlugins,
// TODO: remove on next breaking change
CorsPolicy: ours.CorsPolicy,
}

return vh, nil
Expand Down

0 comments on commit c828a97

Please sign in to comment.