Skip to content
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

Feature/flag include year #2884

Merged
merged 15 commits into from
Jul 27, 2022
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions cmd/nginx-ingress/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"net"
"os"
"regexp"
"strconv"
"strings"

"github.com/golang/glog"
Expand Down Expand Up @@ -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
)

Expand Down Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions deployments/daemon-set/nginx-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions deployments/daemon-set/nginx-plus-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions deployments/deployment/nginx-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions deployments/deployment/nginx-plus-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ spec:
- -nginx-plus
- -nginx-configmaps=$(POD_NAMESPACE)/nginx-config
- -default-server-tls-secret=$(POD_NAMESPACE)/default-server-secret
#- -include-year
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can specify the same in deployments/daemon-set/nginx-plus-ingress.yaml as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I will also add it to the OSS version of the deployments

#- -enable-cert-manager
#- -enable-external-dns
#- -enable-app-protect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
3 changes: 3 additions & 0 deletions deployments/helm-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand this. None of the values in this file start with controller. why would the includeYear value need to start with that?

Copy link
Contributor

@vepatel vepatel Jul 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it refers to https://github.com/nginxinc/kubernetes-ingress/blob/feature/flag-include-year/deployments/helm-chart/values.yaml#L1 so when you're installing using helm-chart helm install my-release --set controller.kind=daemonset --set controller.nginxplus=true --set controller.image.repository=nginx-ingress --set controller.image.tag=edge --set controller.includeYear=true ......


## Enable TLS Passthrough on port 443. Requires controller.enableCustomResources.
enableTLSPassthrough: false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ Default `false`.
 
<a name="cmdoption-enable-leader-election"></a>

### -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.
Expand Down
1 change: 1 addition & 0 deletions docs/content/installation/installation-with-helm.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down