Skip to content

networking: ignore routes with same HTTP match as a preceding source match #4239

@rshriram

Description

@rshriram
route:
 - match:
     source: foobar
     gateways: scooby
     httpMatch: 
       uri: /abc
       host: xyz
    destination:
    - name: abcservice
- match:
     httpMatch: 
       uri: /abc
       host: xyz
    destination:
    - name: totally-different-service
    fault:
    - add-10s-delay
    mirror:
    -...

The example configuration above has two routes, that have the same HTTP match conditions, with one route having additional source/gateway match conditions. When processing rules like the one above, rules that have source match must override any other rule that has no-source-match+same-http-match conditions.

Something like the following is needed.

for each route, 
       if source == route.source
            context.source_http_match = route.http_match
            add route..
       else if route.source == nil and route.http_match == context.source_http_match, 
             ignore route

This logic is needed in both RDS and LDS (fault filters). The latter logic will go away once we have route-local filter stacks.

Without this, we have a potential correctness issue, as filters added for later rules will end up being active (the example in this case being the fault filter).

cc @louiscryan @ZackButcher @frankbu

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions