external_options.proto
Package: gateway.solo.io
Types:
- VirtualHostOption Top-Level Resource
- RouteOption Top-Level Resource
Source File: github.com/solo-io/gloo/projects/gateway/api/v1/external_options.proto
VirtualHostOption
The VirtualHostOption holds options
configuration for a VirtualHost.
VirtualHosts can inherit options
config from VirtualHostOption
objects by delegating to them.
When a VirtualHost delegates to an external VirtualHostOptions object, any options config
defined on the VirtualHost will override the external options config.
Similarly, VirtualHostOption
s which are delegated to first will get priority over following VirtualHostOption
s.
An example configuration with a VirtualService with its own options config and delegating to two VirtualHostOption objects:
apiVersion: gateway.solo.io/v1
kind: VirtualService
metadata:
name: http
namespace: gloo-system
spec:
virtualHost:
domains:
- '*'
options:
headerManipulation:
requestHeadersToRemove: "header-from-vhost"
optionsConfigRefs:
delegateOptions:
- name: virtualhost-external-options-1
namespace: opt-namespace
- name: virtualhost-external-options-2
namespace: opt-namespace
apiVersion: gateway.solo.io/v1
kind: VirtualHostOption
metadata:
name: virtualhost-external-options-1
namespace: opt-namespace
spec:
options:
headerManipulation:
requestHeadersToRemove: "header-from-external-options1"
corsPolicy:
exposeHeaders:
- header-from-extopt1
apiVersion: gateway.solo.io/v1
kind: VirtualHostOption
metadata:
name: virtualhost-external-options-2
namespace: opt-namespace
spec:
options:
headerManipulation:
requestHeadersToRemove: "header-from-external-options2"
corsPolicy:
exposeHeaders:
- header-from-extopt2
maxAge: 2s
transformations:
requestTransformation:
transformationTemplate:
headers:
x-header-added-in-opt2:
value: this header was added in the VirtualHostOption object - #2
The final virtual host options (visible in the Proxy CR) would be:
spec:
virtualHost:
domains:
- '*'
options:
# from Virtual host options
headerManipulation:
requestHeadersToRemove: "header-from-vhost"
# from delegated virtualhost-external-options-1
corsPolicy:
exposeHeaders:
- header-from-extopt1
# from delegated virtualhost-external-options-2
transformations:
requestTransformation:
transformationTemplate:
headers:
x-header-added-in-opt2:
value: this header was added in the VirtualHostOption object - #2
Notice how the order of VirtualHostOption delegations matters, and that the VirtualHost-level config overrides all delegated configs.
"namespacedStatuses": .core.solo.io.NamespacedStatuses
"metadata": .core.solo.io.Metadata
"options": .gloo.solo.io.VirtualHostOptions
Field | Type | Description |
---|---|---|
namespacedStatuses |
.core.solo.io.NamespacedStatuses | NamespacedStatuses indicates the validation status of this resource. NamespacedStatuses is read-only by clients, and set by gateway during validation. |
metadata |
.core.solo.io.Metadata | Metadata contains the object metadata for this resource. |
options |
.gloo.solo.io.VirtualHostOptions | VirtualHost options. See VirtualHost for delegation behavior. |
RouteOption
The RouteOption holds options
configuration for a Route.
Routes can inherit options
config from RouteOption
objects by delegating to them.
When a Route delegates to an external RouteOptions object, any options config
defined on the Route will override the external options config.
Similarly, RouteOption
s which are delegated to first will get priority over following RouteOption
s.
An example configuration with a Route with its own options config and delegating to two RouteOption objects:
apiVersion: gateway.solo.io/v1
kind: VirtualService
metadata:
name: http
namespace: gloo-system
spec:
virtualHost:
domains:
- '*'
routes:
- matchers:
- prefix: /
options:
headerManipulation:
requestHeadersToRemove: "header-from-route"
delegateOptions:
- name: route-external-options-1
namespace: opt-namespace
- name: route-external-options-2
namespace: opt-namespace
apiVersion: gateway.solo.io/v1
kind: RouteOption
metadata:
name: route-external-options-1
namespace: opt-namespace
spec:
options:
headerManipulation:
requestHeadersToRemove: "header-from-external-options1"
corsPolicy:
exposeHeaders:
- header-from-extopt1
apiVersion: gateway.solo.io/v1
kind: RouteOption
metadata:
name: route-external-options-2
namespace: opt-namespace
spec:
options:
headerManipulation:
requestHeadersToRemove: "header-from-external-options2"
corsPolicy:
exposeHeaders:
- header-from-extopt2
maxAge: 2s
transformations:
requestTransformation:
transformationTemplate:
headers:
x-header-added-in-opt2:
value: this header was added in the RouteOption object - #2
The final route options would bewould be:
routes:
- matchers:
- prefix: /
options:
# from Route options
headerManipulation:
requestHeadersToRemove: "header-from-route"
# from delegated route-external-options-1
corsPolicy:
exposeHeaders:
- header-from-extopt1
# from delegated route-external-options-2
transformations:
requestTransformation:
transformationTemplate:
headers:
x-header-added-in-opt2:
value: this header was added in the Route object - #2
Notice how the order of RouteOption delegations matters, and that the Route-level option config overrides all delegated option configs.
"namespacedStatuses": .core.solo.io.NamespacedStatuses
"metadata": .core.solo.io.Metadata
"options": .gloo.solo.io.RouteOptions
Field | Type | Description |
---|---|---|
namespacedStatuses |
.core.solo.io.NamespacedStatuses | NamespacedStatuses indicates the validation status of this resource. NamespacedStatuses is read-only by clients, and set by gateway during validation. |
metadata |
.core.solo.io.Metadata | Metadata contains the object metadata for this resource. |
options |
.gloo.solo.io.RouteOptions | Route options. See Route for delegation behavior. |