Description of the EnvoyFilterTemplate and EnvoyFilterTemplateBinding CRDs

Updated at:

ASM allows you to create Envoy filters by using Envoy filter templates (EnvoyFilterTemplate) and Envoy filter template bindings (EnvoyFilterTemplateBinding). The same Envoy filter template can create multiple Envoy filters that apply to different workloads and namespaces, which improves configuration reuse and management efficiency.

Configuration example

The following configuration specifies an Envoy filter template (EnvoyFilterTemplate). This template specifies Envoy filter template content that applies to Istio versions 1.19 and later. The configuration also specifies an Envoy filter template binding (EnvoyFilterTemplateBinding). This template binding creates an Envoy filter (EnvoyFilter) that takes effect in the istio-system namespace, which means that it takes effect globally. The Envoy filter takes effect on all data plane proxies of version 1.20. The filter content comes from the Envoy filter template defined above, which applies to Istio version 1.19 and later.

Expand to view the EnvoyFilterTemplate YAML

apiVersion: istio.alibabacloud.com/v1
kind: EnvoyFilterTemplate
metadata:
  name: seth2windows
  namespace: istio-system
spec:
  templates:
  - istioVersion: "1.19-MAX_VERSION"
    value: |
      apiVersion: networking.istio.io/v1alpha3
      kind: EnvoyFilter
      spec:
        configPatches:
        - applyTo: NETWORK_FILTER
          match:
            context: ANY
            listener:
              filterChain:
                filter:
                  name: envoy.filters.network.http_connection_manager
              portNumber: 80
          patch:
            operation: MERGE
            value:
              typed_config:
                '@type': type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
                http2_protocol_options:
                  initial_connection_window_size: 65536
                  initial_stream_window_size: 65536
        priority: 0
---
apiVersion: istio.alibabacloud.com/v1
kind: EnvoyFilterTemplateBinding
metadata:
  name: seth2windows-binding-1.20
  namespace: istio-system
spec:
  templateRef:
    istioVersion: "1.20"
    name: seth2windows
  workloads:
  - kind: Namespace
    namespace: istio-system

The preceding configuration ultimately creates the following Envoy filter:

Expand to view the EnvoyFilter YAML

apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
  labels:
    asm-system: "true"
    binding-name: seth2windows-binding-1.20
    binding-namespace: istio-system
    provider: asm
    workload-name: ""
    workload-namespace: istio-system
  name: seth2windows-binding-1.20-for-istio-system
  namespace: istio-system
spec:
  configPatches:
  - applyTo: NETWORK_FILTER
    match:
      context: ANY
      listener:
        filterChain:
          filter:
            name: envoy.filters.network.http_connection_manager
        portNumber: 80
      proxy:
        proxyVersion: ^1\.20.*
    patch:
      operation: MERGE
      value:
        typed_config:
          '@type': type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
          http2_protocol_options:
            initial_connection_window_size: 65536
            initial_stream_window_size: 65536
  priority: 0

Description of EnvoyFilterTemplate fields

EnvoyFilterTemplate defines a series of Envoy filter (EnvoyFilter) contents. These Envoy filters apply to different Istio versions. Because Envoy filters carry version compatibility risks, creating Envoy filters on your own poses significant challenges for the upgrade and maintenance of the mesh. With EnvoyFilterTemplate, customize Envoy filter content for each Istio version. After the data plane proxies are upgraded to a new version, the Envoy filter for that version can take effect on the upgraded proxies. This reduces compatibility risks.

EnvoyFilterTemplateSpec

EnvoyFilterTemplateSpec is the core configuration of EnvoyFilterTemplate, that is, the spec section.

Field

Type

Required

Description

templates

TemplateValue[]

Yes

Specifies a series of Envoy filter template values. Each template value has an applicable Istio version or version range. The applicable Istio version ranges of the template values must not overlap.

TemplateValue

Each TemplateValue specifies the YAML content of an Envoy filter and the applicable Istio version or version range that corresponds to the Envoy filter.

Field

Type

Required

Description

istioVersion

string

Yes

The Istio version or version range that the Envoy filter applies to. The version must be a minor version of Istio, such as 1.19 or 1.20. Use a hyphen (-) to join two versions, which indicates that the Envoy filter can take effect throughout the specified version range.

When you express a version range, use MIN_VERSION to represent the known minimum version and use MAX_VERSION to represent the known maximum version.

Examples:

  • "1.19": applies to version 1.19.

  • "1.18-1.20": applies to the three versions 1.18, 1.19, and 1.20.

  • "1.19-MAX_VERSION": applies to version 1.19 and later.

  • "MIN_VERSION-1.19": applies to version 1.19 and earlier.

value

string

Yes

The YAML content of the Envoy filter. The content must be a YAML string, and the YAML must conform to the Envoy filter field definitions. For the field definitions of Envoy filters, see Envoy Filter CRD reference.

The Envoy filter content defined in TemplateValue does not need to include the metadata and workloadSelector fields. These fields are populated based on the definition of the Envoy filter template binding when the Envoy filter is actually created.

Description of EnvoyFilterTemplateBinding fields

EnvoyFilterTemplateBinding is associated with an EnvoyFilterTemplate and specifies the workloads and the data plane proxy versions on which the Envoy filter content defined in the EnvoyFilterTemplate must take effect.

EnvoyFilterTemplateBindingSpec

EnvoyFilterTemplateBindingSpec is the core configuration of EnvoyFilterTemplateBinding, that is, the spec section.

Field

Type

Required

Description

templateRef

EnvoyFilterTemplateRef

Yes

The template reference, which specifies the EnvoyFilterTemplate referenced by the EnvoyFilterTemplateBinding and the bound version information.

workloads

WorkloadRef[]

No

Specifies the workloads for which Envoy filters need to be created.

EnvoyFilterTemplateRef

Field

Type

Required

Description

name

string

Yes

The name of the referenced EnvoyFilterTemplate.

istioVersion

string

Yes

Specifies the versions of data plane proxies for which the Envoy filter takes effect.

The version must be a minor version of Istio, such as 1.19 or 1.20. Use a hyphen (-) to join two versions, which indicates that the Envoy filter can take effect throughout the specified version range.

When you express a version range, use MIN_VERSION to represent the known minimum version and use MAX_VERSION to represent the known maximum version.

Examples:

  • "1.19": applies to version 1.19.

  • "1.18-1.20": applies to the three versions 1.18, 1.19, and 1.20.

  • "1.19-MAX_VERSION": applies to version 1.19 and later.

  • "MIN_VERSION-1.19": applies to version 1.19 and earlier.

WorkloadRef

WorkloadRef defines the effective scope of an Envoy filter, which allows you to specify the workloads on which the Envoy filter takes effect.

Field

Type

Required

Description

namespace

string

Yes

The namespace name, which specifies the namespace in which the Envoy filter is created.

name

string

No

The workload name. This name determines the name of the Envoy filter that is ultimately created. (Recommended) Set this field to the name of the Service or Deployment.

When the Envoy filter takes effect on the entire namespace, you do not need to set this field.

kind

string

No

Distinguishes the type of the workload that the Envoy filter is bound to. This field is used for display purposes only.

selector

map<string, string>

No

Specifies a series of labels used as the conditions for selecting pods. The labels are converted into the workloadSelector field of the Envoy filter. If you do not set this field, the created Envoy filter takes effect on the entire namespace.

References