-
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
Do not validate ingresses with unknown ingress class in admission webhook endpoint #8221
Do not validate ingresses with unknown ingress class in admission webhook endpoint #8221
Conversation
@ElvinEfendi: This issue is currently awaiting triage. If Ingress contributors determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/hold I need to add e2e tests too, but please take a look and let me know if the approach makes sense. |
@@ -233,6 +233,10 @@ func (n *NGINXController) CheckIngress(ing *networking.Ingress) error { | |||
return nil | |||
} | |||
|
|||
if ingressClass, err := n.store.GetIngressClass(ing, n.cfg.IngressClassConfiguration); ingressClass == "" { | |||
klog.Warningf("ignoring ingress %v in %v based on annotation %v: %v", ing.Name, ing.ObjectMeta.Namespace, ingressClass, err) |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
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.
What if err != 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.
GetIngressClass
is kinda strange, err
actually going to be != nil as long as ingressClass == ""
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.
agreed, unless some day we change GetIngressClass and the function returns a strange value due to...reasons...and an error and as we are just validating the IngressClass we end into a panic :P
I agree with you that right now this is too much, I'm afraid of us in a future doing something that relies on this error, not checking and getting a BSOD in ingress controller
pull-ingerss-nginx-test failure does not seem related to the changes here 🤔
EDIT: turned out to be related, I missed |
/assign |
@@ -98,6 +98,9 @@ type Storer interface { | |||
|
|||
// Run initiates the synchronization of the controllers | |||
Run(stopCh chan struct{}) | |||
|
|||
// GetIngressClass validates given ingress against ingress class configuration and returns the ingress class. | |||
GetIngressClass(ing *networkingv1.Ingress, icConfig *ingressclass.IngressClassConfiguration) (string, error) |
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.
a bit afraid here of expanding the interface, but we gotta solve this :) so lgtm
/lgtm The approach seems ok to me. My only request is that we don't ignore that error, even if it always returns nil right now :) |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ElvinEfendi, rikatz 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 |
/hold cancel |
What this PR does / why we need it:
Types of changes
Which issue/s this PR fixes
fixes #7546
How Has This Been Tested?
Checklist: