@@ -35,6 +35,7 @@ type InstallationConfig struct {
3535 ServiceType string
3636 IsGKEInternalLB bool
3737 Plus bool
38+ Telemetry bool
3839}
3940
4041// InstallGatewayAPI installs the specified version of the Gateway API resources.
@@ -70,14 +71,14 @@ func InstallNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) {
7071 "--create-namespace" ,
7172 "--namespace" , cfg .Namespace ,
7273 "--wait" ,
73- "--set" , "nginxGateway.productTelemetry.enable=false" ,
7474 "--set" , "nginxGateway.snippetsFilters.enable=true" ,
7575 }
7676 if cfg .ChartVersion != "" {
7777 args = append (args , "--version" , cfg .ChartVersion )
7878 }
7979
8080 args = append (args , setImageArgs (cfg )... )
81+ args = append (args , setTelemetryArgs (cfg )... )
8182 fullArgs := append (args , extraArgs ... ) //nolint:gocritic
8283
8384 GinkgoWriter .Printf ("Installing NGF with command: helm %v\n " , strings .Join (fullArgs , " " ))
@@ -136,7 +137,6 @@ func UpgradeNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) {
136137 cfg .ChartPath ,
137138 "--namespace" , cfg .Namespace ,
138139 "--wait" ,
139- "--set" , "nginxGateway.productTelemetry.enable=false" ,
140140 "--set" , "nginxGateway.config.logging.level=debug" ,
141141 "--set" , "nginxGateway.snippetsFilter.enable=true" ,
142142 }
@@ -145,6 +145,7 @@ func UpgradeNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) {
145145 }
146146
147147 args = append (args , setImageArgs (cfg )... )
148+ args = append (args , setTelemetryArgs (cfg )... )
148149 fullArgs := append (args , extraArgs ... ) //nolint:gocritic
149150
150151 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
188189 return nil , nil
189190}
190191
192+ func setTelemetryArgs (cfg InstallationConfig ) []string {
193+ var args []string
194+
195+ args = append (args , formatValueSet ("nginxGateway.productTelemetry.enable" , "false" )... )
196+ if cfg .Telemetry {
197+ args = append (args , formatValueSet ("nginxGateway.productTelemetry.enable" , "true" )... )
198+ }
199+ return args
200+ }
201+
191202func setImageArgs (cfg InstallationConfig ) []string {
192203 var args []string
193204
0 commit comments