feat: configurable Prometheus discovery via plugin settings - #97
Open
repo-trashmaster wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
Previously, Prometheus service discovery was hardcoded to the monitoring namespace with three fixed service name candidates. Deployments using a different namespace or service name (e.g. observability / monitoring-kube-prometheus-prometheus:9090) could not use the Metrics page without a fragile selector-less Service shim. This change introduces configurable Prometheus namespace, service name, and port via Headlamp idiomatic plugin settings contract: - New src/api/pluginConfig.ts: ConfigStore-based configuration with PrometheusConfig interface, default service candidates, and getPrometheusServiceCandidates() helper that prepends user-configured service and falls back to built-in defaults - Modified src/api/metrics.ts: findPrometheusPath() now uses getPrometheusServiceCandidates() instead of hardcoded array - New src/components/SettingsPage.tsx: Plugin settings UI registered via registerPluginSettings() with three input fields - Modified src/index.tsx: registers SettingsPage via registerPluginSettings(intel-gpu, SettingsPage, true) - Modified src/components/MetricsPage.tsx: error message now shows dynamically checked services instead of hardcoded list - New tests: metrics.test.ts (16 tests), SettingsPage.test.tsx (11 tests) - Updated README.md, SECURITY.md, CLAUDE.md with configuration docs Backward compatibility: when all three fields are left blank (the default), the plugin uses the exact same candidate list as v1.1.0. Lab verification: read-only kubectl proxy query to the lab service at observability/monitoring-kube-prometheus-prometheus:9090 returns status=success. All three default candidates return 404. Tests: 136/136 pass (27 new). tsc, lint, build, package all clean. Refs: LAB-226
repo-trashmaster
force-pushed
the
fix/lab-226-configurable-prometheus-discovery
branch
from
August 17, 2026 16:51
a89061a to
0b2b618
Compare
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces hardcoded Prometheus service discovery with configurable plugin
settings. Users can now specify the Prometheus namespace, service, and port
through Headlamp's settings UI, with backward-compatible fallback to the
original default candidates.
Changes
ConfigStore<PrometheusConfig>— uses Headlamp's realConfigStore<T>API to persist user-configured namespace, service, and port
registerPluginSettings— registers the settings schema so theUI renders a settings panel for the plugin
tried first; if it fails, falls back to the original defaults:
monitoring/kube-prometheus-stack-prometheus:9090monitoring/prometheus-operated:9090monitoring/prometheus:9090Prometheus connection
Backward compatibility
If no settings are configured, discovery behavior is identical to before —
the same three fallback candidates are tried in the same order. Existing
installations require no configuration changes.
Test plan