Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion main.star
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ def run(plan,
min_cpu=10,
max_cpu=1000,
min_memory=128,
max_memory=2048):
max_memory=2048,
node_selectors=None,
):
""" Starts a Prometheus server that scrapes metrics off the provided prometheus metrics configurations.

Args:
Expand Down Expand Up @@ -44,6 +46,7 @@ def run(plan,
max_cpu(int): max cpu for prometheus instance
min_memory(int): min memory for prometheus instance
max_memory(int): max memory for prometheus instance
node_selectors (dict): Define a dict of node selectors - only works in kubernetes example: {"kubernetes.io/hostname": node-name-01}
Returns:
prometheus_url: endpoint to prometheus service inside the enclave (eg. 123.123.212:9090)
"""
Expand All @@ -65,6 +68,9 @@ def run(plan,

config_file_path= CONFIG_DIR + "/" + CONFIG_FILENAME

if node_selectors == None:
node_selectors = {}

prometheus_service = plan.add_service(name="prometheus", config=ServiceConfig(
image="prom/prometheus:latest",
ports={
Expand All @@ -91,6 +97,7 @@ def run(plan,
max_cpu=max_cpu,
min_memory=min_memory,
max_memory=max_memory,
node_selectors=node_selectors,
))

prometheus_service_ip_address = prometheus_service.ip_address
Expand Down