{
  "properties": {
    "spec": {
      "description": "Customizing Envoy configuration generated by Istio. See more details at: https://istio.io/docs/reference/config/networking/envoy-filter.html",
      "properties": {
        "configPatches": {
          "description": "One or more patches with match conditions.",
          "items": {
            "properties": {
              "applyTo": {
                "description": "Specifies where in the Envoy configuration, the patch should be applied.\n\nValid Options: LISTENER, FILTER_CHAIN, NETWORK_FILTER, HTTP_FILTER, ROUTE_CONFIGURATION, VIRTUAL_HOST, HTTP_ROUTE, CLUSTER, EXTENSION_CONFIG, BOOTSTRAP, LISTENER_FILTER",
                "enum": [
                  "INVALID",
                  "LISTENER",
                  "FILTER_CHAIN",
                  "NETWORK_FILTER",
                  "HTTP_FILTER",
                  "ROUTE_CONFIGURATION",
                  "VIRTUAL_HOST",
                  "HTTP_ROUTE",
                  "CLUSTER",
                  "EXTENSION_CONFIG",
                  "BOOTSTRAP",
                  "LISTENER_FILTER"
                ],
                "type": "string"
              },
              "match": {
                "description": "Match on listener/route configuration/cluster.",
                "oneOf": [
                  {
                    "not": {
                      "anyOf": [
                        {
                          "required": [
                            "listener"
                          ]
                        },
                        {
                          "required": [
                            "routeConfiguration"
                          ]
                        },
                        {
                          "required": [
                            "cluster"
                          ]
                        }
                      ]
                    }
                  },
                  {
                    "required": [
                      "listener"
                    ]
                  },
                  {
                    "required": [
                      "routeConfiguration"
                    ]
                  },
                  {
                    "required": [
                      "cluster"
                    ]
                  }
                ],
                "properties": {
                  "cluster": {
                    "description": "Match on envoy cluster attributes.",
                    "properties": {
                      "name": {
                        "description": "The exact name of the cluster to match.",
                        "type": "string"
                      },
                      "portNumber": {
                        "description": "The service port for which this cluster was generated.",
                        "maximum": 4294967295,
                        "minimum": 0,
                        "type": "integer"
                      },
                      "service": {
                        "description": "The fully qualified service name for this cluster.",
                        "type": "string"
                      },
                      "subset": {
                        "description": "The subset associated with the service.",
                        "type": "string"
                      }
                    },
                    "type": "object",
                    "additionalProperties": false
                  },
                  "context": {
                    "description": "The specific config generation context to match on.\n\nValid Options: ANY, SIDECAR_INBOUND, SIDECAR_OUTBOUND, GATEWAY",
                    "enum": [
                      "ANY",
                      "SIDECAR_INBOUND",
                      "SIDECAR_OUTBOUND",
                      "GATEWAY"
                    ],
                    "type": "string"
                  },
                  "listener": {
                    "description": "Match on envoy listener attributes.",
                    "properties": {
                      "filterChain": {
                        "description": "Match a specific filter chain in a listener.",
                        "properties": {
                          "applicationProtocols": {
                            "description": "Applies only to sidecars.",
                            "type": "string"
                          },
                          "destinationPort": {
                            "description": "The destination_port value used by a filter chain's match condition.",
                            "maximum": 4294967295,
                            "minimum": 0,
                            "type": "integer"
                          },
                          "filter": {
                            "description": "The name of a specific filter to apply the patch to.",
                            "properties": {
                              "name": {
                                "description": "The filter name to match on.",
                                "type": "string"
                              },
                              "subFilter": {
                                "description": "The next level filter within this filter to match upon.",
                                "properties": {
                                  "name": {
                                    "description": "The filter name to match on.",
                                    "type": "string"
                                  }
                                },
                                "type": "object",
                                "additionalProperties": false
                              }
                            },
                            "type": "object",
                            "additionalProperties": false
                          },
                          "name": {
                            "description": "The name assigned to the filter chain.",
                            "type": "string"
                          },
                          "sni": {
                            "description": "The SNI value used by a filter chain's match condition.",
                            "type": "string"
                          },
                          "transportProtocol": {
                            "description": "Applies only to `SIDECAR_INBOUND` context.",
                            "type": "string"
                          }
                        },
                        "type": "object",
                        "additionalProperties": false
                      },
                      "listenerFilter": {
                        "description": "Match a specific listener filter.",
                        "type": "string"
                      },
                      "name": {
                        "description": "Match a specific listener by its name.",
                        "type": "string"
                      },
                      "portName": {
                        "type": "string"
                      },
                      "portNumber": {
                        "description": "The service port/gateway port to which traffic is being sent/received.",
                        "maximum": 4294967295,
                        "minimum": 0,
                        "type": "integer"
                      }
                    },
                    "type": "object",
                    "additionalProperties": false
                  },
                  "proxy": {
                    "description": "Match on properties associated with a proxy.",
                    "properties": {
                      "metadata": {
                        "additionalProperties": {
                          "type": "string"
                        },
                        "description": "Match on the node metadata supplied by a proxy when connecting to Istio Pilot.",
                        "type": "object"
                      },
                      "proxyVersion": {
                        "description": "A regular expression in golang regex format (RE2) that can be used to select proxies using a specific version of istio proxy.",
                        "type": "string"
                      }
                    },
                    "type": "object",
                    "additionalProperties": false
                  },
                  "routeConfiguration": {
                    "description": "Match on envoy HTTP route configuration attributes.",
                    "properties": {
                      "gateway": {
                        "description": "The Istio gateway config's namespace/name for which this route configuration was generated.",
                        "type": "string"
                      },
                      "name": {
                        "description": "Route configuration name to match on.",
                        "type": "string"
                      },
                      "portName": {
                        "description": "Applicable only for GATEWAY context.",
                        "type": "string"
                      },
                      "portNumber": {
                        "description": "The service port number or gateway server port number for which this route configuration was generated.",
                        "maximum": 4294967295,
                        "minimum": 0,
                        "type": "integer"
                      },
                      "vhost": {
                        "description": "Match a specific virtual host in a route configuration and apply the patch to the virtual host.",
                        "properties": {
                          "name": {
                            "description": "The VirtualHosts objects generated by Istio are named as host:port, where the host typically corresponds to the VirtualService's host field or the hostname of a service in the registry.",
                            "type": "string"
                          },
                          "route": {
                            "description": "Match a specific route within the virtual host.",
                            "properties": {
                              "action": {
                                "description": "Match a route with specific action type.\n\nValid Options: ANY, ROUTE, REDIRECT, DIRECT_RESPONSE",
                                "enum": [
                                  "ANY",
                                  "ROUTE",
                                  "REDIRECT",
                                  "DIRECT_RESPONSE"
                                ],
                                "type": "string"
                              },
                              "name": {
                                "description": "The Route objects generated by default are named as default.",
                                "type": "string"
                              }
                            },
                            "type": "object",
                            "additionalProperties": false
                          }
                        },
                        "type": "object",
                        "additionalProperties": false
                      }
                    },
                    "type": "object",
                    "additionalProperties": false
                  }
                },
                "type": "object",
                "additionalProperties": false
              },
              "patch": {
                "description": "The patch to apply along with the operation.",
                "properties": {
                  "filterClass": {
                    "description": "Determines the filter insertion order.\n\nValid Options: AUTHN, AUTHZ, STATS",
                    "enum": [
                      "UNSPECIFIED",
                      "AUTHN",
                      "AUTHZ",
                      "STATS"
                    ],
                    "type": "string"
                  },
                  "operation": {
                    "description": "Determines how the patch should be applied.\n\nValid Options: MERGE, ADD, REMOVE, INSERT_BEFORE, INSERT_AFTER, INSERT_FIRST, REPLACE",
                    "enum": [
                      "INVALID",
                      "MERGE",
                      "ADD",
                      "REMOVE",
                      "INSERT_BEFORE",
                      "INSERT_AFTER",
                      "INSERT_FIRST",
                      "REPLACE"
                    ],
                    "type": "string"
                  },
                  "value": {
                    "description": "The JSON config of the object being patched.",
                    "type": "object",
                    "x-kubernetes-preserve-unknown-fields": true
                  }
                },
                "type": "object",
                "additionalProperties": false
              }
            },
            "type": "object",
            "additionalProperties": false
          },
          "type": "array"
        },
        "priority": {
          "description": "Priority defines the order in which patch sets are applied within a context.",
          "format": "int32",
          "type": "integer"
        },
        "targetRefs": {
          "description": "Optional.",
          "items": {
            "properties": {
              "group": {
                "description": "group is the group of the target resource.",
                "maxLength": 253,
                "pattern": "^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$",
                "type": "string"
              },
              "kind": {
                "description": "kind is kind of the target resource.",
                "maxLength": 63,
                "minLength": 1,
                "pattern": "^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$",
                "type": "string"
              },
              "name": {
                "description": "name is the name of the target resource.",
                "maxLength": 253,
                "minLength": 1,
                "type": "string"
              },
              "namespace": {
                "description": "namespace is the namespace of the referent.",
                "type": "string",
                "x-kubernetes-validations": [
                  {
                    "message": "cross namespace referencing is not currently supported",
                    "rule": "self.size() == 0"
                  }
                ]
              }
            },
            "required": [
              "kind",
              "name"
            ],
            "type": "object",
            "x-kubernetes-validations": [
              {
                "message": "Support kinds are core/Service and gateway.networking.k8s.io/Gateway",
                "rule": "[self.group, self.kind] in [['core','Service'], ['','Service'], ['gateway.networking.k8s.io','Gateway']]"
              }
            ],
            "additionalProperties": false
          },
          "type": "array"
        },
        "workloadSelector": {
          "description": "Criteria used to select the specific set of pods/VMs on which this patch configuration should be applied.",
          "properties": {
            "labels": {
              "additionalProperties": {
                "type": "string"
              },
              "description": "One or more labels that indicate a specific set of pods/VMs on which the configuration should be applied.",
              "type": "object"
            }
          },
          "type": "object",
          "additionalProperties": false
        }
      },
      "type": "object",
      "additionalProperties": false
    },
    "status": {
      "type": "object",
      "x-kubernetes-preserve-unknown-fields": true
    }
  },
  "type": "object"
}
