diff --git a/cmd/nginx-ingress/flags.go b/cmd/nginx-ingress/flags.go index 04305bd942..e3b0427aa5 100644 --- a/cmd/nginx-ingress/flags.go +++ b/cmd/nginx-ingress/flags.go @@ -6,6 +6,7 @@ import ( "net" "os" "regexp" + "strconv" "strings" "github.com/golang/glog" @@ -174,6 +175,9 @@ var ( enableExternalDNS = flag.Bool("enable-external-dns", false, "Enable external-dns controller for VirtualServer resources. Requires -enable-custom-resources") + includeYearInLogs = flag.Bool("include-year", false, + "Option to include the year in the log header") + startupCheckFn func() error ) @@ -261,6 +265,11 @@ func initialChecks() { glog.Fatalf("Error setting logtostderr to true: %v", err) } + err = flag.Lookup("include_year").Value.Set(strconv.FormatBool(*includeYearInLogs)) + if err != nil { + glog.Fatalf("Error setting include_year flag: %v", err) + } + if startupCheckFn != nil { err := startupCheckFn() if err != nil { diff --git a/deployments/daemon-set/nginx-ingress.yaml b/deployments/daemon-set/nginx-ingress.yaml index 7e79f03c02..8dd839c066 100644 --- a/deployments/daemon-set/nginx-ingress.yaml +++ b/deployments/daemon-set/nginx-ingress.yaml @@ -64,6 +64,7 @@ spec: args: - -nginx-configmaps=$(POD_NAMESPACE)/nginx-config - -default-server-tls-secret=$(POD_NAMESPACE)/default-server-secret + #- -include-year #- -v=3 # Enables extensive logging. Useful for troubleshooting. #- -report-ingress-status #- -external-service=nginx-ingress diff --git a/deployments/daemon-set/nginx-plus-ingress.yaml b/deployments/daemon-set/nginx-plus-ingress.yaml index b0bdca2a86..c2d79c610b 100644 --- a/deployments/daemon-set/nginx-plus-ingress.yaml +++ b/deployments/daemon-set/nginx-plus-ingress.yaml @@ -65,6 +65,7 @@ spec: - -nginx-plus - -nginx-configmaps=$(POD_NAMESPACE)/nginx-config - -default-server-tls-secret=$(POD_NAMESPACE)/default-server-secret + #- -include-year #- -enable-app-protect #- -enable-app-protect-dos #- -v=3 # Enables extensive logging. Useful for troubleshooting. diff --git a/deployments/deployment/nginx-ingress.yaml b/deployments/deployment/nginx-ingress.yaml index 8c8af43d83..64d39f11f3 100644 --- a/deployments/deployment/nginx-ingress.yaml +++ b/deployments/deployment/nginx-ingress.yaml @@ -64,6 +64,7 @@ spec: args: - -nginx-configmaps=$(POD_NAMESPACE)/nginx-config - -default-server-tls-secret=$(POD_NAMESPACE)/default-server-secret + #- -include-year #- -enable-cert-manager #- -enable-external-dns #- -v=3 # Enables extensive logging. Useful for troubleshooting. diff --git a/deployments/deployment/nginx-plus-ingress.yaml b/deployments/deployment/nginx-plus-ingress.yaml index 8eaa51052d..0d8096b642 100644 --- a/deployments/deployment/nginx-plus-ingress.yaml +++ b/deployments/deployment/nginx-plus-ingress.yaml @@ -65,6 +65,7 @@ spec: - -nginx-plus - -nginx-configmaps=$(POD_NAMESPACE)/nginx-config - -default-server-tls-secret=$(POD_NAMESPACE)/default-server-secret + #- -include-year #- -enable-cert-manager #- -enable-external-dns #- -enable-app-protect diff --git a/deployments/helm-chart/templates/controller-daemonset.yaml b/deployments/helm-chart/templates/controller-daemonset.yaml index 259567b28b..aca88b7cab 100644 --- a/deployments/helm-chart/templates/controller-daemonset.yaml +++ b/deployments/helm-chart/templates/controller-daemonset.yaml @@ -185,6 +185,7 @@ spec: - -prometheus-tls-secret={{ .Values.prometheus.secret }} - -enable-custom-resources={{ .Values.controller.enableCustomResources }} - -enable-snippets={{ .Values.controller.enableSnippets }} + - -include-year={{ .Values.controller.includeYear }} {{- if .Values.controller.enableCustomResources }} - -enable-tls-passthrough={{ .Values.controller.enableTLSPassthrough }} - -enable-preview-policies={{ .Values.controller.enablePreviewPolicies }} diff --git a/deployments/helm-chart/templates/controller-deployment.yaml b/deployments/helm-chart/templates/controller-deployment.yaml index e0770143d4..71d68d728c 100644 --- a/deployments/helm-chart/templates/controller-deployment.yaml +++ b/deployments/helm-chart/templates/controller-deployment.yaml @@ -188,6 +188,7 @@ spec: - -prometheus-tls-secret={{ .Values.prometheus.secret }} - -enable-custom-resources={{ .Values.controller.enableCustomResources }} - -enable-snippets={{ .Values.controller.enableSnippets }} + - -include-year={{ .Values.controller.includeYear }} {{- if .Values.controller.enableCustomResources }} - -enable-tls-passthrough={{ .Values.controller.enableTLSPassthrough }} - -enable-preview-policies={{ .Values.controller.enablePreviewPolicies }} diff --git a/deployments/helm-chart/values.yaml b/deployments/helm-chart/values.yaml index e80fa71e12..827d15d5e0 100644 --- a/deployments/helm-chart/values.yaml +++ b/deployments/helm-chart/values.yaml @@ -178,6 +178,9 @@ controller: ## Enable OIDC policies. enableOIDC: false + ## Include year in log header. This parameter will be removed in release 2.7 and the year will be included by default. + includeYear: false + ## Enable TLS Passthrough on port 443. Requires controller.enableCustomResources. enableTLSPassthrough: false diff --git a/docs/content/configuration/global-configuration/command-line-arguments.md b/docs/content/configuration/global-configuration/command-line-arguments.md index 63c077d328..52b8631c6f 100644 --- a/docs/content/configuration/global-configuration/command-line-arguments.md +++ b/docs/content/configuration/global-configuration/command-line-arguments.md @@ -73,6 +73,13 @@ Default `false`.   +### -inlcude-year +Adds year to log headers. + +Default `false`. + +**NOTE**: This flag will be removed in release 2.7 and the year will be included by default. + ### -enable-leader-election Enables Leader election to avoid multiple replicas of the controller reporting the status of Ingress, VirtualServer and VirtualServerRoute resources -- only one replica will report status. diff --git a/docs/content/installation/installation-with-helm.md b/docs/content/installation/installation-with-helm.md index 20f4de59a6..f663885892 100644 --- a/docs/content/installation/installation-with-helm.md +++ b/docs/content/installation/installation-with-helm.md @@ -187,6 +187,7 @@ The following tables lists the configurable parameters of the NGINX Ingress Cont |``controller.enableCustomResources`` | Enable the custom resources. | true | |``controller.enablePreviewPolicies`` | Enable preview policies. This parameter is deprecated. To enable OIDC Policies please use ``controller.enableOIDC`` instead. | false | |``controller.enableOIDC`` | Enable OIDC policies. | false | +|``controller.includeYear`` | Include year in log header. This parameter will be removed in release 2.7 and the year will be included by default. | false | |``controller.enableTLSPassthrough`` | Enable TLS Passthrough on port 443. Requires ``controller.enableCustomResources``. | false | `controller.enableCertManager` | Enable x509 automated certificate management for VirtualServer resources using cert-manager (cert-manager.io). Requires `controller.enableCustomResources`. | false `controller.enableExternalDNS` | Enable integration with ExternalDNS for configuring public DNS entries for VirtualServer resources using [ExternalDNS](https://github.com/kubernetes-sigs/external-dns). Requires `controller.enableCustomResources`. | false diff --git a/go.mod b/go.mod index 6556b7ef80..094e41a876 100644 --- a/go.mod +++ b/go.mod @@ -130,6 +130,6 @@ require ( sigs.k8s.io/yaml v1.3.0 // indirect ) -replace github.com/golang/glog v1.0.0 => github.com/nginxinc/glog v1.1.1 +replace github.com/golang/glog v1.0.0 => github.com/nginxinc/glog v1.1.2 // temprary fix for CVE-2022-29526 in github.com/prometheus/client_golang v1.12.2 replace golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 => golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 diff --git a/go.sum b/go.sum index f9efee02b0..f6f8dcec48 100644 --- a/go.sum +++ b/go.sum @@ -508,8 +508,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8m github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= -github.com/nginxinc/glog v1.1.1 h1:+NI8YAEa0pkR4lyfK0Fp+rCwpD7VIQAinq3NwK3TQzs= -github.com/nginxinc/glog v1.1.1/go.mod h1:Q2FpGp/qFhJEVnuC88BVfbLDPmio9aHYUj4al6w0138= +github.com/nginxinc/glog v1.1.2 h1:zyoZXhCoYvNMJq4qMsKislUCGyJ4eU2gNl3Nt7cjESg= +github.com/nginxinc/glog v1.1.2/go.mod h1:Q2FpGp/qFhJEVnuC88BVfbLDPmio9aHYUj4al6w0138= github.com/nginxinc/nginx-plus-go-client v0.10.0 h1:3zsMMkPvRDo8D7ZSprXtbAEW/SDmezZWzxdyS+6oAlc= github.com/nginxinc/nginx-plus-go-client v0.10.0/go.mod h1:0v3RsQCvRn/IyrMtW+DK6CNkz+PxEsXDJPjQ3yUMBF0= github.com/nginxinc/nginx-prometheus-exporter v0.10.0 h1:wFP8mYMtmn8uK1I5tzXb3s4CQq+r3h6Y0Qdc7d+QpyM=