EnvoyExtensionPolicy

microgateway.airlock.com/v1alpha1


EnvoyExtensionPolicy is a Direct Attached Policy for the Kubernetes Gateway API.
It allows extending the raw Envoy configuration of the Airlock Microgateway Engine with e.g., custom filters or clusters.
Note: The Gateway of the targeted HTTPRoutes must be configured to allow EnvoyExtensionPolicy in its GatewayParameters or this Policy will have no effect.

---
config:
  theme: base
  themeVariables:
    secondaryColor: '#ffffff'
---
block
  columns 7

  classDef al_ref_box fill:#F2F2F2,stroke:#555;
  classDef al_mgw_box fill:#70991F,stroke:#555;
  classDef al_gwapi_box fill:#326CE5,stroke:#555;
  classDef al_std_box fill:#808B8F,stroke:#555;
  classDef al_self_box fill:#70991F,stroke:#777,stroke-width:5px; 

  
  space:2
  block:Targets:3
    columns 3
    HTTPRoute["<a href='../../../gateway-api/http-route/v1'>&nbsp;&nbsp;HTTPRoute&nbsp;&nbsp;</a>"]
    space:2
    class HTTPRoute al_gwapi_box
  end
  class Targets al_ref_box
  space:2
  
  space:7
  
  space:3
  
  EnvoyExtensionPolicy["<a href='../../../microgateway/envoy-extension-policy/v1alpha1'>&nbsp;&nbsp;<b>EnvoyExtensionPolicy</b>&nbsp;&nbsp;</a>"]
  class EnvoyExtensionPolicy al_self_box
  
  
  space:2
  block:Ref:1
    columns 1
    EnvoyCluster["<a href='../../../microgateway/envoy-cluster/v1alpha1'>&nbsp;&nbsp;EnvoyCluster&nbsp;&nbsp;</a>"]
    EnvoyHTTPFilter["<a href='../../../microgateway/envoy-http-filter/v1alpha1'>&nbsp;&nbsp;EnvoyHTTPFilter&nbsp;&nbsp;</a>"]
    class EnvoyCluster,EnvoyHTTPFilter al_mgw_box
  end
  class Ref al_ref_box
  
  

  EnvoyExtensionPolicy -- "<i>attaches to</i>" --> Targets
  EnvoyExtensionPolicy -- "<br><i>references</i>" --> Ref
apiVersion: microgateway.airlock.com/v1alpha1
kind: EnvoyExtensionPolicy
metadata:
  name: envoy-extension-policy-example
spec:
  targetRefs:
    - group: gateway.networking.k8s.io
      kind: HTTPRoute
      name: backend
  envoyHTTPFilterRefs:
    prepend:
      - name: envoy-httpfilter-ext-authz
    append:
      - name: lua-transform-request
  envoyClusterRefs:
    - name: envoy-cluster-ext-authz

EnvoyExtensionPolicy

Field Description Type Required Default Allowed Values
metadata defines the resource’s metadata ObjectMeta yes
spec defines the desired envoy extension configuration. object yes
status describes the current status of the EnvoyExtensionPolicy. object no

EnvoyExtensionPolicy.spec

Field Description Type Required Default Allowed Values
envoyClusterRefs extends the Airlock Microgateway Engine configuration with additional Envoy clusters. object[] no
envoyHTTPFilterRefs extends the Airlock Microgateway Engine configuration with additional Envoy HTTP filters. object no
targetRefs are the resources this policy is being attached to. Referenced resources must be in the same namespace as the policy.
Support: HTTPRoute.
object[] yes

EnvoyExtensionPolicy.spec.envoyClusterRefs[]

Field Description Type Required Default Allowed Values
name of the EnvoyCluster resource string yes

EnvoyExtensionPolicy.spec.envoyHTTPFilterRefs

Field Description Type Required Default Allowed Values
append specifies EnvoyHTTPFilters to insert after the Airlock filters (i.e., after auth, deny rule filtering, header rewrites, etc.). object[] no
prepend specifies EnvoyHTTPFilters to insert before the Airlock filters (i.e., before auth, deny rule filtering, header rewrites, etc.). object[] no

EnvoyExtensionPolicy.spec.envoyHTTPFilterRefs.append[]

Field Description Type Required Default Allowed Values
name of the EnvoyHTTPFilter resource string yes

EnvoyExtensionPolicy.spec.envoyHTTPFilterRefs.prepend[]

Field Description Type Required Default Allowed Values
name of the EnvoyHTTPFilter resource string yes

EnvoyExtensionPolicy.spec.targetRefs[]

Field Description Type Required Default Allowed Values
group is the group of the target resource. string yes gateway.networking.k8s.io
kind is kind of the target resource. string yes HTTPRoute
name is the name of the target resource. string yes

EnvoyExtensionPolicy.status

Field Description Type
ancestors is a list of ancestor resources (usually Gateways) that are associated with the policy, and the status of the policy with respect to each ancestor. When this policy attaches to a parent, the controller that manages the parent and the ancestors MUST add an entry to this list when the controller first sees the policy and SHOULD update the entry as appropriate when the relevant ancestor is modified.

