From eb55dd809f98ba9b84d884870ed655eeedb818d7 Mon Sep 17 00:00:00 2001 From: salonichf5 <146118978+salonichf5@users.noreply.github.com> Date: Tue, 26 Nov 2024 15:45:44 -0800 Subject: [PATCH 1/2] enable and update endpoint for telemetry for longevity tests --- .github/workflows/ci.yml | 2 +- tests/framework/ngf.go | 15 +++++++++++++-- tests/suite/system_suite_test.go | 6 ++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d390ca2c42..59524fa9f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -180,7 +180,7 @@ jobs: AZURE_STORAGE_KEY: ${{ secrets.AZURE_STORAGE_KEY }} AZURE_BUCKET_NAME: ${{ secrets.AZURE_BUCKET_NAME }} SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_COMMUNITY }} - TELEMETRY_ENDPOINT: oss.edge.df.f5.com:443 + TELEMETRY_ENDPOINT: ${{ github.ref_type == 'branch' && github.event_name == 'push' && github.ref == 'refs/heads/release' && 'oss-dev.edge.df.f5.com:443' || 'oss.edge.df.f5.com:443' }} TELEMETRY_ENDPOINT_INSECURE: "false" - name: Cache Artifacts diff --git a/tests/framework/ngf.go b/tests/framework/ngf.go index 6c3008d882..cd48a16aac 100644 --- a/tests/framework/ngf.go +++ b/tests/framework/ngf.go @@ -35,6 +35,7 @@ type InstallationConfig struct { ServiceType string IsGKEInternalLB bool Plus bool + Telemetry bool } // InstallGatewayAPI installs the specified version of the Gateway API resources. @@ -70,7 +71,6 @@ func InstallNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) { "--create-namespace", "--namespace", cfg.Namespace, "--wait", - "--set", "nginxGateway.productTelemetry.enable=false", "--set", "nginxGateway.snippetsFilters.enable=true", } if cfg.ChartVersion != "" { @@ -78,6 +78,7 @@ func InstallNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) { } args = append(args, setImageArgs(cfg)...) + args = append(args, setTelemetryArgs(cfg)...) fullArgs := append(args, extraArgs...) //nolint:gocritic GinkgoWriter.Printf("Installing NGF with command: helm %v\n", strings.Join(fullArgs, " ")) @@ -136,7 +137,6 @@ func UpgradeNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) { cfg.ChartPath, "--namespace", cfg.Namespace, "--wait", - "--set", "nginxGateway.productTelemetry.enable=false", "--set", "nginxGateway.config.logging.level=debug", "--set", "nginxGateway.snippetsFilter.enable=true", } @@ -145,6 +145,7 @@ func UpgradeNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) { } args = append(args, setImageArgs(cfg)...) + args = append(args, setTelemetryArgs(cfg)...) fullArgs := append(args, extraArgs...) //nolint:gocritic GinkgoWriter.Printf("Upgrading NGF with command: helm %v\n", strings.Join(fullArgs, " ")) @@ -188,6 +189,16 @@ func UninstallNGF(cfg InstallationConfig, k8sClient client.Client) ([]byte, erro return nil, nil } +func setTelemetryArgs(cfg InstallationConfig) []string { + var args []string + + args = append(args, formatValueSet("nginxGateway.productTelemetry.enable", "false")...) + if cfg.Telemetry { + args = append(args, formatValueSet("nginxGateway.productTelemetry.enable", "true")...) + } + return args +} + func setImageArgs(cfg InstallationConfig) []string { var args []string diff --git a/tests/suite/system_suite_test.go b/tests/suite/system_suite_test.go index 7c51bc8e97..f4bce1b1b9 100644 --- a/tests/suite/system_suite_test.go +++ b/tests/suite/system_suite_test.go @@ -99,6 +99,7 @@ type setupConfig struct { deploy bool nfr bool debugLogLevel bool + telemetry bool } func setup(cfg setupConfig, extraInstallArgs ...string) { @@ -151,6 +152,10 @@ func setup(cfg setupConfig, extraInstallArgs ...string) { Skip("Graceful Recovery test must be run on Kind") } + if clusterInfo.IsGKE && strings.Contains(GinkgoLabelFilter(), "longevity") { + cfg.telemetry = true + } + switch { case *versionUnderTest != "": version = *versionUnderTest @@ -196,6 +201,7 @@ func createNGFInstallConfig(cfg setupConfig, extraInstallArgs ...string) framewo ServiceType: *serviceType, IsGKEInternalLB: *isGKEInternalLB, Plus: *plusEnabled, + Telemetry: cfg.telemetry, } // if we aren't installing from the public charts, then set the custom images From 0c92abbccbd424850045f2180401b2ee8ca81c61 Mon Sep 17 00:00:00 2001 From: salonichf5 <146118978+salonichf5@users.noreply.github.com> Date: Wed, 27 Nov 2024 13:47:39 -0800 Subject: [PATCH 2/2] update based on reviews --- .github/workflows/ci.yml | 2 +- tests/framework/ngf.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 59524fa9f3..1292261572 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -180,7 +180,7 @@ jobs: AZURE_STORAGE_KEY: ${{ secrets.AZURE_STORAGE_KEY }} AZURE_BUCKET_NAME: ${{ secrets.AZURE_BUCKET_NAME }} SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_COMMUNITY }} - TELEMETRY_ENDPOINT: ${{ github.ref_type == 'branch' && github.event_name == 'push' && github.ref == 'refs/heads/release' && 'oss-dev.edge.df.f5.com:443' || 'oss.edge.df.f5.com:443' }} + TELEMETRY_ENDPOINT: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release-') && 'oss-dev.edge.df.f5.com:443' || 'oss.edge.df.f5.com:443' }} TELEMETRY_ENDPOINT_INSECURE: "false" - name: Cache Artifacts diff --git a/tests/framework/ngf.go b/tests/framework/ngf.go index cd48a16aac..f19ea751b7 100644 --- a/tests/framework/ngf.go +++ b/tests/framework/ngf.go @@ -192,9 +192,10 @@ func UninstallNGF(cfg InstallationConfig, k8sClient client.Client) ([]byte, erro func setTelemetryArgs(cfg InstallationConfig) []string { var args []string - args = append(args, formatValueSet("nginxGateway.productTelemetry.enable", "false")...) if cfg.Telemetry { args = append(args, formatValueSet("nginxGateway.productTelemetry.enable", "true")...) + } else { + args = append(args, formatValueSet("nginxGateway.productTelemetry.enable", "false")...) } return args }