-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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-catch-all option to disable catch-all server #3586
Conversation
5df1e69
to
8fd7508
Compare
Test failure seems legit. |
dc310a6
to
d106817
Compare
d106817
to
1678d99
Compare
@ElvinEfendi it's all good 🎉 |
Can you be more specific? |
/approve |
@ElvinEfendi ping |
klog.Infof("creating ingress %v based on annotation %v", curIng.Name, class.IngressKey) | ||
recorder.Eventf(curIng, corev1.EventTypeNormal, "CREATE", fmt.Sprintf("Ingress %s/%s", curIng.Namespace, curIng.Name)) | ||
} else if validOld && !validCur { | ||
klog.Infof("removing ingress %v based on annotation %v", curIng.Name, class.IngressKey) | ||
// FIXME: this does not actually delete the Ingress resource. | ||
// The existing one will be updated with latest changes and invalid ingress.class will be missed. | ||
recorder.Eventf(curIng, corev1.EventTypeNormal, "DELETE", fmt.Sprintf("Ingress %s/%s", curIng.Namespace, curIng.Name)) |
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.
@aledbf is this an intended behaviour of the controller to not ignore an ingress after it changes its class to something that's not handled by ingress-nginx?
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.
No, this is a bug introduced when I added a copy of the Ingress with annotations. We should remove the ingress from the local store (store.listers.IngressWithAnnotation.Delete(oldIng)
)
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.
Alright, we will fix it in a subsequent PR then.
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.
👍 I'll have a look
klog.Infof("ignoring update for catch-all ingress %v/%v because of --disable-catch-all", curIng.Namespace, curIng.Name) | ||
// FIXME: this does not actually delete the Ingress resource. | ||
// The existing one will be updated with latest changes. | ||
recorder.Eventf(curIng, corev1.EventTypeNormal, "DELETE", fmt.Sprintf("Ingress %s/%s", curIng.Namespace, curIng.Name)) |
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 are you not deleting ingress here? To keep it consistent with the valid class
behaviour? If so then why are you recording DELETE
event rather than UPDATE
?
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.
This has the same behavior has the valid class
check. It records a DELETE
event, but don't actually delete it.
I wanted more feedback on this issue before trying any fix here.
I've quickly tested to call the DeleteFunc handler when needed here and it works as expected. But I'm not 100% sure this is the solution.
Also, I think this should be fixed in a 2nd PR (that can be merge before this one).
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.
👍
f.WaitForNginxServer("_", func(cfg string) bool { | ||
return strings.Contains(cfg, `set $ingress_name ""`) && | ||
strings.Contains(cfg, `set $proxy_upstream_name "upstream-default-backend"`) | ||
}) |
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.
While this works, it leaks internals of Nginx configuration to the test. I know we do it in another e2e tests, but here we can avoid this and test the functionality by sending a request and asserting that the response is 404.
Similarly instead of https://github.com/kubernetes/ingress-nginx/pull/3586/files#diff-cb7b9b28ba2a89db95d178caee979d06R57 you can send a request and assert 200 response code.
/lgtm In the subsequent PR we should also consider testing this case https://github.com/kubernetes/ingress-nginx/pull/3586/files#diff-ece58b3bebec02a6d3173c8d8099d298R348. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: aledbf, ElvinEfendi, wayt The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
This PR adds the possibility to disable
catch-all
Ingress.It's turned off by default.
When turned on, all Ingress that defines a
.spec.backend
will be ignored on the store level.Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #Special notes for your reviewer:
A bug with Ingress update handler has been found while working on this.
I did not fix it here as it's unrelated.