How to use the io.l5d.replace transformer

What use-case is the io.l5d.replace transformer filling?

And does it evaluate the dtab again, or is it limited to /$/inet?

The replace transformer simply replaces one client name with another, assuming the first name was valid. Transformation takes place after the dtab is applied so the dtab is not applied to the replacement name. Therefore, the replacement name must be a concrete client name such as /$/inet/google.com/80 or /#/io.l5d.k8s/default/http/foo.

Thanks Alex. This looks like a powerful feature, but I don’t quite see a concrete use-case. Why would one replace with a single service name? Is this for forwarding to an other proxy, after checking availability in a service registry?

First of all, I’m not aware of anyone using this transformer so we don’t have any real-world use-cases. But, yes, it was designed for forwarding to other proxies. For example, when sending a request to a service running inside some cluster, you may want to check that the service exists but then send the request to an ingress point rather than to the service directly.

(although in Kubernetes this can usually be accomplished with the io.l5d.k8s.external namer)

1 Like