Skip to content

Commit

Permalink
feat!: add node selectors features (#491)
Browse files Browse the repository at this point in the history
Co-authored-by: pk910 <github@pk910.de>
Co-authored-by: parithosh <parithosh.jayanthi@ethereum.org>
Co-authored-by: Gyanendra Mishra <anomaly.the@gmail.com>
  • Loading branch information
4 people committed Feb 18, 2024
1 parent 7854d77 commit 3ec7423
Show file tree
Hide file tree
Showing 39 changed files with 387 additions and 91 deletions.
13 changes: 13 additions & 0 deletions .github/tests/node-selectors.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
participants:
- el_client_type: reth
cl_client_type: teku
cl_split_mode_enabled: true
node_selectors: {
"kubernetes.io/hostname": testing-1,
}
- el_client_type: reth
cl_client_type: teku
cl_split_mode_enabled: true
global_node_selectors: {
"kubernetes.io/hostname": testing-2,
}
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,12 @@ participants:
# Defaults to empty
tolerations: []
# Node selector
# Only works with Kubernetes
# Example: node_selectors: { "disktype": "ssd" }
# Defaults to empty
node_selectors: {}
# A list of optional extra params that will be passed to the CL client Beacon container for modifying its behaviour
# If the client combines the Beacon & validator nodes (e.g. Teku, Nimbus), then this list will be passed to the combined Beacon-validator node
beacon_extra_params: []
Expand Down Expand Up @@ -607,6 +613,12 @@ xatu_sentry_params:
# toleration_seconds: 3600
# Defaults to empty
global_tolerations: []
# Global node selector that will be passed to all containers (unless overridden by a more specific node selector)
# Only works with Kubernetes
# Example: node_selectors: { "disktype": "ssd" }
# Defaults to empty
node_selectors: {}
```

#### Example configurations
Expand Down
34 changes: 30 additions & 4 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def run(plan, args={}):
persistent = args_with_right_defaults.persistent
xatu_sentry_params = args_with_right_defaults.xatu_sentry_params
global_tolerations = args_with_right_defaults.global_tolerations
global_node_selectors = args_with_right_defaults.global_node_selectors

grafana_datasource_config_template = read_file(
static_files.GRAFANA_DATASOURCE_CONFIG_TEMPLATE_FILEPATH
Expand Down Expand Up @@ -94,6 +95,7 @@ def run(plan, args={}):
persistent,
xatu_sentry_params,
global_tolerations,
global_node_selectors,
parallel_keystore_generation,
)

Expand Down Expand Up @@ -136,7 +138,9 @@ def run(plan, args={}):
if "broadcaster" in args_with_right_defaults.additional_services:
args_with_right_defaults.additional_services.remove("broadcaster")
broadcaster_service = broadcaster.launch_broadcaster(
plan, all_el_client_contexts
plan,
all_el_client_contexts,
global_node_selectors,
)
fuzz_target = "http://{0}:{1}".format(
broadcaster_service.ip_address,
Expand Down Expand Up @@ -169,6 +173,7 @@ def run(plan, args={}):
beacon_uri,
raw_jwt_secret,
args_with_right_defaults.global_client_log_level,
global_node_selectors,
)
mev_endpoints.append(endpoint)
elif (
Expand All @@ -194,6 +199,7 @@ def run(plan, args={}):
fuzz_target,
contract_owner.private_key,
normal_user.private_key,
global_node_selectors,
)
epoch_recipe = GetHttpRequestRecipe(
endpoint="/eth/v2/beacon/blocks/head",
Expand All @@ -217,6 +223,7 @@ def run(plan, args={}):
builder_uri,
network_params.seconds_per_slot,
persistent,
global_node_selectors,
)
mev_flood.spam_in_background(
plan,
Expand All @@ -237,7 +244,8 @@ def run(plan, args={}):
)
if args_with_right_defaults.participants[index].validator_count != 0:
mev_boost_launcher = mev_boost.new_mev_boost_launcher(
MEV_BOOST_SHOULD_CHECK_RELAY, mev_endpoints
MEV_BOOST_SHOULD_CHECK_RELAY,
mev_endpoints,
)
mev_boost_service_name = "{0}-{1}-{2}-{3}".format(
input_parser.MEV_BOOST_SERVICE_NAME_PREFIX,
Expand All @@ -252,6 +260,7 @@ def run(plan, args={}):
network_params.network_id,
mev_params.mev_boost_image,
mev_params.mev_boost_args,
global_node_selectors,
)
all_mevboost_contexts.append(mev_boost_context)

Expand All @@ -275,6 +284,7 @@ def run(plan, args={}):
fuzz_target,
tx_spammer_params,
network_params.electra_fork_epoch,
global_node_selectors,
)
plan.print("Successfully launched transaction spammer")
elif additional_service == "blob_spammer":
Expand All @@ -287,6 +297,7 @@ def run(plan, args={}):
network_params.deneb_fork_epoch,
network_params.seconds_per_slot,
network_params.genesis_delay,
global_node_selectors,
)
plan.print("Successfully launched blob spammer")
elif additional_service == "goomy_blob":
Expand All @@ -299,6 +310,7 @@ def run(plan, args={}):
all_cl_client_contexts[0],
network_params.seconds_per_slot,
goomy_blob_params,
global_node_selectors,
)
plan.print("Successfully launched goomy the blob spammer")
# We need a way to do time.sleep
Expand All @@ -309,7 +321,10 @@ def run(plan, args={}):
static_files.EL_FORKMON_CONFIG_TEMPLATE_FILEPATH
)
el_forkmon.launch_el_forkmon(
plan, el_forkmon_config_template, all_el_client_contexts
plan,
el_forkmon_config_template,
all_el_client_contexts,
global_node_selectors,
)
plan.print("Successfully launched execution layer forkmon")
elif additional_service == "beacon_metrics_gazer":
Expand All @@ -319,6 +334,7 @@ def run(plan, args={}):
plan,
all_cl_client_contexts,
network_params,
global_node_selectors,
)
)
launch_prometheus_grafana = True
Expand All @@ -329,7 +345,10 @@ def run(plan, args={}):
elif additional_service == "blockscout":
plan.print("Launching blockscout")
blockscout_sc_verif_url = blockscout.launch_blockscout(
plan, all_el_client_contexts, persistent
plan,
all_el_client_contexts,
persistent,
global_node_selectors,
)
plan.print("Successfully launched blockscout")
elif additional_service == "dora":
Expand All @@ -342,6 +361,7 @@ def run(plan, args={}):
el_cl_data_files_artifact_uuid,
network_params.electra_fork_epoch,
network_params.network,
global_node_selectors,
)
plan.print("Successfully launched dora")
elif additional_service == "blobscan":
Expand All @@ -352,6 +372,7 @@ def run(plan, args={}):
all_el_client_contexts,
network_params.network_id,
persistent,
global_node_selectors,
)
plan.print("Successfully launched blobscan")
elif additional_service == "full_beaconchain_explorer":
Expand All @@ -365,6 +386,7 @@ def run(plan, args={}):
all_cl_client_contexts,
all_el_client_contexts,
persistent,
global_node_selectors,
)
plan.print("Successfully launched full-beaconchain-explorer")
elif additional_service == "prometheus_grafana":
Expand All @@ -383,6 +405,7 @@ def run(plan, args={}):
args_with_right_defaults.participants,
network_params,
assertoor_params,
global_node_selectors,
)
plan.print("Successfully launched assertoor")
elif additional_service == "custom_flood":
Expand All @@ -392,6 +415,7 @@ def run(plan, args={}):
genesis_constants.PRE_FUNDED_ACCOUNTS[0].address,
fuzz_target,
args_with_right_defaults.custom_flood_params,
global_node_selectors,
)
else:
fail("Invalid additional service %s" % (additional_service))
Expand All @@ -404,6 +428,7 @@ def run(plan, args={}):
prometheus_additional_metrics_jobs,
all_ethereum_metrics_exporter_contexts,
all_xatu_sentry_contexts,
global_node_selectors,
)

plan.print("Launching grafana...")
Expand All @@ -412,6 +437,7 @@ def run(plan, args={}):
grafana_datasource_config_template,
grafana_dashboards_config_template,
prometheus_private_url,
global_node_selectors,
additional_dashboards=args_with_right_defaults.grafana_additional_dashboards,
)
plan.print("Successfully launched grafana")
Expand Down
2 changes: 2 additions & 0 deletions network_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ participants:
cl_tolerations: []
validator_tolerations: []
tolerations: []
node_selectors: {}
beacon_extra_params: []
beacon_extra_labels: {}
validator_extra_params: []
Expand Down Expand Up @@ -89,3 +90,4 @@ grafana_additional_dashboards: []
persistent: false
xatu_sentry_enabled: false
global_tolerations: []
global_node_selectors: {}
4 changes: 4 additions & 0 deletions src/assertoor/assertoor_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def launch_assertoor(
participant_configs,
network_params,
assertoor_params,
global_node_selectors,
):
all_client_info = []
validator_client_info = []
Expand Down Expand Up @@ -91,6 +92,7 @@ def launch_assertoor(
tests_config_artifacts_name,
network_params,
assertoor_params,
global_node_selectors,
)

plan.add_service(SERVICE_NAME, config)
Expand All @@ -101,6 +103,7 @@ def get_config(
tests_config_artifacts_name,
network_params,
assertoor_params,
node_selectors,
):
config_file_path = shared_utils.path_join(
ASSERTOOR_CONFIG_MOUNT_DIRPATH_ON_SERVICE,
Expand All @@ -127,6 +130,7 @@ def get_config(
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
node_selectors=node_selectors,
)


Expand Down
11 changes: 9 additions & 2 deletions src/beacon_metrics_gazer/beacon_metrics_gazer_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@ MIN_MEMORY = 20
MAX_MEMORY = 300


def launch_beacon_metrics_gazer(plan, cl_client_contexts, network_params):
def launch_beacon_metrics_gazer(
plan,
cl_client_contexts,
network_params,
global_node_selectors,
):
config = get_config(
cl_client_contexts[0].ip_addr,
cl_client_contexts[0].http_port_num,
global_node_selectors,
)

beacon_metrics_gazer_service = plan.add_service(SERVICE_NAME, config)
Expand All @@ -51,7 +57,7 @@ def launch_beacon_metrics_gazer(plan, cl_client_contexts, network_params):
)


def get_config(ip_addr, http_port_num):
def get_config(ip_addr, http_port_num, node_selectors):
config_file_path = shared_utils.path_join(
BEACON_METRICS_GAZER_CONFIG_MOUNT_DIRPATH_ON_SERVICE,
BEACON_METRICS_GAZER_CONFIG_FILENAME,
Expand All @@ -76,4 +82,5 @@ def get_config(ip_addr, http_port_num):
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
node_selectors=node_selectors,
)
4 changes: 4 additions & 0 deletions src/blob_spammer/blob_spammer.star
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def launch_blob_spammer(
deneb_fork_epoch,
seconds_per_slot,
genesis_delay,
global_node_selectors,
):
config = get_config(
prefunded_addresses,
Expand All @@ -26,6 +27,7 @@ def launch_blob_spammer(
deneb_fork_epoch,
seconds_per_slot,
genesis_delay,
global_node_selectors,
)
plan.add_service(SERVICE_NAME, config)

Expand All @@ -37,6 +39,7 @@ def get_config(
deneb_fork_epoch,
seconds_per_slot,
genesis_delay,
node_selectors,
):
dencunTime = (deneb_fork_epoch * 32 * seconds_per_slot) + genesis_delay
return ServiceConfig(
Expand Down Expand Up @@ -68,4 +71,5 @@ def get_config(
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
node_selectors=node_selectors,
)
24 changes: 21 additions & 3 deletions src/blobber/blobber_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,22 @@ MIN_MEMORY = 10
MAX_MEMORY = 300


def launch(plan, service_name, node_keystore_files, beacon_http_url, extra_params):
def launch(
plan,
service_name,
node_keystore_files,
beacon_http_url,
extra_params,
node_selectors,
):
blobber_service_name = "{0}".format(service_name)

blobber_config = get_config(
service_name, node_keystore_files, beacon_http_url, extra_params
service_name,
node_keystore_files,
beacon_http_url,
extra_params,
node_selectors,
)

blobber_service = plan.add_service(blobber_service_name, blobber_config)
Expand All @@ -49,7 +60,13 @@ def launch(plan, service_name, node_keystore_files, beacon_http_url, extra_param
)


def get_config(service_name, node_keystore_files, beacon_http_url, extra_params):
def get_config(
service_name,
node_keystore_files,
beacon_http_url,
extra_params,
node_selectors,
):
validator_root_dirpath = shared_utils.path_join(
VALIDATOR_KEYS_MOUNTPOINT_ON_CLIENTS,
node_keystore_files.raw_root_dirpath,
Expand Down Expand Up @@ -78,4 +95,5 @@ def get_config(service_name, node_keystore_files, beacon_http_url, extra_params)
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
node_selectors=node_selectors,
)
Loading

0 comments on commit 3ec7423

Please sign in to comment.