Note that choosing the relevant ancestor is left to the Policy designers; an important part of Policy design is designing the right object level at which to namespace this status.

Note also that implementations MUST ONLY populate ancestor status for the Ancestor resources they are responsible for. Implementations MUST use the ControllerName field to uniquely identify the entries in this list that they are responsible for.

Note that to achieve this, the list of PolicyAncestorStatus structs MUST be treated as a map with a composite key, made up of the AncestorRef and ControllerName fields combined.

A maximum of 16 ancestors will be represented in this list. An empty list means the Policy is not relevant for any ancestors.

If this slice is full, implementations MUST NOT add further entries.
Instead they MUST consider the policy unimplementable and signal that on any related resources such as the ancestor that would be referenced here. For example, if this list was full on BackendTLSPolicy, no additional Gateways would be able to reference the Service targeted by the BackendTLSPolicy.
object[]

EnvoyExtensionPolicy.status.ancestors[]

Field Description Type
ancestorRef corresponds with a ParentRef in the spec that this PolicyAncestorStatus struct describes the status of. object
conditions

Conditions describes the status of the Policy with respect to the given Ancestor.

Possible conditions:

  • Accepted: indicates whether the policy has been accepted or rejected by a targeted resource, and why.

    Possible reasons for this condition to be True are:
    • “Accepted”
    Possible reasons for this condition to be False are:
    • “Conflicted”
    • “Invalid”
    • “TargetNotFound”

Condition[]
controllerName is a domain/path string that indicates the name of the controller that wrote this status. This corresponds with the controllerName field on GatewayClass.

Example: “example.net/gateway-controller”.

The format of this field is DOMAIN “/” PATH, where DOMAIN and PATH are valid Kubernetes names (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).

Controllers MUST populate this field when writing status. Controllers should ensure that entries to status populated with their ControllerName are cleaned up when they are no longer necessary.
string

EnvoyExtensionPolicy.status.ancestors[].ancestorRef

Field Description Type
group is the group of the referent.
When unspecified, “gateway.networking.k8s.io” is inferred.
To set the core API group (such as for a “Service” kind referent), Group must be explicitly set to "" (empty string).
string
kind is kind of the referent.

There are two kinds of parent resources with “Core” support:
  • Gateway (Gateway conformance profile)
  • Service (Mesh conformance profile, ClusterIP Services only)
Support for other resources is Implementation-Specific.
string
name is the name of the referent. string
namespace is the namespace of the referent. When unspecified, this refers to the local namespace of the Route.

Note that there are specific rules for ParentRefs which cross namespace boundaries. Cross-namespace references are only valid if they are explicitly allowed by something in the namespace they are referring to. For example:
Gateway has the AllowedRoutes field, and ReferenceGrant provides a generic way to enable any other kind of cross-namespace reference.
Note: This section only applies to the Gateway API experimental channel

ParentRefs from a Route to a Service in the same namespace are “producer” routes, which apply default routing rules to inbound connections from any namespace to the Service.

ParentRefs from a Route to a Service in a different namespace are “consumer” routes, and these routing rules are only applied to outbound connections originating from the same namespace as the Route, for which the intended destination of the connections are a Service targeted as a ParentRef of the Route.

string
port is the network port this Route targets. It can be interpreted differently based on the type of parent resource.

When the parent resource is a Gateway, this targets all listeners listening on the specified port that also support this kind of Route(and select this Route). It’s not recommended to set Port unless the networking behaviors specified in a Route must apply to a specific port as opposed to a listener(s) whose port(s) may be changed. When both Port and SectionName are specified, the name and port of the selected listener must match both specified values.
Note: This section only applies to the Gateway API experimental channel

When the parent resource is a Service, this targets a specific port in the Service spec. When both Port (experimental) and SectionName are specified, the name and port of the selected port must match both specified values.

Implementations MAY choose to support other parent resources.
Implementations supporting other types of parent resources MUST clearly document how/if Port is interpreted.

For the purpose of status, an attachment is considered successful as long as the parent resource accepts it partially. For example, Gateway listeners can restrict which Routes can attach to them by Route kind, namespace, or hostname. If 1 of 2 Gateway listeners accept attachment from the referencing Route, the Route MUST be considered successfully attached. If no Gateway listeners accept attachment from this Route, the Route MUST be considered detached from the Gateway.
int32
sectionName is the name of a section within the target resource. In the following resources, SectionName is interpreted as the following:
  • Gateway: Listener name. When both Port (experimental) and SectionName are specified, the name and port of the selected listener must match both specified values.
  • Service: Port name. When both Port (experimental) and SectionName are specified, the name and port of the selected listener must match both specified values.
Implementations MAY choose to support attaching Routes to other resources.
If that is the case, they MUST clearly document how SectionName is interpreted.

When unspecified (empty string), this will reference the entire resource.
For the purpose of status, an attachment is considered successful if at least one section in the parent resource accepts it. For example, Gateway listeners can restrict which Routes can attach to them by Route kind, namespace, or hostname. If 1 of 2 Gateway listeners accept attachment from the referencing Route, the Route MUST be considered successfully attached. If no Gateway listeners accept attachment from this Route, the Route MUST be considered detached from the Gateway.
string