-
Notifications
You must be signed in to change notification settings - Fork 22
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
Fix traefik annotations as they are not working properly #31
Conversation
@alexellis Please advise whether documentation should be updated and where exactly, I'm not sure about the right place. Thank you. |
Hi thanks for the PR and issue. What kind of URLs have you tested for this fix? Have you tried subpaths and files? I.e. when serving a folder structure or varying HTTP paths with a suffix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a comment. You will find any docs we have in the readme.
@@ -513,7 +513,7 @@ func makeAnnotations(fni *faasv1.FunctionIngress) map[string]string { | |||
annotations["zalando.org/skipper-filter"] = `setPath("/function/` + fni.Spec.Function + `")` | |||
break | |||
case "traefik": | |||
annotations["traefik.ingress.kubernetes.io/rewrite-target"] = "/function/" + fni.Spec.Function + "/$1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would you say that $1 is no longer required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because traefik internally converts the annotations to the following routing rule: PathPrefix:/;ReplacePathRegex: ^/(.*) /function/podinfo/$1$1
Note the two replacements ($1
). So all request will be forwarded to the function with incorrect path (older versions of Traefik, except for the root path) or won't be routed at all because of indefinite redirects (latest versions of Traefik).
Thank you for your contribution. I've just checked and your commit doesn't appear to be signed-off. That's something we need before your Pull Request can be merged. Please see our contributing guide. |
@alexellis I tested root path, subpaths and files too. I also updated the docs. |
Please can you give an example of the FNI and the paths tested for it in the description of the PR? |
@alexellis Added. |
This is looking great. Almost ready to merge, I'd like to see a FunctionIngress that uses a path prefix now. See here: https://github.com/openfaas-incubator/ingress-operator/blob/master/README.md#schema The idea is that you can say this function is mounted on the domain at /api/blog/v1 |
Example for Nginx (I suspect you may want to remove the apiVersion: openfaas.com/v1alpha2
kind: FunctionIngress
metadata:
name: webpage
namespace: openfaas
spec:
domain: "webpage.myfaas.club"
function: "webpage"
ingressType: "nginx"
path: "/v1/web/(*.)" # Optionally set a path for the domain i.e. nodeinfo.myfaas.club/v1/profiles/ This FNI would mount the |
Thank you for your contribution. I've just checked and your commit doesn't appear to be signed-off. That's something we need before your Pull Request can be merged. Please see our contributing guide. |
@alexellis Yes, thanks for the pointer to FNIs with path. Totally forgot about this feature. I fixed the routing expression for this case, tested the changes and updated the description. |
The chart for the inlets-operator moved into the faas-netes repo here -> https://github.com/openfaas/faas-netes/tree/master/chart/openfaas/templates We tend to install it like:
Can you add I also noticed that you have some issues with the last few commits, we can't accept a merge commit in a PR, so can you do a rebase? Pick |
Despite the CRD validation not specifying Expand to view the logs: space-mini:vagrant alex$ kubectl apply -f -
|
…s except root Signed-off-by: Aleksandr Fofanov <avl.fofanov@gmail.com> Update README.md Signed-off-by: Aleksandr Fofanov <avl.fofanov@gmail.com> Fix an issue with incorrect path prefix for traefik in case when custom path defined Signed-off-by: Aleksandr Fofanov <avl.fofanov@gmail.com> Fix an issue with incorrect path prefix for traefik in case when custom path defined
@alexellis Ok, squashed all commits in one.
Yes, will try to add this on the next week. |
For the separate PR, can you just copy the code from my new PR? #33 It should be very quick to copy/paste from the new openfaas.com_functioningress.yaml file into the chart template in faas-netes. Alex |
That's merged now. How are we looking for the path usecase when specific in the FunctionIngress? |
Very much a pleasure having this quality of contribution. Thank you again. |
Sorry @alexellis , all my fault. Will pay more attention to this in the future. |
Signed-off-by: Aleksandr Fofanov avl.fofanov@gmail.com
Description
Please see the detailed description of the issue and context in #30
I've tested the changes to the annotation with the following function ingresses:
Urls tested:
Urls tested:
Motivation and Context
Fixes #30
How Has This Been Tested?
I've added the test that verifies that operator produce correct annotations for Traefik ingresses.
I also tested the changes to the annotations by following the steps described in #30
Types of changes
Impact to existing users
This change shouldn't break anything in existing deployments.
Checklist:
git commit -s