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

Standardise or document Ingress path expressions across implementations #885

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

Comments

Projects
None yet
6 participants
@wstrange

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

This comment has been minimized.

Member

bprashanth commented May 2, 2016

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

This comment has been minimized.

wstrange commented May 2, 2016

Are AWS and GCE the same?

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

@bprashanth

This comment has been minimized.

Member

bprashanth commented May 2, 2016

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

This comment has been minimized.

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

This comment has been minimized.

Member

bprashanth commented May 2, 2016

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

This comment has been minimized.

Member

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

This comment has been minimized.

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

This comment has been minimized.

wstrange commented May 11, 2016

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

This comment has been minimized.

Member

bprashanth commented May 11, 2016

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

This comment has been minimized.

gjcarneiro commented Feb 13, 2017

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

@gjcarneiro

This comment has been minimized.

gjcarneiro commented Feb 14, 2017

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

This comment has been minimized.

Member

thockin commented Apr 4, 2017

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

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