Update upstream_cluster in EnvoyFilter

I have multiple routes (100+) defined in VirtualServices that need to be redirected to different services in separate k8s namespaces based on some header value.
The usual recommendation is to use a VirtualService that matches on headers, but due to the amount of routes it becomes unmanageable quite fast.

Is there a way to change the target service in an EnvoyFilter after the VirtualServices do the route resolution?

I would like to do something like this:

  • VirtualServices resolves path /hello to hello-service.some-namespace.svc.cluster.local
  • EnvoyFilter checks header and changes the target to hello-service.some-other-namespace.svc.cluster.local

Is this doable?