Skip to content

Commit

Permalink
feat: add custom label configuration option (#375)
Browse files Browse the repository at this point in the history
  • Loading branch information
barnabasbusa committed Nov 29, 2023
1 parent 32f862b commit 82ec85e
Show file tree
Hide file tree
Showing 16 changed files with 100 additions and 10 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ participants:
# A list of optional extra env_vars the el container should spin up with
el_extra_env_vars: {}

# A list of optional extra labels the el container should spin up with
# Example; el_extra_labels: {"ethereum-package.partition": "1"}
el_extra_labels: {}

# The type of CL client that should be started
# Valid values are nimbus, lighthouse, lodestar, teku, and prysm
cl_client_type: lighthouse
Expand All @@ -147,10 +151,18 @@ participants:
# 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: []

# A list of optional extra labels that will be passed to the CL client Beacon container.
# Example; beacon_extra_labels: {"ethereum-package.partition": "1"}
beacon_extra_labels: {}

# A list of optional extra params that will be passed to the CL client validator container for modifying its behaviour
# If the client combines the Beacon & validator nodes (e.g. Teku, Nimbus), then this list will also be passed to the combined Beacon-validator node
validator_extra_params: []

# A list of optional extra labels that will be passed to the CL client validator container.
# Example; validator_extra_labels: {"ethereum-package.partition": "1"}
validator_extra_labels: {}

# A set of parameters the node needs to reach an external block building network
# If `null` then the builder infrastructure will not be instantiated
# Example:
Expand Down
3 changes: 3 additions & 0 deletions network_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ participants:
el_client_image: ethereum/client-go:latest
el_client_log_level: ""
el_extra_params: []
el_extra_labels: {}
cl_client_type: lighthouse
cl_client_image: sigp/lighthouse:latest
cl_client_log_level: ""
beacon_extra_params: []
beacon_extra_labels: {}
validator_extra_params: []
validator_extra_labels: {}
builder_network_params: null
validator_count: null
snooper_enabled: false
Expand Down
8 changes: 8 additions & 0 deletions src/cl/lighthouse/lighthouse_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ def launch(
snooper_engine_context,
extra_beacon_params,
extra_validator_params,
extra_beacon_labels,
extra_validator_labels,
):
beacon_node_service_name = "{0}".format(service_name)
validator_node_service_name = "{0}-{1}".format(
Expand Down Expand Up @@ -144,6 +146,7 @@ def launch(
snooper_enabled,
snooper_engine_context,
extra_beacon_params,
extra_beacon_labels,
)

beacon_service = plan.add_service(beacon_node_service_name, beacon_config)
Expand Down Expand Up @@ -172,6 +175,7 @@ def launch(
v_min_mem,
v_max_mem,
extra_validator_params,
extra_validator_labels,
)

validator_service = plan.add_service(
Expand Down Expand Up @@ -242,6 +246,7 @@ def get_beacon_config(
snooper_enabled,
snooper_engine_context,
extra_params,
extra_labels,
):
# If snooper is enabled use the snooper engine context, otherwise use the execution client context
if snooper_enabled:
Expand Down Expand Up @@ -347,6 +352,7 @@ def get_beacon_config(
constants.CLIENT_TYPES.cl,
image,
el_client_context.client_name,
extra_labels,
),
)

Expand All @@ -363,6 +369,7 @@ def get_validator_config(
v_min_mem,
v_max_mem,
extra_params,
extra_labels,
):
validator_keys_dirpath = shared_utils.path_join(
VALIDATOR_KEYS_MOUNTPOINT_ON_CLIENTS,
Expand Down Expand Up @@ -420,6 +427,7 @@ def get_validator_config(
constants.CLIENT_TYPES.validator,
image,
el_client_context.client_name,
extra_labels,
),
)

Expand Down
8 changes: 8 additions & 0 deletions src/cl/lodestar/lodestar_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ def launch(
snooper_engine_context,
extra_beacon_params,
extra_validator_params,
extra_beacon_labels,
extra_validator_labels,
):
beacon_node_service_name = "{0}".format(service_name)
validator_node_service_name = "{0}-{1}".format(
Expand Down Expand Up @@ -119,6 +121,7 @@ def launch(
snooper_enabled,
snooper_engine_context,
extra_beacon_params,
extra_beacon_labels,
)

beacon_service = plan.add_service(beacon_node_service_name, beacon_config)
Expand Down Expand Up @@ -148,6 +151,7 @@ def launch(
v_min_mem,
v_max_mem,
extra_validator_params,
extra_validator_labels,
)

plan.add_service(validator_node_service_name, validator_config)
Expand Down Expand Up @@ -208,6 +212,7 @@ def get_beacon_config(
snooper_enabled,
snooper_engine_context,
extra_params,
extra_labels,
):
el_client_rpc_url_str = "http://{0}:{1}".format(
el_client_context.ip_addr,
Expand Down Expand Up @@ -292,6 +297,7 @@ def get_beacon_config(
constants.CLIENT_TYPES.cl,
image,
el_client_context.client_name,
extra_labels,
),
)

Expand All @@ -309,6 +315,7 @@ def get_validator_config(
v_min_mem,
v_max_mem,
extra_params,
extra_labels,
):
root_dirpath = shared_utils.path_join(
CONSENSUS_DATA_DIRPATH_ON_SERVICE_CONTAINER, service_name
Expand Down Expand Up @@ -364,6 +371,7 @@ def get_validator_config(
constants.CLIENT_TYPES.validator,
image,
el_client_context.client_name,
extra_labels,
),
)

Expand Down
7 changes: 7 additions & 0 deletions src/cl/nimbus/nimbus_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ def launch(
snooper_engine_context,
extra_beacon_params,
extra_validator_params,
extra_beacon_labels,
extra_validator_labels,
):
log_level = input_parser.get_client_log_level_or_default(
participant_log_level, global_log_level, NIMBUS_LOG_LEVELS
Expand All @@ -113,6 +115,8 @@ def launch(
bn_min_mem = int(v_min_mem) if (int(v_min_mem) > bn_min_mem) else bn_min_mem
bn_max_mem = int(v_max_mem) if (int(v_max_mem) > bn_max_mem) else bn_max_mem

extra_labels = extra_beacon_labels | extra_validator_labels

config = get_config(
launcher.el_cl_genesis_data,
image,
Expand All @@ -127,6 +131,7 @@ def launch(
snooper_enabled,
snooper_engine_context,
extra_params,
extra_labels,
)

nimbus_service = plan.add_service(service_name, config)
Expand Down Expand Up @@ -181,6 +186,7 @@ def get_config(
snooper_enabled,
snooper_engine_context,
extra_params,
extra_labels,
):
# If snooper is enabled use the snooper engine context, otherwise use the execution client context
if snooper_enabled:
Expand Down Expand Up @@ -320,6 +326,7 @@ def get_config(
constants.CLIENT_TYPES.cl,
image,
el_client_context.client_name,
extra_labels,
),
)

Expand Down
8 changes: 8 additions & 0 deletions src/cl/prysm/prysm_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ def launch(
snooper_engine_context,
extra_beacon_params,
extra_validator_params,
extra_beacon_labels,
extra_validator_labels,
):
split_images = images.split(IMAGE_SEPARATOR_DELIMITER)
if len(split_images) != EXPECTED_NUM_IMAGES:
Expand Down Expand Up @@ -146,6 +148,7 @@ def launch(
snooper_enabled,
snooper_engine_context,
extra_beacon_params,
extra_beacon_labels,
)

beacon_service = plan.add_service(beacon_node_service_name, beacon_config)
Expand Down Expand Up @@ -176,6 +179,7 @@ def launch(
v_min_mem,
v_max_mem,
extra_validator_params,
extra_validator_labels,
launcher.prysm_password_relative_filepath,
launcher.prysm_password_artifact_uuid,
)
Expand Down Expand Up @@ -248,6 +252,7 @@ def get_beacon_config(
snooper_enabled,
snooper_engine_context,
extra_params,
extra_labels,
):
# If snooper is enabled use the snooper engine context, otherwise use the execution client context
if snooper_enabled:
Expand Down Expand Up @@ -321,6 +326,7 @@ def get_beacon_config(
constants.CLIENT_TYPES.cl,
beacon_image,
el_client_context.client_name,
extra_labels,
),
)

Expand All @@ -339,6 +345,7 @@ def get_validator_config(
v_min_mem,
v_max_mem,
extra_params,
extra_labels,
prysm_password_relative_filepath,
prysm_password_artifact_uuid,
):
Expand Down Expand Up @@ -395,6 +402,7 @@ def get_validator_config(
constants.CLIENT_TYPES.validator,
validator_image,
el_client_context.client_name,
extra_labels,
),
)

Expand Down
7 changes: 7 additions & 0 deletions src/cl/teku/teku_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ def launch(
snooper_engine_context,
extra_beacon_params,
extra_validator_params,
extra_beacon_labels,
extra_validator_labels,
):
log_level = input_parser.get_client_log_level_or_default(
participant_log_level, global_log_level, TEKU_LOG_LEVELS
Expand All @@ -115,6 +117,8 @@ def launch(
bn_min_mem = int(v_min_mem) if (int(v_min_mem) > bn_min_mem) else bn_min_mem
bn_max_mem = int(v_max_mem) if (int(v_max_mem) > bn_max_mem) else bn_max_mem

extra_labels = extra_beacon_labels | extra_validator_labels

config = get_config(
launcher.el_cl_genesis_data,
image,
Expand All @@ -129,6 +133,7 @@ def launch(
snooper_enabled,
snooper_engine_context,
extra_params,
extra_labels,
)

teku_service = plan.add_service(service_name, config)
Expand Down Expand Up @@ -185,6 +190,7 @@ def get_config(
snooper_enabled,
snooper_engine_context,
extra_params,
extra_labels,
):
# If snooper is enabled use the snooper engine context, otherwise use the execution client context
if snooper_enabled:
Expand Down Expand Up @@ -325,6 +331,7 @@ def get_config(
constants.CLIENT_TYPES.cl,
image,
el_client_context.client_name,
extra_labels,
),
)

Expand Down
4 changes: 4 additions & 0 deletions src/el/besu/besu_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def launch(
el_max_mem,
extra_params,
extra_env_vars,
extra_labels,
):
log_level = input_parser.get_client_log_level_or_default(
participant_log_level, global_log_level, BESU_LOG_LEVELS
Expand All @@ -99,6 +100,7 @@ def launch(
el_max_mem,
extra_params,
extra_env_vars,
extra_labels,
)

service = plan.add_service(service_name, config)
Expand Down Expand Up @@ -136,6 +138,7 @@ def get_config(
el_max_mem,
extra_params,
extra_env_vars,
extra_labels,
):
cmd = [
"besu",
Expand Down Expand Up @@ -207,6 +210,7 @@ def get_config(
constants.CLIENT_TYPES.el,
image,
cl_client_name,
extra_labels,
),
)

Expand Down
4 changes: 4 additions & 0 deletions src/el/erigon/erigon_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def launch(
el_max_mem,
extra_params,
extra_env_vars,
extra_labels,
):
log_level = input_parser.get_client_log_level_or_default(
participant_log_level, global_log_level, ERIGON_LOG_LEVELS
Expand All @@ -100,6 +101,7 @@ def launch(
el_max_mem,
extra_params,
extra_env_vars,
extra_labels,
)

service = plan.add_service(service_name, config)
Expand Down Expand Up @@ -139,6 +141,7 @@ def get_config(
el_max_mem,
extra_params,
extra_env_vars,
extra_labels,
):
network_id = network_id

Expand Down Expand Up @@ -218,6 +221,7 @@ def get_config(
constants.CLIENT_TYPES.el,
image,
cl_client_name,
extra_labels,
),
)

Expand Down
4 changes: 4 additions & 0 deletions src/el/ethereumjs/ethereumjs_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def launch(
el_max_mem,
extra_params,
extra_env_vars,
extra_labels,
):
log_level = input_parser.get_client_log_level_or_default(
participant_log_level, global_log_level, VERBOSITY_LEVELS
Expand All @@ -103,6 +104,7 @@ def launch(
el_max_mem,
extra_params,
extra_env_vars,
extra_labels,
)

service = plan.add_service(service_name, config)
Expand Down Expand Up @@ -138,6 +140,7 @@ def get_config(
el_max_mem,
extra_params,
extra_env_vars,
extra_labels,
):
cmd = [
"--gethGenesis="
Expand Down Expand Up @@ -198,6 +201,7 @@ def get_config(
constants.CLIENT_TYPES.el,
image,
cl_client_name,
extra_labels,
),
)

Expand Down
Loading

0 comments on commit 82ec85e

Please sign in to comment.