Page MenuHomePhabricator

Develop a service-mesh HTTP client for service-utils
Open, MediumPublic

Description

Current state

In order to use the service mesh, teams generally need to implement some form of the following for their desired HTTP client:

  1. Rewrite the target URL to replace the hostname portion with the host:port of the local envoy listener for that service.
  2. Set the Host header to the previously rewritten hostname portion in #1.
  3. Deal with redirects (e.g., an absolute redirect that again needs rewriting as in #1 and #2).

This is further complicated by the fact that not all HTTP clients will allow #2 - e.g., Node's native fetch (i.e., not node-fetch) now exhibits similar behavior to that dictated by the Fetch API, namely that the Host header cannot be overridden in code (note: opinions vary on why Node behaves this way, in terms of whether it's an intentional effort to comply with the API specification or not).

Definition of done (DRAFT)

An experimental service-utils feature that provides a batteries-included implementation of the high-level rewriting logic described above, built on an actively maintained (i.e., not preq) HTTP client in common use among Node.js services at WMF (e.g., Axios).

As part of this, a new template helper should be introduced in the mesh.configuration helm chart module, so that service owners can easily inject a manifest of enabled mesh listeners into their application's configuration.

Event Timeline

Scott_French triaged this task as Medium priority.
Scott_French moved this task from Inbox to Scheduled (this Q) on the ServiceOps new board.

A reasonably complete proof of concept for the service-utils side of this can be found in the feature/axois-mesh-client branch there.