Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Standardise or document Ingress path expressions across implementations #885

Closed
wstrange opened this issue May 2, 2016 · 12 comments
Closed

Comments

@wstrange
Copy link

wstrange commented May 2, 2016

Path expressions in the Ingress are provider specific - so a path expression (say /foo/) that works in one provider does not work the same in another.

For example:
path: /foo/

Seems to result in different behaviour on GKE vs. the nginx controller.

If it is not realistic to standardise paths, the providers should document the interpretation of the path expression ( example: does /foo/ match /foo/bar?)

@bprashanth
Copy link

If you can point out the exact difference and expected behavior, we might be able to get the nginx controller to do what we want. It's obviously a lot harder to change the cloud lb formatting rules.

@wstrange
Copy link
Author

wstrange commented May 2, 2016

Are AWS and GCE the same?

If so - I'd suggest that is the behaviour we want.

@bprashanth
Copy link

What is "this"? we need to handle this on a case by case basis, we don't have bw to figure out every part of the spec each of these implement differently :)

@wstrange
Copy link
Author

wstrange commented May 2, 2016

I have no experience with AWS - so I can not help here

I appreciate the bandwidth issue, and don't have any expectations of a quick fix :-)

For now, I would suggest aligning nginx with "whatever GKE does"

If I get more time I will look at the differences between the two. For now, I just added foo/ and foo/*, and that seems to work on both

@bprashanth
Copy link

Hmm, IIUC in this case nginx is actually more lenient and accepts both foo/ and foo/* to do the same thing (i.e proxy to /foo/bar or whatever, haven't tried it yet)? If so, we should try to get "foo/" to match exactly "foo/"
@aledbf

@aledbf
Copy link
Contributor

aledbf commented May 3, 2016

@bprashanth the current behavior in the nginx controller is to not use exact match. Please check this example from the nginx docs (configuration B is how it works now).
If we can build a table with multiple examples and the expected outcome I think is possible to modify the configuration in nginx without much effort

@wstrange
Copy link
Author

wstrange commented May 3, 2016

To further clarify:
For the nginx controller, an ingress path: /foo gets translated to nginx.conf location /foo { }

This is a "prefix" match. That is, it will match /foo, /foo/bar, /foo/bar/xx, ..

On GCE, I believe two path rules need to be setup to handle this case:
/foo
/foo/*

I can't recollect if the GCE ingress controller does this or not (may get time to test later this week). If not- setting up those two rules would seem to make the implementations align.

I believe I previously had a trailing / on my path:
path: /foo/

Which caused some of my prior confusion.

@wstrange
Copy link
Author

Update: GCE ingress controller does not add a wildcard to a path expression.

To get the same behaviour as Nginx, you need two path expressions in the ingress definition:
path: /foo
path: /foo/*

Which is equivalent to:
path: /foo

on Nginx.

This is unfortunate that the same ingress definition can not be used on both controllers.

@bprashanth
Copy link

yeah so /foo is exactly foo and if you want anything more, you need foo/*. I think this conflicts with the nginx defaults as pointed out in #885 (comment)

@gjcarneiro
Copy link

I've been wondering the opposite: how to have an exact match for a path with the nginx controller. Any idea?

@gjcarneiro
Copy link

My use case is that I have a web application pod with 3 containers:

  1. /static should go to the frontend (nginx static files) container
  2. / should go to the landing page container
  3. everything else should go to the backend container

The problem is that for 2 I need to match exactly the path /, but not backend-y things like /login, while for 3 I need to match "every thing else", which has been / up until now.

I would love to have GCE-style ingress path rules in the contrib nginx controller.

@thockin
Copy link
Contributor

thockin commented Apr 4, 2017

This issue was moved to kubernetes/ingress-nginx#555

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

No branches or pull requests

6 participants