-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix cli to configure ronusta ui
- Loading branch information
Showing
6 changed files
with
36 additions
and
23 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,22 @@ | ||
import logging | ||
|
||
from ...utils.service_discovery import find_service_url | ||
|
||
|
||
def find_prometheus_url(): | ||
""" | ||
Try to autodiscover the url of an in-cluster grafana service | ||
""" | ||
return find_service_url("app=kube-prometheus-stack-prometheus") | ||
class PrometheusDiscovery: | ||
prometheus_url = None | ||
@staticmethod | ||
def find_prometheus_url(): | ||
""" | ||
Try to autodiscover the url of an in-cluster grafana service | ||
""" | ||
if PrometheusDiscovery.prometheus_url: | ||
return PrometheusDiscovery.prometheus_url | ||
prometheus_selectors = ["app=kube-prometheus-stack-prometheus", "app.kubernetes.io/name=prometheus"] | ||
for label_selector in prometheus_selectors: | ||
service_url = find_service_url(label_selector) | ||
if service_url: | ||
PrometheusDiscovery.prometheus_url = service_url | ||
return service_url | ||
logging.error("Prometheus url could not be found. Add 'prometheus_url' under global_config") | ||
return None |
This file contains 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
This file contains 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