---
# Source: poc/templates/envoyfilter-url-concurrency.yaml
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
  name: poc-url-concurrency-ef
  namespace: "poc-iut-ns"
spec:
  # Stable ordering; route-policy inheritance is not implied by this priority.
  priority: -10
  workloadSelector:
    labels:
      app: poc-cmc
  configPatches:
  - applyTo: CLUSTER
    match:
      context: SIDECAR_INBOUND
    patch:
      operation: ADD
      value:
        name: debitCreditTxn-v2
        type: STATIC
        load_assignment:
          cluster_name: debitCreditTxn-v2
          endpoints:
          - lb_endpoints:
            - endpoint:
                address:
                  socket_address:
                    address: 127.0.0.1
                    port_value: 8080
        circuit_breakers:
          thresholds:
          - max_requests: 50
  - applyTo: HTTP_ROUTE
    match:
      context: SIDECAR_INBOUND
      routeConfiguration:
        vhost:
          name: inbound|http|8080
    patch:
      operation: INSERT_FIRST
      value:
        name: debitCreditTxn-v2
        match:
          prefix: /
          headers:
          - name: "REQUEST-URL"
            string_match:
              exact: "/clearing-settlement/casa-payment-upi/debitCreditTxn/v2"
        route:
          cluster: debitCreditTxn-v2
          timeout: 0s

          # Istio merges existing routes before inserting new ones. Carry the
          # enabled descriptor actions here; buckets remain in their own filters.
          rate_limits:

          - actions:
            - request_headers:
                header_name: "REQUEST-URL"
                descriptor_key: path


          - actions:
            - request_headers:
                header_name: PRODUCT-PROCESSOR
                descriptor_key: pp
