Skip to content

linkerd-proxy: allow to add custom headers to outgoing requests #12957

Closed
@GrigoriyMikhalkin

Description

@GrigoriyMikhalkin

What problem are you trying to solve?

I encountered a following case recently. There is multiple versions of a service. Routing to different versions is implemented via matching a certain header(set via HTTPRoute).

Each instance of a service needs to pull it's config from configuration service. Configuration could be different for different versions of a service. So service needs to somehow let the configuration service to know about it's version. The "version" of a service is set as a label in a Pod, but service itself doesn't know anything about it.

Ideally, we would want to keep service completely unaware about it's "version".

How should the problem be solved?

Obvious first idea was to make linkerd-proxy somehow to add header which is based on label | annotation | envvar. As an analogue -- Envoy allows to add custom headers to outgoing requests using custom filters.

As custom filters are unsupported by linkerd-proxy at the moment, it could be possible, instead, to introduce new annotation for a proxy: config.linkerd.io/proxy-custom-header -- which would accept a string of the following format: "label1,...,labelN" -- label names separated by comma. Proxy then would use these labels to set additional headers on all outgoing requests.

Any alternatives you've considered?

The alternative would be to let services now about their versions explicitly(using K8s downward API could be an option). Which would be implemented in common core libraries for multiple languages -- which is quite inconvenient from maintenance perspective.

How would users interact with this feature?

Introduce a new annotation for proxy: config.linkerd.io/proxy-custom-header -- which would accept a string of the following format: "label1,...,labelN" -- label names separated by comma.

Would you like to work on this feature?

yes

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions