Skip to content

Commit 92e640b

Browse files
committed
update based on review
1 parent 44d5b24 commit 92e640b

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

internal/controller/manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ func StartManager(cfg config.Config) error {
291291
},
292292
ImageSource: cfg.ImageSource,
293293
Flags: cfg.Flags,
294-
NginxOneConsoleSecretName: cfg.NginxOneConsoleTelemetryConfig.DataplaneKeySecretName,
294+
NginxOneConsoleConnection: cfg.NginxOneConsoleTelemetryConfig.DataplaneKeySecretName != "",
295295
})
296296

297297
job, err := createTelemetryJob(cfg, dataCollector, healthChecker.getReadyCh())

internal/controller/telemetry/collector.go

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,22 @@ type NGFResourceCounts struct {
109109

110110
// DataCollectorConfig holds configuration parameters for DataCollectorImpl.
111111
type DataCollectorConfig struct {
112-
K8sClientReader client.Reader
113-
GraphGetter GraphGetter
114-
ConfigurationGetter ConfigurationGetter
115-
PodNSName types.NamespacedName
116-
Version string
117-
ImageSource string
118-
NginxOneConsoleSecretName string
119-
Flags config.Flags
112+
// K8sClientReader is a Kubernetes API client Reader.
113+
K8sClientReader client.Reader
114+
// GraphGetter allows us to get the Graph.
115+
GraphGetter GraphGetter
116+
// ConfigurationGetter allows us to get the Configuration.
117+
ConfigurationGetter ConfigurationGetter
118+
// PodNSName is the NamespacedName of the NGF Pod.
119+
PodNSName types.NamespacedName
120+
// Version is the NGF version.
121+
Version string
122+
// ImageSource is the source of the NGF image.
123+
ImageSource string
124+
// Flags contains the command-line NGF flag keys and values.
125+
Flags config.Flags
126+
// NginxOneConsoleConnection is a boolean that indicates whether the connection to the Nginx One Console is enabled.
127+
NginxOneConsoleConnection bool
120128
}
121129

122130
// DataCollectorImpl is am implementation of DataCollector.
@@ -185,7 +193,7 @@ func (c DataCollectorImpl) Collect(ctx context.Context) (Data, error) {
185193
SnippetsFiltersDirectivesCount: snippetsFiltersDirectivesCount,
186194
NginxPodCount: nginxPodCount,
187195
ControlPlanePodCount: int64(replicaCount),
188-
NginxOneConnectionEnabled: c.cfg.NginxOneConsoleSecretName != "",
196+
NginxOneConnectionEnabled: c.cfg.NginxOneConsoleConnection,
189197
}
190198

191199
return data, nil

internal/controller/telemetry/collector_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ var _ = Describe("Collector", Ordered, func() {
194194
PodNSName: podNSName,
195195
ImageSource: "local",
196196
Flags: flags,
197-
NginxOneConsoleSecretName: "nginx-one-console-secret",
197+
NginxOneConsoleConnection: true,
198198
})
199199

200200
baseGetCalls = createGetCallsFunc(ngfPod, ngfReplicaSet, kubeNamespace)

0 commit comments

Comments
 (0)