Route specific filterchains / dynamic filter order
#11.690 geöffnet am 22. Juni 2020
Repository-Metriken
- Stars
- (27.997 Stars)
- PR-Merge-Metriken
- (Durchschn. Merge 8T) (378 gemergte PRs in 30 T)
Beschreibung
Usecase: This behaviour is desirable for Istio extensions API and related K8s Service APIs Per Target Actions
Many times at ingress there is a need to attach specific behaviours to specific paths. For example
kind: HTTPRoute
apiVersion: networking.x-k8s.io/v1alpha1
spec:
hosts:
- hostname: foo.com
rules:
- match:
path: /bar
actions:
- custom:
targetRef:
group: "proxy-vendor1.com/v1alpha1"
resource: "actions"
name: foo-com-authn
- custom:
targetRef:
group: "mesh-vendor2.com/v1alpha1"
resource: "plugins"
name: foo-com-rate-limit
- modify:
headers:
add:
example: foo
forwardTo:
- targetRef:
name: foo
There is no first class support for this.
What is possible today ?
There is a requested feature for conditional filter dispatch, with this feature or ad-doc filter specific route metadata it is possible to enable and disable filters for specific paths that can approximate the above behaviour.
Problems
a. Every filter must participate in this behaviour. If a filter does not honor filter-enable type flag then it will be dispatched even if the user did not intend it. b. Filter order cannot be changed. Filter order is statically programmed in the filter chain, and the above process can only enable or disable filters within.
Options
Add ability to specify route specific filter chains.
- The current http filterchain, becomes the default filterchain.
- User can specify a filterchain inline with the route, or refer to it by name.
- If route specific filterchain is specified, the route computation happens before dispatching anything, (unlike lazy route computation which happens today)