external_options.proto

Package: gateway.solo.io

Types:

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, VirtualHostOptions which are delegated to first will get priority over following VirtualHostOptions.

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"]
    cors:
      exposeHeaders:
        - header-from-extopt1
      allowOrigin:
        - 'https://solo.io'
apiVersion: gateway.solo.io/v1
kind: VirtualHostOption
metadata:
  name: virtualhost-external-options-2
  namespace: opt-namespace
spec:
  options:
    headerManipulation:
      requestHeadersToRemove: ["header-from-external-options2"]
    cors:
      exposeHeaders:
        - header-from-extopt2
      maxAge: 2s
      allowOrigin:
        - 'https://solo.io'
    transformations:
      requestTransformation:
        transformationTemplate:
          headers:
            x-header-added-in-opt2:
              text: 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
      cors:
        exposeHeaders:
          - header-from-extopt1
        allowOrigin:
          - 'https://solo.io'
      # from delegated virtualhost-external-options-2
      transformations:
        requestTransformation:
          transformationTemplate:
            headers:
              x-header-added-in-opt2:
                text: 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
"targetRefs": []core.skv2.solo.io.PolicyTargetReferenceWithSectionName

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.
targetRefs []core.skv2.solo.io.PolicyTargetReferenceWithSectionName When using Kubernetes Gateway API mode, targetRefs can be used to attach this VirtualHostOption to a gateway.networking.k8s.io/Gateway object. The options specified will then be used for all Listeners in the Gateway unless targetRef.sectionName is specified. NOTE: This is a repeated field but currently ONLY supports a single targetRef. If multiple targetRefs are provided, only the first in the list will be used.

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, RouteOptions which are delegated to first will get priority over following RouteOptions.

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"]
      optionsConfigRefs:
        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"]
    cors:
      exposeHeaders:
        - header-from-extopt1
      allowOrigin:
        - 'https://solo.io'
apiVersion: gateway.solo.io/v1
kind: RouteOption
metadata:
  name: route-external-options-2
  namespace: opt-namespace
spec:
  options:
    headerManipulation:
      requestHeadersToRemove: ["header-from-external-options2"]
    cors:
      exposeHeaders:
        - header-from-extopt2
      maxAge: 2s
      allowOrigin:
        - 'https://solo.io'
    transformations:
      requestTransformation:
        transformationTemplate:
          headers:
            x-header-added-in-opt2:
              text: 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
      cors:
        exposeHeaders:
          - header-from-extopt1
        allowOrigin:
          - 'https://solo.io'
      # from delegated route-external-options-2
      transformations:
        requestTransformation:
          transformationTemplate:
            headers:
              x-header-added-in-opt2:
                text: 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
"targetRefs": []core.skv2.solo.io.PolicyTargetReference

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.
targetRefs []core.skv2.solo.io.PolicyTargetReference When using Kubernetes Gateway API mode, targetRefs can be used to attach this RouteOption to a gateway.networking.k8s.io/HTTPRoute object. The options specified will then be used for all Rules in the HTTPRoute. NOTE: This is a repeated field but currently ONLY supports a single targetRef. If multiple targetRefs are provided, only the first in the list will be used.

ListenerOption

"metadata": .core.solo.io.Metadata
"options": .gloo.solo.io.ListenerOptions
"targetRefs": []core.skv2.solo.io.PolicyTargetReferenceWithSectionName

Field Type Description
metadata .core.solo.io.Metadata Metadata contains the object metadata for this resource.
options .gloo.solo.io.ListenerOptions Listener options.
targetRefs []core.skv2.solo.io.PolicyTargetReferenceWithSectionName When using Kubernetes Gateway API mode, targetRefs can be used to attach this ListenerOption to a gateway.networking.k8s.io/Gateway object. The options specified will then be used for all Listeners in the Gateway unless targetRef.sectionName is specified. NOTE: This is a repeated field but currently ONLY supports a single targetRef. If multiple targetRefs are provided, only the first in the list will be used.

HttpListenerOption

"metadata": .core.solo.io.Metadata
"options": .gloo.solo.io.HttpListenerOptions
"targetRefs": []core.skv2.solo.io.PolicyTargetReferenceWithSectionName

Field Type Description
metadata .core.solo.io.Metadata Metadata contains the object metadata for this resource.
options .gloo.solo.io.HttpListenerOptions HttpListener options.
targetRefs []core.skv2.solo.io.PolicyTargetReferenceWithSectionName When using Kubernetes Gateway API mode, targetRef can be used to attach this VirtualHostOption to a gateway.networking.k8s.io/Gateway object. The options specified will then be used for all Listeners in the Gateway unless targetRef.sectionName is specified. NOTE: This is a repeated field but currently ONLY supports a single targetRef. If multiple targetRefs are provided, only the first in the list will be used.