From e74505e7527013107757df224542040c92ea6530 Mon Sep 17 00:00:00 2001 From: Michael Pleshakov Date: Mon, 18 Mar 2024 13:46:05 -0400 Subject: [PATCH] Disable sending telemetry in tests Problem: b6cb677 enabled product telemetry reporting. However, the telemetry is also reported when running tests, which we want to avoid, so that the gathered telemetry doesn't include data from our test runs. Solution: Disable telemetry for: - Conformance tests - Helm chart - NFR and functional tests CLOSES - https://github.com/nginxinc/nginx-gateway-fabric/issues/1705 Testing: - To be confirmed by the pipeline - Ran telemetry functional test manually successfully. - Ran NGR test successfully on GCP. No telemetry were reported, confirmed on the telemetry receiver side. (Note. Upgrade test failed with "Error: INSTALLATION FAILED: release name "": no name provided" error. However, this was not caused by this commit and out of scope of this commit) --- .github/workflows/ci.yml | 1 + Makefile | 2 +- conformance/provisioner/static-deployment.yaml | 1 + tests/framework/ngf.go | 15 +++++++++++++-- tests/suite/telemetry_test.go | 5 ++++- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ba03619638..c955e85b3e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -301,6 +301,7 @@ jobs: --set nginxGateway.image.repository=ghcr.io/nginxinc/nginx-gateway-fabric --set nginxGateway.image.tag=${{ steps.ngf-meta.outputs.version }} --set nginxGateway.image.pullPolicy=Never + --set nginxGateway.productTelemetry.enable=false --set nginx.image.repository=ghcr.io/nginxinc/nginx-gateway-fabric/nginx --set nginx.image.tag=${{ steps.nginx-meta.outputs.version }} --set nginx.image.pullPolicy=Never diff --git a/Makefile b/Makefile index 36a1b9d5ce..d5f8fcebe9 100644 --- a/Makefile +++ b/Makefile @@ -110,7 +110,7 @@ generate-manifests: ## Generate manifests using Helm. helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) $(HELM_TEMPLATE_EXTRA_ARGS_FOR_ALL_MANIFESTS_FILE) --set nginx.plus=true --set nginx.image.repository=$(NGINX_PLUS_PREFIX) -n nginx-gateway | cat $(strip $(MANIFEST_DIR))/namespace.yaml - > $(strip $(MANIFEST_DIR))/nginx-plus-gateway.yaml helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) $(HELM_TEMPLATE_EXTRA_ARGS_FOR_ALL_MANIFESTS_FILE) --set nginxGateway.gwAPIExperimentalFeatures.enable=true -n nginx-gateway | cat $(strip $(MANIFEST_DIR))/namespace.yaml - > $(strip $(MANIFEST_DIR))/nginx-gateway-experimental.yaml helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) $(HELM_TEMPLATE_EXTRA_ARGS_FOR_ALL_MANIFESTS_FILE) --set nginxGateway.gwAPIExperimentalFeatures.enable=true --set nginx.plus=true --set nginx.image.repository=$(NGINX_PLUS_PREFIX) -n nginx-gateway | cat $(strip $(MANIFEST_DIR))/namespace.yaml - > $(strip $(MANIFEST_DIR))/nginx-plus-gateway-experimental.yaml - helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) --set metrics.enable=false -n nginx-gateway -s templates/deployment.yaml > conformance/provisioner/static-deployment.yaml + helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) --set metrics.enable=false --set nginxGateway.productTelemetry.enable=false -n nginx-gateway -s templates/deployment.yaml > conformance/provisioner/static-deployment.yaml helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) -n nginx-gateway -s templates/service.yaml > $(strip $(MANIFEST_DIR))/service/loadbalancer.yaml helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) --set service.annotations.'service\.beta\.kubernetes\.io\/aws-load-balancer-type'="nlb" -n nginx-gateway -s templates/service.yaml > $(strip $(MANIFEST_DIR))/service/loadbalancer-aws-nlb.yaml helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) --set service.type=NodePort --set service.externalTrafficPolicy="" -n nginx-gateway -s templates/service.yaml > $(strip $(MANIFEST_DIR))/service/nodeport.yaml diff --git a/conformance/provisioner/static-deployment.yaml b/conformance/provisioner/static-deployment.yaml index c6b2326b04..58396a2a0a 100644 --- a/conformance/provisioner/static-deployment.yaml +++ b/conformance/provisioner/static-deployment.yaml @@ -31,6 +31,7 @@ spec: - --metrics-disable - --health-port=8081 - --leader-election-lock-name=nginx-gateway-leader-election + - --product-telemetry-disable env: - name: POD_IP valueFrom: diff --git a/tests/framework/ngf.go b/tests/framework/ngf.go index 5e27dd58ca..6eb048b711 100644 --- a/tests/framework/ngf.go +++ b/tests/framework/ngf.go @@ -108,7 +108,13 @@ func UninstallGatewayAPI(apiVersion, k8sVersion string) ([]byte, error) { // InstallNGF installs NGF. func InstallNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) { args := []string{ - "install", cfg.ReleaseName, cfg.ChartPath, "--create-namespace", "--namespace", cfg.Namespace, "--wait", + "install", + cfg.ReleaseName, + cfg.ChartPath, + "--create-namespace", + "--namespace", cfg.Namespace, + "--wait", + "--set", "nginxGateway.productTelemetry.enable=false", } args = append(args, setImageArgs(cfg)...) @@ -125,7 +131,12 @@ func UpgradeNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) { } args := []string{ - "upgrade", cfg.ReleaseName, cfg.ChartPath, "--namespace", cfg.Namespace, "--wait", + "upgrade", + cfg.ReleaseName, + cfg.ChartPath, + "--namespace", cfg.Namespace, + "--wait", + "--set", "nginxGateway.productTelemetry.enable=false", } args = append(args, setImageArgs(cfg)...) diff --git a/tests/suite/telemetry_test.go b/tests/suite/telemetry_test.go index 6c62d31488..dab0fca191 100644 --- a/tests/suite/telemetry_test.go +++ b/tests/suite/telemetry_test.go @@ -30,7 +30,10 @@ var _ = Describe("Telemetry test with OTel collector", Label("telemetry"), func( // Install NGF // Note: the BeforeSuite call doesn't install NGF for 'telemetry' label - setup(getDefaultSetupCfg()) + setup( + getDefaultSetupCfg(), + "--set", "nginxGateway.productTelemetry.enable=true", + ) }) AfterEach(func() {