EnvoyFilter gives "spec.configPatches.match.listener: Required value" error for everything

Hi,

I’m trying to add an EnvoyFilter. Although i provided the required “routeConfiguration” object under “configPatches.match”, i still got the below error.

“Invalid value: “”: “spec.configPatches.match” must validate one and only one schema (oneOf). Found none valid.”
“spec.configPatches.match.listener: Required value”

according to the docs, it can be either listener, route configuration, or cluster. https://istio.io/docs/reference/config/networking/envoy-filter/#EnvoyFilter-EnvoyConfigObjectMatch

I’m basically stuck :slightly_smiling_face: Any help will be appreciated, thanks
Erkan

apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
  name: cache-agent-routing
  namespace: default
spec:
  workloadSelector:
    labels:
      app: suggestion-api
  configPatches:
  - applyTo: ROUTE_CONFIGURATION
    match:
      context: SIDECAR_INBOUND
      routeConfiguration:
        portNumber: 8080
        vhost:
          name: "suggestion-api.*:8080"
    patch:
      operation: MERGE
      value:
        routes:
          - match:
            - prefix: "/service/1"
              headers:
                  - name: "x-use-cache"
                    exact_match: "true"
            route:
              cluster: cache-agent
  - applyTo: CLUSTER
    match:
      context: SIDECAR_INBOUND
    patch:
      operation: ADD
      value: 
        name: "cache-agent"
        type: STATIC
        connect_timeout: 0.5s
        lb_policy: ROUND_ROBIN
        hosts:
        - socket_address:
            protocol: HTTP
            address: 127.0.0.1
            port_value: 8081

Hey @Erkan_Durmaz,

on your second applyTo you use a match, but don’t offer a required field, such as a listener:

- applyTo: CLUSTER
 match:
  context: SIDECAR_INBOUND
->here you are missing listener:
patch:
  operation: ADD

thanks @Eneminemoe :+1:

I managed to make it work using a cluster object instead of a listener

   - applyTo: CLUSTER
      match:
        context: SIDECAR_INBOUND
        cluster:
            name: cache-agent
      patch:
        operation: ADD
        value: 
          name: cache-agent
          type: STATIC
          connect_timeout: 0.5s
          http2_protocol_options: {}
          lb_policy: ROUND_ROBIN
          load_assignment: 
            cluster_name: cache-agent
            endpoints:
              - lb_endpoints:
                - endpoint:
                    address:
                      socket_address:
                        address: 127.0.0.1
                        port_value: 8081
1 Like