@@ -400,26 +400,27 @@ func addPluginListRoute(config *HeadlampConfig, r *mux.Router) {
400
400
}).Methods ("GET" )
401
401
}
402
402
403
- //nolint:gocognit,funlen,gocyclo
404
- func createHeadlampHandler (config * HeadlampConfig ) http.Handler {
405
- kubeConfigPath := config .KubeConfigPath
406
-
407
- config .StaticPluginDir = os .Getenv ("HEADLAMP_STATIC_PLUGINS_DIR" )
408
-
409
- logStartupInfo (config );
410
-
403
+ // setupPluginHandlers initializes the plugin cache and sets up handlers for plugins.
404
+ func setupPluginHandlers (config * HeadlampConfig , skipFunc kubeconfig.ShouldBeSkippedFunc ) {
411
405
plugins .PopulatePluginsCache (config .StaticPluginDir , config .PluginDir , config .cache )
412
406
413
- skipFunc := kubeconfig .SkipKubeContextInCommaSeparatedString (config .SkippedKubeContexts )
414
-
415
407
if ! config .UseInCluster || config .WatchPluginsChanges {
416
- // in-cluster mode is unlikely to want reloading plugins.
417
408
pluginEventChan := make (chan string )
418
409
go plugins .Watch (config .PluginDir , pluginEventChan )
419
410
go plugins .HandlePluginEvents (config .StaticPluginDir , config .PluginDir , pluginEventChan , config .cache )
420
- // in-cluster mode is unlikely to want reloading kubeconfig.
421
- go kubeconfig .LoadAndWatchFiles (config .KubeConfigStore , kubeConfigPath , kubeconfig .KubeConfig , skipFunc )
411
+ go kubeconfig .LoadAndWatchFiles (config .KubeConfigStore , config .KubeConfigPath , kubeconfig .KubeConfig , skipFunc )
422
412
}
413
+ }
414
+
415
+ //nolint:gocognit,funlen,gocyclo
416
+ func createHeadlampHandler (config * HeadlampConfig ) http.Handler {
417
+ kubeConfigPath := config .KubeConfigPath
418
+
419
+ config .StaticPluginDir = os .Getenv ("HEADLAMP_STATIC_PLUGINS_DIR" )
420
+
421
+ logStartupInfo (config )
422
+ skipFunc := kubeconfig .SkipKubeContextInCommaSeparatedString (config .SkippedKubeContexts )
423
+ setupPluginHandlers (config , skipFunc )
423
424
424
425
// In-cluster
425
426
if config .UseInCluster {
0 commit comments