-
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
Adds a log warning when falling back to default fake cert #3947
Adds a log warning when falling back to default fake cert #3947
Conversation
@@ -868,6 +868,7 @@ func (n *NGINXController) createServers(data []*ingress.Ingress, | |||
// read custom default SSL certificate, fall back to generated default certificate | |||
defaultCertificate, err := n.store.GetLocalSSLCert(n.cfg.DefaultSSLCertificate) | |||
if err == nil { | |||
klog.Warningf("Err loading custom default certificate, falling back to generated default:\n%v", err) |
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.
err is nil here
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.
Also, please use "Error loading...."
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.
😅 Fixed!
3438dda
to
907646e
Compare
@vncntvandriessche please change the code to something like
or the warning will flood the log |
907646e
to
2390205
Compare
@aledbf I applied the changes as you suggested: 1 thing scares me:
before my change that was an action that always happened, but would fail due to the value of I'm wondering if it would be more future-proof to write it like so: [...]
// original block
if err == nil {
defaultPemFileName = defaultCertificate.PemFileName
defaultPemSHA = defaultCertificate.PemSHA
}
// Addition
if err != nil && n.cfg.DefaultSSLCertificate != "" {
klog.Warningf("Error loading custom default certificate, falling back to generated default:\n%v", err)
}
[...] TL;DR: Just add the if-block at "Addition" under the original code instead of adding the else. |
The current code is fine. We should have a check for n.cfg.DefaultSSLCertificate not being empty in the previous version. |
Alright! Thanks for the guidance. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: aledbf, vncntvandriessche 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:
Adds a warning to the controller's log messages if a custom default certificate was passed but the controller falls back for #reason (
err
)Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #3278Special notes for your reviewer: