Skip to content

Commit 1db20de

Browse files
committed
pkg/cvo/metrics: Fix nil handling
1 parent ff6d96e commit 1db20de

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/cvo/metrics.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ func RunMetrics(runContext context.Context, shutdownContext context.Context, lis
222222
// Start the serving cert controller to begin watching the cert and key files
223223
go servingContentController.Run(runContext, 1)
224224

225+
var clientCA dynamiccertificates.CAContentProvider
225226
var clientCAController *dynamiccertificates.ConfigMapCAController
226227
if !metricsOptions.DisableAuthentication {
227228
// Create a dynamic CA controller to watch for client CA changes from a ConfigMap.
@@ -246,6 +247,9 @@ func RunMetrics(runContext context.Context, shutdownContext context.Context, lis
246247

247248
// Start the client CA controller to begin watching the ConfigMap
248249
go clientCAController.Run(runContext, 1)
250+
251+
// Assign to interface variable to ensure proper nil handling
252+
clientCA = clientCAController
249253
}
250254

251255
// Determine client authentication mode once and reuse it for both base and listener configs
@@ -257,7 +261,7 @@ func RunMetrics(runContext context.Context, shutdownContext context.Context, lis
257261
baseTlSConfig := crypto.SecureTLSConfig(&tls.Config{ClientAuth: clientAuth})
258262
servingCertController := dynamiccertificates.NewDynamicServingCertificateController(
259263
baseTlSConfig,
260-
clientCAController,
264+
clientCA,
261265
servingContentController,
262266
nil,
263267
nil,

0 commit comments

Comments
 (0)