@@ -35,6 +35,7 @@ type InstallationConfig struct {
35
35
ServiceType string
36
36
IsGKEInternalLB bool
37
37
Plus bool
38
+ Telemetry bool
38
39
}
39
40
40
41
// InstallGatewayAPI installs the specified version of the Gateway API resources.
@@ -70,14 +71,14 @@ func InstallNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) {
70
71
"--create-namespace" ,
71
72
"--namespace" , cfg .Namespace ,
72
73
"--wait" ,
73
- "--set" , "nginxGateway.productTelemetry.enable=false" ,
74
74
"--set" , "nginxGateway.snippetsFilters.enable=true" ,
75
75
}
76
76
if cfg .ChartVersion != "" {
77
77
args = append (args , "--version" , cfg .ChartVersion )
78
78
}
79
79
80
80
args = append (args , setImageArgs (cfg )... )
81
+ args = append (args , setTelemetryArgs (cfg )... )
81
82
fullArgs := append (args , extraArgs ... ) //nolint:gocritic
82
83
83
84
GinkgoWriter .Printf ("Installing NGF with command: helm %v\n " , strings .Join (fullArgs , " " ))
@@ -136,7 +137,6 @@ func UpgradeNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) {
136
137
cfg .ChartPath ,
137
138
"--namespace" , cfg .Namespace ,
138
139
"--wait" ,
139
- "--set" , "nginxGateway.productTelemetry.enable=false" ,
140
140
"--set" , "nginxGateway.config.logging.level=debug" ,
141
141
"--set" , "nginxGateway.snippetsFilter.enable=true" ,
142
142
}
@@ -145,6 +145,7 @@ func UpgradeNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) {
145
145
}
146
146
147
147
args = append (args , setImageArgs (cfg )... )
148
+ args = append (args , setTelemetryArgs (cfg )... )
148
149
fullArgs := append (args , extraArgs ... ) //nolint:gocritic
149
150
150
151
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
188
189
return nil , nil
189
190
}
190
191
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
+
191
202
func setImageArgs (cfg InstallationConfig ) []string {
192
203
var args []string
193
204
0 commit comments