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

feat: add cadvisor #775

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
1 change: 1 addition & 0 deletions .github/tests/mix-with-tools-mev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ additional_services:
- blutgang
- apache
- tracoor
- cadvisor
ethereum_metrics_exporter_enabled: true
snooper_enabled: true
mev_type: flashbots
Expand Down
1 change: 1 addition & 0 deletions .github/tests/mix-with-tools-minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ additional_services:
- blutgang
- apache
- tracoor
- cadvisor
ethereum_metrics_exporter_enabled: true
snooper_enabled: true
keymanager_enabled: true
1 change: 1 addition & 0 deletions .github/tests/mix-with-tools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ additional_services:
- blutgang
- apache
- tracoor
- cadvisor
ethereum_metrics_exporter_enabled: true
snooper_enabled: true
keymanager_enabled: true
10 changes: 10 additions & 0 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ full_beaconchain_explorer = import_module(
blockscout = import_module("./src/blockscout/blockscout_launcher.star")
prometheus = import_module("./src/prometheus/prometheus_launcher.star")
grafana = import_module("./src/grafana/grafana_launcher.star")
cadvisor = import_module("./src/cadvisor/cadvisor_launcher.star")
mev_rs_mev_boost = import_module("./src/mev/mev-rs/mev_boost/mev_boost_launcher.star")
mev_rs_mev_relay = import_module("./src/mev/mev-rs/mev_relay/mev_relay_launcher.star")
mev_rs_mev_builder = import_module(
Expand Down Expand Up @@ -625,6 +626,15 @@ def run(plan, args={}):
args_with_right_defaults.custom_flood_params,
global_node_selectors,
)
elif additional_service == "cadvisor":
plan.print("Launching cadvisor")
cadvisor.launch_cadvisor(
plan,
args_with_right_defaults.port_publisher,
index,
global_node_selectors,
)
plan.print("Successfully launched cadvisor")
else:
fail("Invalid additional service %s" % (additional_service))
if launch_prometheus_grafana:
Expand Down
39 changes: 39 additions & 0 deletions src/cadvisor/cadvisor_launcher.star
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
shared_utils = import_module("../shared_utils/shared_utils.star")
constants = import_module("../package_io/constants.star")
SERVICE_NAME = "cadvisor"

HTTP_PORT_NUMBER = 8080
USED_PORTS = {
constants.HTTP_PORT_ID: shared_utils.new_port_spec(
HTTP_PORT_NUMBER,
shared_utils.TCP_PROTOCOL,
shared_utils.HTTP_APPLICATION_PROTOCOL,
)
}

IMAGE_NAME = "gcr.io/cadvisor/cadvisor:v0.38.7"


def launch_cadvisor(
plan,
port_publisher,
additional_service_index,
global_node_selectors,
):
public_ports = shared_utils.get_additional_service_standard_public_port(
port_publisher,
constants.HTTP_PORT_ID,
additional_service_index,
0,
)
files = {"/var/run/docker.sock": "/var/run/docker.sock"}

config = ServiceConfig(
image=IMAGE_NAME,
ports=USED_PORTS,
public_ports=public_ports,
node_selectors=global_node_selectors,
files=files,
)

plan.add_service(SERVICE_NAME, config)
1 change: 1 addition & 0 deletions src/package_io/sanity_check.star
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ ADDITIONAL_SERVICES_PARAMS = [
"forky",
"apache",
"tracoor",
"cadvisor",
]

ADDITIONAL_CATEGORY_PARAMS = {
Expand Down
Loading