skipper
skipper copied to clipboard
Be able to target "dynamic" backend containing variable extracted from PathSubtree
Is your feature request related to a problem? Please describe.
We have 2 use cases:
- We are deploying code branches to a cluster say
custer-test
. Those branches can be accessed withhttps://domain/branches/:buildVersion
iehttps://domain/branches/pr-123
We have a unique skipper route mapping those to a single unique host: https://domain-branches
.
Every branch deployment then exposes its own ingress with the following:
zalando.org/skipper-predicate: PathSubtree("/{{{BUILD_VERSION}}}")
zalando.org/skipper-filter: compress() -> modPath("^/{{{BUILD_VERSION}}}", "")
We then have a kubernetes ingress exposing this single unique host but every ingress "filters out" the request if its not its own BUILD_VERSION.
- When using stackset with stateful code logic where we do an API call from the browser to our stack. Currently it is mapped to the generic hostname of the stack. ie
https://engine
We want to be able to route calls such as/api/:buildVersion/
to the correct buildVersion stack. Currently it is not possible to do it at skipper level easily so we have again different ingress (managed by stacksets in this case) with the same logicskipper-predicate, skipper-filter
combo to handle the traffic correctly.
Downsides in both cases:
- Some extra configuration on kubernetes ingress level
- Ingress based RPS scaling is broken because all ingress "treats" all requests (tested and confirmed)
Describe the solution you would like
Be able to extract route parameter such as buildVersion in /api/:buildVersion/...
and target dynamically a backend as a result: https://engine.buildVersion
Describe alternatives you've considered (optional) Already described above with kubernetes ingress and skipper-filter / skipper-predicate
Additional context (optional) I am a Zalando employee and this is for Zalando internal use cases. Can provide more detalled information on our current setup.
Would you like to work on it? No
Thanks for describing the issue!
If I get it right the idea is to use path parameter in the backend hostname.
This is possible with a help of template placeholders and a route:
PathSubtree("/api/:buildVersion") ->
setRequestHeader("X-Backend", "https://${buildVersion}-domain.test") ->
setDynamicBackendUrlFromHeader("X-Backend") ->
setPath("/") ->
<dynamic>
Note that setDynamicBackendUrlFromHeader
does not change path, setPath
filter can be used for that.
We may think about adding template placeholder support directly into setDynamicBackend*
filters to avoid auxiliary header.
@jeremycolin can you check if @AlexanderYastrebov got your feature request correctly? thanks!