Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flag to disable plugins watch #2894

Open
adriangonz opened this issue Feb 12, 2025 · 2 comments · May be fixed by #2939
Open

Add flag to disable plugins watch #2894

adriangonz opened this issue Feb 12, 2025 · 2 comments · May be fixed by #2939
Assignees
Labels
enhancement New feature or request plugins

Comments

@adriangonz
Copy link

adriangonz commented Feb 12, 2025

Is your feature request related to a problem? Please describe the impact that the lack of the feature requested is creating.

We don't run in Headlamp in cluster, but we do build a Headlamp image with a few pre-configured Kubeconfigs which we then host and expose to give access to several clusters. The plugins are baked into the Headlamp image and are not expected to change at run-time.

However, if we add anything to the /plugins folder (instead of the /static-plugins folder), Headlamp's frontend will constantly keep refreshing (every ~5 secs). Headlamp's backend keeps showing the following message:

{"level":"info","source":"/headlamp/backend/pkg/plugins/plugins.go","line":312,"time":"2025-02-12T11:51:30Z","message":"Sending reload plugins signal to frontend"}

There seems to be a "watch" running over the files in the /plugins folder which gets disabled when Headlamp is running in-cluster:

if !config.useInCluster {
// in-cluster mode is unlikely to want reloading plugins.
pluginEventChan := make(chan string)
go plugins.Watch(config.pluginDir, pluginEventChan)
go plugins.HandlePluginEvents(config.staticPluginDir, config.pluginDir, pluginEventChan, config.cache)
// in-cluster mode is unlikely to want reloading kubeconfig.
go kubeconfig.LoadAndWatchFiles(config.kubeConfigStore, kubeConfigPath, kubeconfig.KubeConfig)
}

It seems like the same would be useful on other contexts when Headlamp is not necessarily running in-cluster. Would it be possible to add a new flag to control whether the plugins watch is disabled?

Describe the solution you'd like

A new env var or CLI flag to disable the plugins watch.

What users will benefit from this feature?

Users neither running Headlamp in-cluster, nor locally within a Desktop app.

Are you able to implement this feature?

If we agree on an approach, we could help out.

Additional context

N/A

@adriangonz adriangonz added the enhancement New feature or request label Feb 12, 2025
@dosubot dosubot bot added the plugins label Feb 12, 2025
@joaquimrocha
Copy link
Collaborator

Thanks @adriangonz . Your suggestion makes sense.
I think we should use a flag in the backend for this. Maybe --watch-plugins-folder?

@skoeva
Copy link
Contributor

skoeva commented Feb 13, 2025

I can look into this since I worked on the plugins CLI flags a little while ago

@skoeva skoeva self-assigned this Feb 13, 2025
skoeva added a commit that referenced this issue Feb 21, 2025
This change creates a CLI flag in the backend + desktop to disable the
plugins watch.

Fixes: #2894

Signed-off-by: Evangelos Skopelitis <eskopelitis@microsoft.com>
@skoeva skoeva linked a pull request Feb 21, 2025 that will close this issue
4 tasks
@skoeva skoeva linked a pull request Feb 21, 2025 that will close this issue
4 tasks
skoeva added a commit that referenced this issue Feb 21, 2025
This change creates a CLI flag in the backend + desktop to disable the
plugins watch.

Fixes: #2894

Signed-off-by: Evangelos Skopelitis <eskopelitis@microsoft.com>
skoeva added a commit that referenced this issue Feb 25, 2025
This change creates a CLI flag in the backend + desktop for watching
changes to the plugins or their directory.

Fixes: #2894

Signed-off-by: Evangelos Skopelitis <eskopelitis@microsoft.com>
illume pushed a commit that referenced this issue Feb 26, 2025
This change creates a CLI flag in the backend + desktop for watching
changes to the plugins or their directory.

Stops watching for plugin changes in the container image.

Fixes: #2894

Signed-off-by: Evangelos Skopelitis <eskopelitis@microsoft.com>
Signed-off-by: René Dudfield <renedudfield@microsoft.com>
illume pushed a commit that referenced this issue Feb 26, 2025
This change creates a CLI flag in the backend + desktop for watching
changes to the plugins or their directory.

Stops watching for plugin changes in the container image.

Fixes: #2894

Signed-off-by: Evangelos Skopelitis <eskopelitis@microsoft.com>
Signed-off-by: René Dudfield <renedudfield@microsoft.com>
skoeva added a commit that referenced this issue Feb 26, 2025
This change creates a CLI flag in the backend + desktop for watching
changes to the plugins or their directory.

Stops watching for plugin changes in the container image.

Fixes: #2894

Signed-off-by: Evangelos Skopelitis <eskopelitis@microsoft.com>
Signed-off-by: René Dudfield <renedudfield@microsoft.com>
skoeva added a commit that referenced this issue Mar 3, 2025
This change creates a CLI flag in the backend + desktop for watching
changes to the plugins or their directory.

Stops watching for plugin changes in the container image.

Fixes: #2894

Signed-off-by: Evangelos Skopelitis <eskopelitis@microsoft.com>
Signed-off-by: René Dudfield <renedudfield@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request plugins
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants