-
Notifications
You must be signed in to change notification settings - Fork 504
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
Optional path consuming for the ingress identifier #1144
Comments
Isn't the path identifier intended to be used for routing? At least that's how the mainstream implementations are behaving. E.g. given the configuration below,
I actually don't see any need for providing additional vendor specific configuration. Please correct me if I'm wrong.. :) |
Hi @21stio, in your example yes |
Alright, got it. Makes total sense :) |
I completely agree with this being an annotation similar to what the "rewrite" annotation does on NGINX controller configurations. It could allow us to namespace apps by path which could help in directing to different versions etc. |
We are currently using Traefik and we need this feature, so we'd like to implement it. Any pointers regarding API and implementation are very much welcome. I propose the simplest implementation, with a similar behavior to Traefik's
In our case, adding Example, given ingress definition:
and a request for path As an additional or alternative configuration method we could use:
|
Great @pawelprazak ! I'm happy to help. Currently the ingress annotations are read here. The linkerd ingress identifier matches paths based on regex, not path prefix (we took this idea from k8s type definitions, even though most other ingress controllers don't seem to behave this way). So without the concept of a prefix, we don't know how much of the path to strip and how much of the path to keep. One solution is to keep the regex and specify number of segments to consume, like the path identifier does. Another is to change the path matching behavior to be prefix-based and then use the definition you've described. I'm not thrilled with either one of these options honestly 😅 , but either one should do the job. Folks should chime in if they have strong opinions about it. |
Thank you for your thoughts, esp. for pointing out the k8s API, I was not aware it explicitly allows regexps. Our current quick and dirty implementation just strips the request path using the ingress path as the prefix. As far as I understand what you wrote, it would brake the existing behavior. IMHO the segments consumption, like in path identifier, is not very useful, it fails for a simple use case we have, e.g.:
You can either match the first 2 path prefixes or the last one, not all 3. A third option would be to use capturing groups, so with a flag
We could also skip the flag and just leave the path as is if there is no capture group hits, but that feel error prone. |
Good feedback! |
Problem Missing feature for ingress identifier path rewriting Solution Use regexp capture groups as the rewritten path segments Validation Unit testing Fixes linkerd#1144
Problem Missing feature for ingress identifier path rewriting Solution Use regexp capture groups as the rewritten path segments Validation Unit testing Fixes linkerd#1144
I've created a PR with an initial version to get some feedback early. TODO:
|
Cool! Convened w/ @adleong and it seems like the h2 requests's |
Problem Missing feature for ingress identifier path rewriting Solution Use regexp capture groups as the rewritten path segments Validation Unit testing Fixes linkerd#1144
Problem Missing feature for ingress identifier path rewriting Solution Use regexp capture groups as the rewritten path segments Validation Unit testing Fixes linkerd#1144
Problem Missing feature for ingress identifier path rewriting Solution Use regexp capture groups as the rewritten path segments Validation Unit testing Fixes linkerd#1144
Problem Missing feature for ingress identifier path rewriting Solution Use regexp capture groups as the rewritten path segments Validation Unit testing Fixes linkerd#1144
Problem Missing feature for ingress identifier path rewriting Solution Use regexp capture groups as the rewritten path segments Validation Unit testing Fixes linkerd#1144
Problem Missing feature for ingress identifier path rewriting Solution Use regexp capture groups as the rewritten path segments Validation Unit testing Fixes linkerd#1144
Problem Missing feature for ingress identifier path rewriting Solution Use regexp capture groups as the rewritten path segments Validation Unit testing Fixes linkerd#1144
Problem Missing feature for ingress identifier path rewriting Solution Use regexp capture groups as the rewritten path segments Validation Unit testing Fixes linkerd#1144
Problem Missing feature for ingress identifier path rewriting Solution Use regexp capture groups as the rewritten path segments Validation Unit testing Fixes linkerd#1144
Problem Missing feature for ingress identifier path rewriting Solution Use regexp capture groups as the rewritten path segments Validation Unit testing Fixes linkerd#1144
Problem Missing feature for ingress identifier path rewriting Solution Use regexp capture groups as the rewritten path segments Validation Unit testing Fixes linkerd#1144
Problem Missing feature for ingress identifier path rewriting Solution Use regexp capture groups as the rewritten path segments Validation Unit testing Fixes linkerd#1144
The comments in Outbound::recognize had become somewhat stale as the logic changed. Furthermore, this implementation may be easier to understand if broken into smaller pieces. This change reorganizes the Outbound:recognize method into helper methods--`destination`, `host_port`, and `normalize`--each with accompanying docstrings that more accurately reflect the current implementation. This also has the side-effect benefit of eliminating a string clone on every request.
Similar to the path identifier, I suspect most folks will want the l5d ingress controller consume the beginning of the path used for routing.
One way to do this would be with ingress resource annotations, something like
Another would be in the linkerd config:
Or we could support both? I'm leaning towards ingress resource annotations since it would be the most flexible for users.
The text was updated successfully, but these errors were encountered: