headlamp-k8s / plugins

Official plugins of the Headlamp project
https://headlamp.dev/
Apache License 2.0
14 stars 3 forks source link

prometheus: make backend configurable for now admin users #24

Open farodin91 opened 11 months ago

farodin91 commented 11 months ago

First step, make Prometheus service address configurable.

In my case, i would like to provide the endpoint by an different plugin which serves dynamic clusters.


I used Lens before, here i was able to provide such settings by an different lens extension. image

yolossn commented 11 months ago

Hey @farodin91 Can you explain a bit more on this? Do you want a way to specify the proxy URL for accessing prometheus?

farodin91 commented 11 months ago

@yolossn I updated the issue.

remram44 commented 8 months ago

I am running into this too. My cluster already has a Prometheus server installed, I don't want to deploy another one.

In addition, the message is not very clear: "Install Prometheus for accessing metrics charts" Does this mean installing a Prometheus server or the Prometheus plugin for Headlamp?

remram44 commented 8 months ago

In addition, note that Prometheus might be using HTTPS.

yolossn commented 8 months ago

Hey @remram44 We are working on plugin settings feature which will allow plugins to make certain values configurable by the end user. The PR is under review now, once that is done, we will update the prometheus plugin to allow the user configure the endpoint to access prometheus.

remram44 commented 8 months ago

I am running headlamp as a web app for my cluster's users, in my case they don't need to configure this value, I would do it when installing. For example an environment variable would be perfect.

air3ijai commented 7 months ago

We are running VictoriaMetrics as an drop-in replacement for Prometheus.

It would be very helpful if we would be able to set a custom endpoint in Prometheus plugin.

example Screenshot 2024-03-27 at 16 42 34
yolossn commented 4 months ago

This can be solved in two different ways, the user can either provide the label to identify the prometheus pod and the plugin figures out how to reach the pod etc or the user can provide the namespace and pod/service url to reach the prometheus pod.

If we choose to solve it by getting the namespace and pod/service url from the user, the following steps can be used to fix this.

  1. Create a Settings component and register it using the registerPluginSettings function. The Settings component should take care of getting the namespace and service to access prometheus as inputs and store it in plugin conf.

  2. In the components that use fetchMetrics get the config using the ConfigStore and generate the prefix and pass it to the fetchMetrics function.

References:

  1. Introduction to Plugin Settings
  2. OpenCost plugin for headlamp has a similar configuration mechanism.

cc: @joaquimrocha

joaquimrocha commented 4 months ago

@skoeva Can you look into this one?

air3ijai commented 4 months ago

This can be solved in two different ways

Maybe we can leave a space for multiple solutions, if they will be implemented later

Screenshot 2024-07-16 at 13 08 34
Smana commented 2 months ago

Hey, I'm currently using VictoriaMetrics which is 100% prometheus compatible here. What I need is just to be able to point to a given address. That'd be great! thank you :)

mgalesloot commented 2 months ago

The solution with client side plugin settings would be great, but I think for this setting a server side configuration would be nicer. It would allow the platform team to configure plugin settings, and end users would not be bothered in configuring the plugin and maintaining browser cookies. I believe this is a missing feature in the plugin system.

Suggestion:

An even simpler solution would be to create a configmap and let the plugin fetch this configmap via the Headlamp proxy.