-
Notifications
You must be signed in to change notification settings - Fork 2k
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 error-log-level configmap key #342
Conversation
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.
Looks great, thanks. Just a few small changes.
Please add this config map key to the table in the customization example readme.
You've changed the default log level for NGINX OSS - I think that's fine, we'll need to add it to the release notes.
A small naming issue, I've commented.
Thanks!
nginx-controller/nginx/config.go
Outdated
@@ -49,6 +49,7 @@ type Config struct { | |||
HealthCheckMandatory bool | |||
HealthCheckMandatoryQueue int64 | |||
SlowStart string | |||
LogLevel string |
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.
Please rename to MainLogLevel or MainErrorLogLevel -- settings that go in the main nginx config file have a "Main" prefix.
You may also want to rename the config map key to Text for the customization readme: Thanks |
I renamed the config map key to |
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.
thanks @boranx
please see a couple of additional suggestions.
apologies if we confused you with the MainErrorLogLevel
name, but it is only required in the config.go
file.
Could you also rebase against the master
branch?
examples/customization/README.md
Outdated
@@ -23,6 +23,7 @@ The table below summarizes all of the options. For some of them, there are examp | |||
| N/A | `http2` | Enables HTTP/2 in servers with SSL enabled. | `False` | | |||
| `nginx.org/redirect-to-https` | `redirect-to-https` | Sets the 301 redirect rule based on the value of the `http_x_forwarded_proto` header on the server block to force incoming traffic to be over HTTPS. Useful when terminating SSL in a load balancer in front of the Ingress controller — see [115](https://github.com/nginxinc/kubernetes-ingress/issues/115) | `False` | | | |||
| `ingress.kubernetes.io/ssl-redirect` | `ssl-redirect` | Sets an unconditional 301 redirect rule for all incoming HTTP traffic to force incoming traffic over HTTPS. | `True` | | | |||
| N/A | `error-log-level` | Sets the global error log level for NGINX. [error-log-level](http://nginx.org/en/docs/ngx_core_module.html#error_log). | See the [template file](../../nginx-controller/nginx/nginx.conf.tmpl). | | |
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.
Could you possible change the description to Sets the global [error log level](http://nginx.org/en/docs/ngx_core_module.html#error_log) for NGINX.
?
Could you put notice
in the default column instead of a link to the template?
nginx-controller/nginx/config.go
Outdated
@@ -257,7 +259,9 @@ func ParseConfigMap(cfgm *api_v1.ConfigMap, nginxPlus bool) *Config { | |||
sslDHParamFile = strings.Trim(sslDHParamFile, "\n") | |||
cfg.MainServerSSLDHParamFileContent = &sslDHParamFile | |||
} | |||
|
|||
if MainErrorLogLevel, exists := cfgm.Data["error-log-level"]; exists { |
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.
MainErrorLogLevel
-> errorLogLevel
nginx-controller/nginx/nginx.go
Outdated
@@ -142,6 +142,7 @@ type NginxMainConfig struct { | |||
ServerNamesHashBucketSize string | |||
ServerNamesHashMaxSize string | |||
LogFormat string | |||
MainErrorLogLevel string |
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.
MainErrorLogLevel
-> ErrorLogLevel
…om kubernetes config map
Sorry for bothering you, could you please check it again? |
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.
👍
@boranx thanks for the PR!! |
Proposed changes
The log level in NGINX templates was hard coded. This PR allows you to inject the log level from K8s config map. The default value will be "notice". I also updated the example config. Tested and works well in K8s.
Checklist
Before creating a PR, run through this checklist and mark each as complete.