Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
GrigoriyMikhalkin opened this issue Aug 12, 2024 · 0 comments
Open

Comments

@GrigoriyMikhalkin
Copy link
Contributor

GrigoriyMikhalkin commented Aug 12, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant