From ff195bddf91c844a839eb168c38eab245a919def Mon Sep 17 00:00:00 2001 From: Saylor Berman Date: Wed, 21 Feb 2024 13:03:40 -0700 Subject: [PATCH 1/3] Add flag to opt out of product telemetry Problem: As a user of NGF I want an easy option to opt out of recording and sending of all telemetry data So that if I am not comfortable sending that information, I can still continue to use NGF Solution: Added a new configurable flag that can disable telemetry. On by default. Also turns off any RBAC if not needed (for N+ usage or telemetry) --- cmd/gateway/commands.go | 45 ++++++++++++------- deploy/helm-chart/README.md | 3 ++ deploy/helm-chart/templates/deployment.yaml | 3 ++ deploy/helm-chart/templates/rbac.yaml | 18 ++++---- deploy/helm-chart/values.yaml | 4 ++ .../manifests/nginx-gateway-experimental.yaml | 16 +++---- deploy/manifests/nginx-gateway.yaml | 16 +++---- .../nginx-plus-gateway-experimental.yaml | 16 +++---- deploy/manifests/nginx-plus-gateway.yaml | 16 +++---- internal/mode/static/config/config.go | 2 + internal/mode/static/manager.go | 28 ++++++------ site/content/reference/cli-help.md | 1 + 12 files changed, 93 insertions(+), 75 deletions(-) diff --git a/cmd/gateway/commands.go b/cmd/gateway/commands.go index e721e697a7..c673666487 100644 --- a/cmd/gateway/commands.go +++ b/cmd/gateway/commands.go @@ -44,23 +44,24 @@ func createRootCommand() *cobra.Command { func createStaticModeCommand() *cobra.Command { // flag names const ( - gatewayFlag = "gateway" - configFlag = "config" - serviceFlag = "service" - updateGCStatusFlag = "update-gatewayclass-status" - metricsDisableFlag = "metrics-disable" - metricsSecureFlag = "metrics-secure-serving" - metricsPortFlag = "metrics-port" - healthDisableFlag = "health-disable" - healthPortFlag = "health-port" - leaderElectionDisableFlag = "leader-election-disable" - leaderElectionLockNameFlag = "leader-election-lock-name" - plusFlag = "nginx-plus" - gwAPIExperimentalFlag = "gateway-api-experimental-features" - usageReportSecretFlag = "usage-report-secret" - usageReportServerURLFlag = "usage-report-server-url" - usageReportSkipVerifyFlag = "usage-report-skip-verify" - usageReportClusterNameFlag = "usage-report-cluster-name" + gatewayFlag = "gateway" + configFlag = "config" + serviceFlag = "service" + updateGCStatusFlag = "update-gatewayclass-status" + metricsDisableFlag = "metrics-disable" + metricsSecureFlag = "metrics-secure-serving" + metricsPortFlag = "metrics-port" + healthDisableFlag = "health-disable" + healthPortFlag = "health-port" + leaderElectionDisableFlag = "leader-election-disable" + leaderElectionLockNameFlag = "leader-election-lock-name" + productTelemetryDisableFlag = "product-telemetry-disable" + plusFlag = "nginx-plus" + gwAPIExperimentalFlag = "gateway-api-experimental-features" + usageReportSecretFlag = "usage-report-secret" + usageReportServerURLFlag = "usage-report-server-url" + usageReportSkipVerifyFlag = "usage-report-skip-verify" + usageReportClusterNameFlag = "usage-report-cluster-name" ) // flag values @@ -101,6 +102,8 @@ func createStaticModeCommand() *cobra.Command { gwExperimentalFeatures bool + disableProductTelemetry bool + plus bool usageReportSkipVerify bool usageReportClusterName = stringValidatingValue{ @@ -183,6 +186,7 @@ func createStaticModeCommand() *cobra.Command { GatewayClassName: gatewayClassName.value, GatewayNsName: gwNsName, UpdateGatewayClassStatus: updateGCStatus, + DisableProductTelemetry: disableProductTelemetry, GatewayPodConfig: config.GatewayPodConfig{ PodIP: podIP, ServiceName: serviceName.value, @@ -315,6 +319,13 @@ func createStaticModeCommand() *cobra.Command { "A Lease object with this name will be created in the same Namespace as the controller.", ) + cmd.Flags().BoolVar( + &disableProductTelemetry, + productTelemetryDisableFlag, + false, + "Disable the collection of product telemetry every 24 hours.", + ) + cmd.Flags().BoolVar( &plus, plusFlag, diff --git a/deploy/helm-chart/README.md b/deploy/helm-chart/README.md index 9032a23ca1..09a38153d9 100644 --- a/deploy/helm-chart/README.md +++ b/deploy/helm-chart/README.md @@ -293,6 +293,9 @@ The following tables lists the configurable parameters of the NGINX Gateway Fabr | `nginxGateway.replicaCount` | The number of replicas of the NGINX Gateway Fabric Deployment. | 1 | | `nginxGateway.leaderElection.enable` | Enable leader election. Leader election is used to avoid multiple replicas of the NGINX Gateway Fabric reporting the status of the Gateway API resources. | true | | `nginxGateway.leaderElection.lockName` | The name of the leader election lock. A Lease object with this name will be created in the same Namespace as the controller. | Autogenerated | +| `nginxGateway.securityContext.allowPrivilegeEscalation` | Some environments may need this set to true in order for the control plane to successfully reload NGINX. | false | +| `nginxGateway.productTelemetry.enable` | Enable the collection of product telemetry every 24 hours. | true | +| `nginxGateway.gwAPIExperimentalFeatures.enable` | Enable the experimental features of Gateway API which are supported by NGINX Gateway Fabric. Requires the Gateway APIs installed from the experimental channel. | false | | `nginx.image.repository` | The repository for the NGINX image. | ghcr.io/nginxinc/nginx-gateway-fabric/nginx | | `nginx.image.tag` | The tag for the NGINX image. | edge | | `nginx.image.pullPolicy` | The `imagePullPolicy` for the NGINX image. | Always | diff --git a/deploy/helm-chart/templates/deployment.yaml b/deploy/helm-chart/templates/deployment.yaml index 12479708fe..dd272d91e9 100644 --- a/deploy/helm-chart/templates/deployment.yaml +++ b/deploy/helm-chart/templates/deployment.yaml @@ -52,6 +52,9 @@ spec: {{- else }} - --leader-election-disable {{- end }} + {{- if not .Values.nginxGateway.productTelemetry.enable }} + - --product-telemetry-disable + {{- end }} {{- if .Values.nginxGateway.gwAPIExperimentalFeatures.enable }} - --gateway-api-experimental-features {{- end }} diff --git a/deploy/helm-chart/templates/rbac.yaml b/deploy/helm-chart/templates/rbac.yaml index 962f279abe..33c7c840ad 100644 --- a/deploy/helm-chart/templates/rbac.yaml +++ b/deploy/helm-chart/templates/rbac.yaml @@ -39,8 +39,7 @@ rules: - get - list - watch -# FIXME(bjee19): make nodes, pods, replicasets permission dependent on telemetry being enabled. -# https://github.com/nginxinc/nginx-gateway-fabric/issues/1317. +{{- if or .Values.nginxGateway.productTelemetry.enable .Values.nginx.plus }} - apiGroups: - "" resources: @@ -53,13 +52,6 @@ rules: - nodes verbs: - list -- apiGroups: - - "" - resources: - - events - verbs: - - create - - patch - apiGroups: - apps resources: @@ -67,6 +59,14 @@ rules: verbs: - get - list +{{- end }} +- apiGroups: + - "" + resources: + - events + verbs: + - create + - patch - apiGroups: - discovery.k8s.io resources: diff --git a/deploy/helm-chart/values.yaml b/deploy/helm-chart/values.yaml index a10d61a73e..c9951768d1 100644 --- a/deploy/helm-chart/values.yaml +++ b/deploy/helm-chart/values.yaml @@ -45,6 +45,10 @@ nginxGateway: ## Some environments may need this set to true in order for the control plane to successfully reload NGINX. allowPrivilegeEscalation: false + productTelemetry: + ## Enable the collection of product telemetry every 24 hours. + enable: true + ## The lifecycle of the nginx-gateway container. lifecycle: {} diff --git a/deploy/manifests/nginx-gateway-experimental.yaml b/deploy/manifests/nginx-gateway-experimental.yaml index a6480764de..1563fc7eb4 100644 --- a/deploy/manifests/nginx-gateway-experimental.yaml +++ b/deploy/manifests/nginx-gateway-experimental.yaml @@ -37,8 +37,6 @@ rules: - get - list - watch -# FIXME(bjee19): make nodes, pods, replicasets permission dependent on telemetry being enabled. -# https://github.com/nginxinc/nginx-gateway-fabric/issues/1317. - apiGroups: - "" resources: @@ -51,13 +49,6 @@ rules: - nodes verbs: - list -- apiGroups: - - "" - resources: - - events - verbs: - - create - - patch - apiGroups: - apps resources: @@ -65,6 +56,13 @@ rules: verbs: - get - list +- apiGroups: + - "" + resources: + - events + verbs: + - create + - patch - apiGroups: - discovery.k8s.io resources: diff --git a/deploy/manifests/nginx-gateway.yaml b/deploy/manifests/nginx-gateway.yaml index 37fbd2dab2..20b039c7d6 100644 --- a/deploy/manifests/nginx-gateway.yaml +++ b/deploy/manifests/nginx-gateway.yaml @@ -36,8 +36,6 @@ rules: - get - list - watch -# FIXME(bjee19): make nodes, pods, replicasets permission dependent on telemetry being enabled. -# https://github.com/nginxinc/nginx-gateway-fabric/issues/1317. - apiGroups: - "" resources: @@ -50,13 +48,6 @@ rules: - nodes verbs: - list -- apiGroups: - - "" - resources: - - events - verbs: - - create - - patch - apiGroups: - apps resources: @@ -64,6 +55,13 @@ rules: verbs: - get - list +- apiGroups: + - "" + resources: + - events + verbs: + - create + - patch - apiGroups: - discovery.k8s.io resources: diff --git a/deploy/manifests/nginx-plus-gateway-experimental.yaml b/deploy/manifests/nginx-plus-gateway-experimental.yaml index e2e5027dd2..2436ea1aae 100644 --- a/deploy/manifests/nginx-plus-gateway-experimental.yaml +++ b/deploy/manifests/nginx-plus-gateway-experimental.yaml @@ -37,8 +37,6 @@ rules: - get - list - watch -# FIXME(bjee19): make nodes, pods, replicasets permission dependent on telemetry being enabled. -# https://github.com/nginxinc/nginx-gateway-fabric/issues/1317. - apiGroups: - "" resources: @@ -51,13 +49,6 @@ rules: - nodes verbs: - list -- apiGroups: - - "" - resources: - - events - verbs: - - create - - patch - apiGroups: - apps resources: @@ -65,6 +56,13 @@ rules: verbs: - get - list +- apiGroups: + - "" + resources: + - events + verbs: + - create + - patch - apiGroups: - discovery.k8s.io resources: diff --git a/deploy/manifests/nginx-plus-gateway.yaml b/deploy/manifests/nginx-plus-gateway.yaml index a34a38d083..d5bfc14b87 100644 --- a/deploy/manifests/nginx-plus-gateway.yaml +++ b/deploy/manifests/nginx-plus-gateway.yaml @@ -36,8 +36,6 @@ rules: - get - list - watch -# FIXME(bjee19): make nodes, pods, replicasets permission dependent on telemetry being enabled. -# https://github.com/nginxinc/nginx-gateway-fabric/issues/1317. - apiGroups: - "" resources: @@ -50,13 +48,6 @@ rules: - nodes verbs: - list -- apiGroups: - - "" - resources: - - events - verbs: - - create - - patch - apiGroups: - apps resources: @@ -64,6 +55,13 @@ rules: verbs: - get - list +- apiGroups: + - "" + resources: + - events + verbs: + - create + - patch - apiGroups: - discovery.k8s.io resources: diff --git a/internal/mode/static/config/config.go b/internal/mode/static/config/config.go index 3a21055fdf..be1378cb6a 100644 --- a/internal/mode/static/config/config.go +++ b/internal/mode/static/config/config.go @@ -40,6 +40,8 @@ type Config struct { TelemetryReportPeriod time.Duration // UpdateGatewayClassStatus enables updating the status of the GatewayClass resource. UpdateGatewayClassStatus bool + // DisableProductTelemetry disables the collection of product telemetry. + DisableProductTelemetry bool // Plus indicates whether NGINX Plus is being used. Plus bool // ExperimentalFeatures indicates if experimental features are enabled. diff --git a/internal/mode/static/manager.go b/internal/mode/static/manager.go index 2652b72d73..1809ffa3f4 100644 --- a/internal/mode/static/manager.go +++ b/internal/mode/static/manager.go @@ -242,19 +242,21 @@ func StartManager(cfg config.Config) error { return fmt.Errorf("cannot register status updater: %w", err) } - dataCollector := telemetry.NewDataCollectorImpl(telemetry.DataCollectorConfig{ - K8sClientReader: mgr.GetAPIReader(), - GraphGetter: processor, - ConfigurationGetter: eventHandler, - Version: cfg.Version, - PodNSName: types.NamespacedName{ - Namespace: cfg.GatewayPodConfig.Namespace, - Name: cfg.GatewayPodConfig.Name, - }, - ImageSource: cfg.ImageSource, - }) - if err = mgr.Add(createTelemetryJob(cfg, dataCollector, nginxChecker.getReadyCh())); err != nil { - return fmt.Errorf("cannot register telemetry job: %w", err) + if !cfg.DisableProductTelemetry { + dataCollector := telemetry.NewDataCollectorImpl(telemetry.DataCollectorConfig{ + K8sClientReader: mgr.GetAPIReader(), + GraphGetter: processor, + ConfigurationGetter: eventHandler, + Version: cfg.Version, + PodNSName: types.NamespacedName{ + Namespace: cfg.GatewayPodConfig.Namespace, + Name: cfg.GatewayPodConfig.Name, + }, + ImageSource: cfg.ImageSource, + }) + if err = mgr.Add(createTelemetryJob(cfg, dataCollector, nginxChecker.getReadyCh())); err != nil { + return fmt.Errorf("cannot register telemetry job: %w", err) + } } cfg.Logger.Info("Starting manager") diff --git a/site/content/reference/cli-help.md b/site/content/reference/cli-help.md index c306a29ce9..82e6e54f8d 100644 --- a/site/content/reference/cli-help.md +++ b/site/content/reference/cli-help.md @@ -36,6 +36,7 @@ _Usage_: | _health-port_ | _int_ | Set the port where the health probe server is exposed. An integer between 1024 - 65535 (Default: `8081`). | | _leader-election-disable_ | _bool_ | Disable leader election, which is used to avoid multiple replicas of the NGINX Gateway Fabric reporting the status of the Gateway API resources. If disabled, all replicas of NGINX Gateway Fabric will update the statuses of the Gateway API resources (Default: `false`). | | _leader-election-lock-name_ | _string_ | The name of the leader election lock. A lease object with this name will be created in the same namespace as the controller (Default: `"nginx-gateway-leader-election-lock"`). | +| _product-telemetry-disable_ | _bool_ | Disable the collection of product telemetry every 24 hours (Default: `false`). | | _usage-report-secret_ | _string_ | The namespace/name of the Secret containing the credentials for NGINX Plus usage reporting. | | _usage-report-server-url_ | _string_ | The base server URL of the NGINX Plus usage reporting server. | | _usage-report-cluster-name_ | _string_ | The display name of the Kubernetes cluster in the NGINX Plus usage reporting server. | From d04d2c079d53d839f5a171a97ab23b7c4f0b2954 Mon Sep 17 00:00:00 2001 From: Saylor Berman Date: Wed, 21 Feb 2024 14:22:22 -0700 Subject: [PATCH 2/3] Code review --- cmd/gateway/commands.go | 18 ++++++++++-------- deploy/helm-chart/README.md | 2 +- deploy/helm-chart/templates/rbac.yaml | 19 ++++++++++++++----- deploy/helm-chart/values.yaml | 2 +- .../manifests/nginx-gateway-experimental.yaml | 11 +++++------ deploy/manifests/nginx-gateway.yaml | 11 +++++------ .../nginx-plus-gateway-experimental.yaml | 13 +++++++++---- deploy/manifests/nginx-plus-gateway.yaml | 13 +++++++++---- internal/mode/static/config/config.go | 14 ++++++++++---- internal/mode/static/manager.go | 6 +++--- site/content/reference/cli-help.md | 2 +- 11 files changed, 68 insertions(+), 43 deletions(-) diff --git a/cmd/gateway/commands.go b/cmd/gateway/commands.go index c673666487..518be56f6d 100644 --- a/cmd/gateway/commands.go +++ b/cmd/gateway/commands.go @@ -186,7 +186,6 @@ func createStaticModeCommand() *cobra.Command { GatewayClassName: gatewayClassName.value, GatewayNsName: gwNsName, UpdateGatewayClassStatus: updateGCStatus, - DisableProductTelemetry: disableProductTelemetry, GatewayPodConfig: config.GatewayPodConfig{ PodIP: podIP, ServiceName: serviceName.value, @@ -207,12 +206,15 @@ func createStaticModeCommand() *cobra.Command { LockName: leaderElectionLockName.String(), Identity: podName, }, - UsageReportConfig: usageReportConfig, - Plus: plus, - TelemetryReportPeriod: period, - Version: version, - ExperimentalFeatures: gwExperimentalFeatures, - ImageSource: imageSource, + UsageReportConfig: usageReportConfig, + ProductTelemetryConfig: config.ProductTelemetryConfig{ + TelemetryReportPeriod: period, + DisableProductTelemetry: disableProductTelemetry, + }, + Plus: plus, + Version: version, + ExperimentalFeatures: gwExperimentalFeatures, + ImageSource: imageSource, } if err := static.StartManager(conf); err != nil { @@ -323,7 +325,7 @@ func createStaticModeCommand() *cobra.Command { &disableProductTelemetry, productTelemetryDisableFlag, false, - "Disable the collection of product telemetry every 24 hours.", + "Disable the collection of product telemetry.", ) cmd.Flags().BoolVar( diff --git a/deploy/helm-chart/README.md b/deploy/helm-chart/README.md index 09a38153d9..02bbf785c8 100644 --- a/deploy/helm-chart/README.md +++ b/deploy/helm-chart/README.md @@ -294,7 +294,7 @@ The following tables lists the configurable parameters of the NGINX Gateway Fabr | `nginxGateway.leaderElection.enable` | Enable leader election. Leader election is used to avoid multiple replicas of the NGINX Gateway Fabric reporting the status of the Gateway API resources. | true | | `nginxGateway.leaderElection.lockName` | The name of the leader election lock. A Lease object with this name will be created in the same Namespace as the controller. | Autogenerated | | `nginxGateway.securityContext.allowPrivilegeEscalation` | Some environments may need this set to true in order for the control plane to successfully reload NGINX. | false | -| `nginxGateway.productTelemetry.enable` | Enable the collection of product telemetry every 24 hours. | true | +| `nginxGateway.productTelemetry.enable` | Enable the collection of product telemetry. | true | | `nginxGateway.gwAPIExperimentalFeatures.enable` | Enable the experimental features of Gateway API which are supported by NGINX Gateway Fabric. Requires the Gateway APIs installed from the experimental channel. | false | | `nginx.image.repository` | The repository for the NGINX image. | ghcr.io/nginxinc/nginx-gateway-fabric/nginx | | `nginx.image.tag` | The tag for the NGINX image. | edge | diff --git a/deploy/helm-chart/templates/rbac.yaml b/deploy/helm-chart/templates/rbac.yaml index 33c7c840ad..851ddb42b7 100644 --- a/deploy/helm-chart/templates/rbac.yaml +++ b/deploy/helm-chart/templates/rbac.yaml @@ -39,7 +39,7 @@ rules: - get - list - watch -{{- if or .Values.nginxGateway.productTelemetry.enable .Values.nginx.plus }} +{{- if .Values.nginxGateway.productTelemetry.enable }} - apiGroups: - "" resources: @@ -47,17 +47,26 @@ rules: verbs: - get - apiGroups: - - "" + - apps resources: - - nodes + - replicasets verbs: - - list + - get +{{- end }} +{{- if .Values.nginx.plus }} - apiGroups: - apps resources: - replicasets verbs: - - get + - list +{{- end }} +{{- if or .Values.nginxGateway.productTelemetry.enable .Values.nginx.plus }} +- apiGroups: + - "" + resources: + - nodes + verbs: - list {{- end }} - apiGroups: diff --git a/deploy/helm-chart/values.yaml b/deploy/helm-chart/values.yaml index c9951768d1..c0dbe5eb6f 100644 --- a/deploy/helm-chart/values.yaml +++ b/deploy/helm-chart/values.yaml @@ -46,7 +46,7 @@ nginxGateway: allowPrivilegeEscalation: false productTelemetry: - ## Enable the collection of product telemetry every 24 hours. + ## Enable the collection of product telemetry. enable: true ## The lifecycle of the nginx-gateway container. diff --git a/deploy/manifests/nginx-gateway-experimental.yaml b/deploy/manifests/nginx-gateway-experimental.yaml index 1563fc7eb4..7cf2912885 100644 --- a/deploy/manifests/nginx-gateway-experimental.yaml +++ b/deploy/manifests/nginx-gateway-experimental.yaml @@ -43,18 +43,17 @@ rules: - pods verbs: - get -- apiGroups: - - "" - resources: - - nodes - verbs: - - list - apiGroups: - apps resources: - replicasets verbs: - get +- apiGroups: + - "" + resources: + - nodes + verbs: - list - apiGroups: - "" diff --git a/deploy/manifests/nginx-gateway.yaml b/deploy/manifests/nginx-gateway.yaml index 20b039c7d6..933e66d4ec 100644 --- a/deploy/manifests/nginx-gateway.yaml +++ b/deploy/manifests/nginx-gateway.yaml @@ -42,18 +42,17 @@ rules: - pods verbs: - get -- apiGroups: - - "" - resources: - - nodes - verbs: - - list - apiGroups: - apps resources: - replicasets verbs: - get +- apiGroups: + - "" + resources: + - nodes + verbs: - list - apiGroups: - "" diff --git a/deploy/manifests/nginx-plus-gateway-experimental.yaml b/deploy/manifests/nginx-plus-gateway-experimental.yaml index 2436ea1aae..88b5249c34 100644 --- a/deploy/manifests/nginx-plus-gateway-experimental.yaml +++ b/deploy/manifests/nginx-plus-gateway-experimental.yaml @@ -44,17 +44,22 @@ rules: verbs: - get - apiGroups: - - "" + - apps resources: - - nodes + - replicasets verbs: - - list + - get - apiGroups: - apps resources: - replicasets verbs: - - get + - list +- apiGroups: + - "" + resources: + - nodes + verbs: - list - apiGroups: - "" diff --git a/deploy/manifests/nginx-plus-gateway.yaml b/deploy/manifests/nginx-plus-gateway.yaml index d5bfc14b87..e0de54f541 100644 --- a/deploy/manifests/nginx-plus-gateway.yaml +++ b/deploy/manifests/nginx-plus-gateway.yaml @@ -43,17 +43,22 @@ rules: verbs: - get - apiGroups: - - "" + - apps resources: - - nodes + - replicasets verbs: - - list + - get - apiGroups: - apps resources: - replicasets verbs: - - get + - list +- apiGroups: + - "" + resources: + - nodes + verbs: - list - apiGroups: - "" diff --git a/internal/mode/static/config/config.go b/internal/mode/static/config/config.go index be1378cb6a..7f9a5a6552 100644 --- a/internal/mode/static/config/config.go +++ b/internal/mode/static/config/config.go @@ -36,12 +36,10 @@ type Config struct { MetricsConfig MetricsConfig // HealthConfig specifies the health probe config. HealthConfig HealthConfig - // TelemetryReportPeriod is the period at which telemetry reports are sent. - TelemetryReportPeriod time.Duration + // ProductTelemetryConfig contains the configuration for collecting product telemetry. + ProductTelemetryConfig ProductTelemetryConfig // UpdateGatewayClassStatus enables updating the status of the GatewayClass resource. UpdateGatewayClassStatus bool - // DisableProductTelemetry disables the collection of product telemetry. - DisableProductTelemetry bool // Plus indicates whether NGINX Plus is being used. Plus bool // ExperimentalFeatures indicates if experimental features are enabled. @@ -88,6 +86,14 @@ type LeaderElectionConfig struct { Enabled bool } +// ProductTelemetryConfig contains the configuration for collecting product telemetry. +type ProductTelemetryConfig struct { + // TelemetryReportPeriod is the period at which telemetry reports are sent. + TelemetryReportPeriod time.Duration + // DisableProductTelemetry disables the collection of product telemetry. + DisableProductTelemetry bool +} + // UsageReportConfig contains the configuration for NGINX Plus usage reporting. type UsageReportConfig struct { // SecretNsName is the namespaced name of the Secret containing the server credentials. diff --git a/internal/mode/static/manager.go b/internal/mode/static/manager.go index 1809ffa3f4..ef6f15741b 100644 --- a/internal/mode/static/manager.go +++ b/internal/mode/static/manager.go @@ -242,7 +242,7 @@ func StartManager(cfg config.Config) error { return fmt.Errorf("cannot register status updater: %w", err) } - if !cfg.DisableProductTelemetry { + if !cfg.ProductTelemetryConfig.DisableProductTelemetry { dataCollector := telemetry.NewDataCollectorImpl(telemetry.DataCollectorConfig{ K8sClientReader: mgr.GetAPIReader(), GraphGetter: processor, @@ -475,7 +475,7 @@ func createTelemetryJob( runnables.CronJobConfig{ Worker: telemetry.CreateTelemetryJobWorker(logger, exporter, dataCollector), Logger: logger, - Period: cfg.TelemetryReportPeriod, + Period: cfg.ProductTelemetryConfig.TelemetryReportPeriod, JitterFactor: telemetryJitterFactor, ReadyCh: readyCh, }, @@ -503,7 +503,7 @@ func createUsageReporterJob( Runnable: runnables.NewCronJob(runnables.CronJobConfig{ Worker: usage.CreateUsageJobWorker(logger, k8sClient, reporter, cfg), Logger: logger, - Period: cfg.TelemetryReportPeriod, + Period: cfg.ProductTelemetryConfig.TelemetryReportPeriod, JitterFactor: telemetryJitterFactor, ReadyCh: readyCh, }), diff --git a/site/content/reference/cli-help.md b/site/content/reference/cli-help.md index 82e6e54f8d..f40c1067ba 100644 --- a/site/content/reference/cli-help.md +++ b/site/content/reference/cli-help.md @@ -36,7 +36,7 @@ _Usage_: | _health-port_ | _int_ | Set the port where the health probe server is exposed. An integer between 1024 - 65535 (Default: `8081`). | | _leader-election-disable_ | _bool_ | Disable leader election, which is used to avoid multiple replicas of the NGINX Gateway Fabric reporting the status of the Gateway API resources. If disabled, all replicas of NGINX Gateway Fabric will update the statuses of the Gateway API resources (Default: `false`). | | _leader-election-lock-name_ | _string_ | The name of the leader election lock. A lease object with this name will be created in the same namespace as the controller (Default: `"nginx-gateway-leader-election-lock"`). | -| _product-telemetry-disable_ | _bool_ | Disable the collection of product telemetry every 24 hours (Default: `false`). | +| _product-telemetry-disable_ | _bool_ | Disable the collection of product telemetry (Default: `false`). | | _usage-report-secret_ | _string_ | The namespace/name of the Secret containing the credentials for NGINX Plus usage reporting. | | _usage-report-server-url_ | _string_ | The base server URL of the NGINX Plus usage reporting server. | | _usage-report-cluster-name_ | _string_ | The display name of the Kubernetes cluster in the NGINX Plus usage reporting server. | From 2a0e1d0662f01bf1e648ae70d5f64640af061620 Mon Sep 17 00:00:00 2001 From: Saylor Berman Date: Wed, 21 Feb 2024 15:15:03 -0700 Subject: [PATCH 3/3] Flip enabled flag --- cmd/gateway/commands.go | 4 ++-- internal/mode/static/config/config.go | 4 ++-- internal/mode/static/manager.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/gateway/commands.go b/cmd/gateway/commands.go index 518be56f6d..32e819c219 100644 --- a/cmd/gateway/commands.go +++ b/cmd/gateway/commands.go @@ -208,8 +208,8 @@ func createStaticModeCommand() *cobra.Command { }, UsageReportConfig: usageReportConfig, ProductTelemetryConfig: config.ProductTelemetryConfig{ - TelemetryReportPeriod: period, - DisableProductTelemetry: disableProductTelemetry, + TelemetryReportPeriod: period, + Enabled: !disableProductTelemetry, }, Plus: plus, Version: version, diff --git a/internal/mode/static/config/config.go b/internal/mode/static/config/config.go index 7f9a5a6552..5f93a3e3d6 100644 --- a/internal/mode/static/config/config.go +++ b/internal/mode/static/config/config.go @@ -90,8 +90,8 @@ type LeaderElectionConfig struct { type ProductTelemetryConfig struct { // TelemetryReportPeriod is the period at which telemetry reports are sent. TelemetryReportPeriod time.Duration - // DisableProductTelemetry disables the collection of product telemetry. - DisableProductTelemetry bool + // Enabled is the flag for toggling the collection of product telemetry. + Enabled bool } // UsageReportConfig contains the configuration for NGINX Plus usage reporting. diff --git a/internal/mode/static/manager.go b/internal/mode/static/manager.go index ef6f15741b..f13d24cc53 100644 --- a/internal/mode/static/manager.go +++ b/internal/mode/static/manager.go @@ -242,7 +242,7 @@ func StartManager(cfg config.Config) error { return fmt.Errorf("cannot register status updater: %w", err) } - if !cfg.ProductTelemetryConfig.DisableProductTelemetry { + if cfg.ProductTelemetryConfig.Enabled { dataCollector := telemetry.NewDataCollectorImpl(telemetry.DataCollectorConfig{ K8sClientReader: mgr.GetAPIReader(), GraphGetter: processor,