Skip to content

Commit 1aee38b

Browse files
committed
app: backend: Add flag to disable plugins watch
This change creates a CLI flag in the backend + desktop to disable the plugins watch. Fixes: #2894 Signed-off-by: Evangelos Skopelitis <[email protected]>
1 parent 66b310c commit 1aee38b

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

app/electron/main.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ const args = yargs(hideBin(process.argv))
8383
describe: 'Disable use of GPU. For people who may have buggy graphics drivers',
8484
type: 'boolean',
8585
},
86+
'disable-plugins-watch': {
87+
describe: 'Disable watching for changes in the plugins directory',
88+
type: 'boolean',
89+
},
8690
})
8791
.positional('kubeconfig', {
8892
describe:
@@ -551,6 +555,9 @@ async function startServer(flags: string[] = []): Promise<ChildProcessWithoutNul
551555
if (!!proxyUrls && proxyUrls.length > 0) {
552556
serverArgs = serverArgs.concat(['--proxy-urls', proxyUrls.join(',')]);
553557
}
558+
if (!!args.disablePluginsWatch) {
559+
serverArgs.push('--disable-plugins-watch');
560+
}
554561

555562
const bundledPlugins = path.join(process.resourcesPath, '.plugins');
556563

backend/cmd/headlamp.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ type HeadlampConfig struct {
4646
insecure bool
4747
enableHelm bool
4848
enableDynamicClusters bool
49+
disablePluginsWatch bool
4950
port uint
5051
kubeConfigPath string
5152
staticDir string
@@ -353,7 +354,7 @@ func createHeadlampHandler(config *HeadlampConfig) http.Handler {
353354

354355
plugins.PopulatePluginsCache(config.staticPluginDir, config.pluginDir, config.cache)
355356

356-
if !config.useInCluster {
357+
if !config.useInCluster && !config.disablePluginsWatch {
357358
// in-cluster mode is unlikely to want reloading plugins.
358359
pluginEventChan := make(chan string)
359360
go plugins.Watch(config.pluginDir, pluginEventChan)

backend/cmd/server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ func main() {
5252
proxyURLs: strings.Split(conf.ProxyURLs, ","),
5353
enableHelm: conf.EnableHelm,
5454
enableDynamicClusters: conf.EnableDynamicClusters,
55+
disablePluginsWatch: conf.DisablePluginsWatch,
5556
cache: cache,
5657
kubeConfigStore: kubeConfigStore,
5758
multiplexer: multiplexer,

backend/pkg/config/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ type Config struct {
2525
InsecureSsl bool `koanf:"insecure-ssl"`
2626
EnableHelm bool `koanf:"enable-helm"`
2727
EnableDynamicClusters bool `koanf:"enable-dynamic-clusters"`
28+
DisablePluginsWatch bool `koanf:"disable-plugins-watch"`
2829
Port uint `koanf:"port"`
2930
KubeConfigPath string `koanf:"kubeconfig"`
3031
StaticDir string `koanf:"html-static-dir"`
@@ -153,6 +154,7 @@ func flagset() *flag.FlagSet {
153154
f.Bool("dev", false, "Allow connections from other origins")
154155
f.Bool("insecure-ssl", false, "Accept/Ignore all server SSL certificates")
155156
f.Bool("enable-dynamic-clusters", false, "Enable dynamic clusters, which stores stateless clusters in the frontend.")
157+
f.Bool("disable-plugins-watch", false, "Disable watching for changes in the plugins directory")
156158

157159
f.String("kubeconfig", "", "Absolute path to the kubeconfig file")
158160
f.String("html-static-dir", "", "Static HTML directory to serve")

0 commit comments

Comments
 (0)