-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add disable path overlap validation flag #1
Conversation
ea9a732
to
304fd94
Compare
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.
Left some nits and a suggestion that needs to be tested.
if disablePathOverlapValidation { | ||
return nil | ||
} | ||
|
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.
Wouldn't we get the same behaviour if this check was done over the entire function call? I have not tried it, but reading the code seems we would get the same behaviour and a nicer API (no boolean parameter). Have you tested it?
|
||
err = nginx.CheckIngress(duplicatedIngress) | ||
if err == nil { | ||
t.Errorf("expected errors but noone occurred") |
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.
t.Errorf("expected errors but noone occurred") | |
t.Errorf("expected errors but none occurred") |
if err == nil { | ||
t.Errorf("expected errors but noone occurred") | ||
} | ||
t.Run("if disablePathOverlap is enabled should not throw any error", func(t *testing.T) { |
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.
t.Run("if disablePathOverlap is enabled should not throw any error", func(t *testing.T) { | |
t.Run("when disablePathOverlap is enabled should not throw any error", func(t *testing.T) { |
304fd94
to
6a54322
Compare
@miguelbernadi addressed can you check? |
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.
Thank you for addressing the comments! Looks good.
## What this PR does / why we need it: In kubernetes#5651 there was a request to throw an error when there are two ingresses defining the same host and path, which was implemented as part of the validation webhook. Despite of this there are clear rules on the ingress controller that describes what the controller would do in [such situation (the oldest rule wins)](https://github.com/kubernetes/ingress-nginx/blob/main/docs/how-it-works.md?plain=1#L27) Some users are relying on this validation behaviour to prevent misconfigurations, but there are use cases where allowing it, maybe temporarily, is helpful. Change-Id: I9d4124d1c36876b06d63100cd10988eaf2f41db9
6a54322
to
e8a10e1
Compare
What this PR does / why we need it:
In kubernetes#5651 there was a request to throw an error when there are two ingresses defining the same host and path, which was implemented as part of the validation webhook.
Despite of this there are clear rules on the ingress controller that
describes what the controller would do in such situation (the oldest rule wins)
Some users are relying on this validation behaviour to prevent
misconfigurations, but there are use cases where allowing it, maybe temporarily, is helpful. Those use cases includes: