From 75c77e5dc3cdbf93725cd586afe7288b2b52eefd Mon Sep 17 00:00:00 2001 From: Marco Ebert Date: Mon, 7 Oct 2024 21:34:22 +0200 Subject: [PATCH] Metrics: Disable by default. (#12095) --- charts/ingress-nginx/templates/_params.tpl | 2 +- .../tests/controller-daemonset_test.yaml | 12 ++++++------ .../tests/controller-deployment_test.yaml | 12 ++++++------ docs/user-guide/cli-arguments.md | 2 +- pkg/flags/flags.go | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/charts/ingress-nginx/templates/_params.tpl b/charts/ingress-nginx/templates/_params.tpl index 763e555707..0051dc9c09 100644 --- a/charts/ingress-nginx/templates/_params.tpl +++ b/charts/ingress-nginx/templates/_params.tpl @@ -54,7 +54,7 @@ {{- if .Values.controller.watchIngressWithoutClass }} - --watch-ingress-without-class=true {{- end }} -{{- if not .Values.controller.metrics.enabled }} +{{- if .Values.controller.metrics.enabled }} - --enable-metrics={{ .Values.controller.metrics.enabled }} {{- end }} {{- if .Values.controller.enableTopologyAwareRouting }} diff --git a/charts/ingress-nginx/tests/controller-daemonset_test.yaml b/charts/ingress-nginx/tests/controller-daemonset_test.yaml index c28c6ee0d2..d2d77befb3 100644 --- a/charts/ingress-nginx/tests/controller-daemonset_test.yaml +++ b/charts/ingress-nginx/tests/controller-daemonset_test.yaml @@ -15,23 +15,23 @@ tests: path: metadata.name value: RELEASE-NAME-ingress-nginx-controller - - it: should create a DaemonSet with argument `--enable-metrics=false` if `controller.metrics.enabled` is false + - it: should create a DaemonSet with argument `--enable-metrics=true` if `controller.metrics.enabled` is true set: controller.kind: DaemonSet - controller.metrics.enabled: false + controller.metrics.enabled: true asserts: - contains: path: spec.template.spec.containers[0].args - content: --enable-metrics=false + content: --enable-metrics=true - - it: should create a DaemonSet without argument `--enable-metrics=false` if `controller.metrics.enabled` is true + - it: should create a DaemonSet without argument `--enable-metrics=true` if `controller.metrics.enabled` is false set: controller.kind: DaemonSet - controller.metrics.enabled: true + controller.metrics.enabled: false asserts: - notContains: path: spec.template.spec.containers[0].args - content: --enable-metrics=false + content: --enable-metrics=true - it: should create a DaemonSet with argument `--controller-class=k8s.io/ingress-nginx-internal` if `controller.ingressClassResource.controllerValue` is "k8s.io/ingress-nginx-internal" set: diff --git a/charts/ingress-nginx/tests/controller-deployment_test.yaml b/charts/ingress-nginx/tests/controller-deployment_test.yaml index 2c57636fb9..1cc9c93255 100644 --- a/charts/ingress-nginx/tests/controller-deployment_test.yaml +++ b/charts/ingress-nginx/tests/controller-deployment_test.yaml @@ -43,21 +43,21 @@ tests: - exists: path: spec.replicas - - it: should create a Deployment with argument `--enable-metrics=false` if `controller.metrics.enabled` is false + - it: should create a Deployment with argument `--enable-metrics=true` if `controller.metrics.enabled` is true set: - controller.metrics.enabled: false + controller.metrics.enabled: true asserts: - contains: path: spec.template.spec.containers[0].args - content: --enable-metrics=false + content: --enable-metrics=true - - it: should create a Deployment without argument `--enable-metrics=false` if `controller.metrics.enabled` is true + - it: should create a Deployment without argument `--enable-metrics=true` if `controller.metrics.enabled` is false set: - controller.metrics.enabled: true + controller.metrics.enabled: false asserts: - notContains: path: spec.template.spec.containers[0].args - content: --enable-metrics=false + content: --enable-metrics=true - it: should create a Deployment with argument `--controller-class=k8s.io/ingress-nginx-internal` if `controller.ingressClassResource.controllerValue` is "k8s.io/ingress-nginx-internal" set: diff --git a/docs/user-guide/cli-arguments.md b/docs/user-guide/cli-arguments.md index 1beb821c7b..a33e75159b 100644 --- a/docs/user-guide/cli-arguments.md +++ b/docs/user-guide/cli-arguments.md @@ -24,7 +24,7 @@ They are set in the container spec of the `ingress-nginx-controller` Deployment | `--dynamic-configuration-retries` | Number of times to retry failed dynamic configuration before failing to sync an ingress. (default 15) | | `--election-id` | Election id to use for Ingress status updates. (default "ingress-controller-leader") | | `--election-ttl` | Duration a leader election is valid before it's getting re-elected, e.g. `15s`, `10m` or `1h`. (Default: 30s) | -| `--enable-metrics` | Enables the collection of NGINX metrics. (default true) | +| `--enable-metrics` | Enables the collection of NGINX metrics. (Default: false) | | `--enable-ssl-chain-completion` | Autocomplete SSL certificate chains with missing intermediate CA certificates. Certificates uploaded to Kubernetes must have the "Authority Information Access" X.509 v3 extension for this to succeed. (default false)| | `--enable-ssl-passthrough` | Enable SSL Passthrough. (default false) | | `--disable-leader-election` | Disable Leader Election on Nginx Controller. (default false) | diff --git a/pkg/flags/flags.go b/pkg/flags/flags.go index a64a37193e..ce24160fdc 100644 --- a/pkg/flags/flags.go +++ b/pkg/flags/flags.go @@ -174,7 +174,7 @@ extension for this to succeed.`) `Customized address (or addresses, separated by comma) to set as the load-balancer status of Ingress objects this controller satisfies. Requires the update-status parameter.`) - enableMetrics = flags.Bool("enable-metrics", true, + enableMetrics = flags.Bool("enable-metrics", false, `Enables the collection of NGINX metrics.`) metricsPerHost = flags.Bool("metrics-per-host", true, `Export metrics per-host.`)