Skip to content

Commit

Permalink
feat: add custom labels (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
barnabasbusa authored Oct 26, 2023
1 parent 00902be commit 789ed8e
Show file tree
Hide file tree
Showing 13 changed files with 129 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/cl/lighthouse/lighthouse_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def launch(
image,
log_level,
beacon_http_url,
el_client_context,
node_keystore_files,
v_min_cpu,
v_max_cpu,
Expand Down Expand Up @@ -341,6 +342,12 @@ def get_beacon_config(
max_cpu=bn_max_cpu,
min_memory=bn_min_mem,
max_memory=bn_max_mem,
labels=shared_utils.label_maker(
constants.CL_CLIENT_TYPE.lighthouse,
constants.CLIENT_TYPES.cl,
image,
el_client_context.client_name,
),
)


Expand All @@ -349,6 +356,7 @@ def get_validator_config(
image,
log_level,
beacon_client_http_url,
el_client_context,
node_keystore_files,
v_min_cpu,
v_max_cpu,
Expand Down Expand Up @@ -407,6 +415,12 @@ def get_validator_config(
max_cpu=v_max_cpu,
min_memory=v_min_mem,
max_memory=v_max_mem,
labels=shared_utils.label_maker(
constants.CL_CLIENT_TYPE.lighthouse,
constants.CLIENT_TYPES.validator,
image,
el_client_context.client_name,
),
)


Expand Down
14 changes: 14 additions & 0 deletions src/cl/lodestar/lodestar_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ def launch(
image,
log_level,
beacon_http_url,
el_client_context,
node_keystore_files,
v_min_cpu,
v_max_cpu,
Expand Down Expand Up @@ -286,6 +287,12 @@ def get_beacon_config(
max_cpu=bn_max_cpu,
min_memory=bn_min_mem,
max_memory=bn_max_mem,
labels=shared_utils.label_maker(
constants.CL_CLIENT_TYPE.lodestar,
constants.CLIENT_TYPES.cl,
image,
el_client_context.client_name,
),
)


Expand All @@ -295,6 +302,7 @@ def get_validator_config(
image,
log_level,
beacon_client_http_url,
el_client_context,
node_keystore_files,
v_min_cpu,
v_max_cpu,
Expand Down Expand Up @@ -351,6 +359,12 @@ def get_validator_config(
max_cpu=v_max_cpu,
min_memory=v_min_mem,
max_memory=v_max_mem,
labels=shared_utils.label_maker(
constants.CL_CLIENT_TYPE.lodestar,
constants.CLIENT_TYPES.validator,
image,
el_client_context.client_name,
),
)


Expand Down
6 changes: 6 additions & 0 deletions src/cl/nimbus/nimbus_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,12 @@ def get_config(
max_cpu=bn_max_cpu,
min_memory=bn_min_mem,
max_memory=bn_max_mem,
labels=shared_utils.label_maker(
constants.CL_CLIENT_TYPE.nimbus,
constants.CLIENT_TYPES.cl,
image,
el_client_context.client_name,
),
)


Expand Down
14 changes: 14 additions & 0 deletions src/cl/prysm/prysm_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ def launch(
log_level,
beacon_rpc_endpoint,
beacon_http_endpoint,
el_client_context,
node_keystore_files,
v_min_cpu,
v_max_cpu,
Expand Down Expand Up @@ -315,6 +316,12 @@ def get_beacon_config(
max_cpu=bn_max_cpu,
min_memory=bn_min_mem,
max_memory=bn_max_mem,
labels=shared_utils.label_maker(
constants.CL_CLIENT_TYPE.prysm,
constants.CLIENT_TYPES.cl,
beacon_image,
el_client_context.client_name,
),
)


Expand All @@ -325,6 +332,7 @@ def get_validator_config(
log_level,
beacon_rpc_endpoint,
beacon_http_endpoint,
el_client_context,
node_keystore_files,
v_min_cpu,
v_max_cpu,
Expand Down Expand Up @@ -382,6 +390,12 @@ def get_validator_config(
max_cpu=v_max_cpu,
min_memory=v_min_mem,
max_memory=v_max_mem,
labels=shared_utils.label_maker(
constants.CL_CLIENT_TYPE.prysm,
constants.CLIENT_TYPES.validator,
validator_image,
el_client_context.client_name,
),
)


Expand Down
6 changes: 6 additions & 0 deletions src/cl/teku/teku_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,12 @@ def get_config(
max_cpu=bn_max_cpu,
min_memory=bn_min_mem,
max_memory=bn_max_mem,
labels=shared_utils.label_maker(
constants.CL_CLIENT_TYPE.teku,
constants.CLIENT_TYPES.cl,
image,
el_client_context.client_name,
),
)


Expand Down
10 changes: 10 additions & 0 deletions src/el/besu/besu_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,14 @@ def launch(
el_min_mem = int(el_min_mem) if int(el_min_mem) > 0 else EXECUTION_MIN_MEMORY
el_max_mem = int(el_max_mem) if int(el_max_mem) > 0 else EXECUTION_MAX_MEMORY

cl_client_name = service_name.split("-")[3]

config = get_config(
launcher.network_id,
launcher.el_cl_genesis_data,
image,
existing_el_clients,
cl_client_name,
log_level,
el_min_cpu,
el_max_cpu,
Expand Down Expand Up @@ -125,6 +128,7 @@ def get_config(
el_cl_genesis_data,
image,
existing_el_clients,
cl_client_name,
log_level,
el_min_cpu,
el_max_cpu,
Expand Down Expand Up @@ -197,6 +201,12 @@ def get_config(
min_memory=el_min_mem,
max_memory=el_max_mem,
env_vars=extra_env_vars,
labels=shared_utils.label_maker(
constants.EL_CLIENT_TYPE.besu,
constants.CLIENT_TYPES.el,
image,
cl_client_name,
),
)


Expand Down
10 changes: 10 additions & 0 deletions src/el/erigon/erigon_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,14 @@ def launch(
el_min_mem = el_min_mem if int(el_min_mem) > 0 else EXECUTION_MIN_MEMORY
el_max_mem = el_max_mem if int(el_max_mem) > 0 else EXECUTION_MAX_MEMORY

cl_client_name = service_name.split("-")[3]

config = get_config(
launcher.network_id,
launcher.el_cl_genesis_data,
image,
existing_el_clients,
cl_client_name,
log_level,
el_min_cpu,
el_max_cpu,
Expand Down Expand Up @@ -128,6 +131,7 @@ def get_config(
el_cl_genesis_data,
image,
existing_el_clients,
cl_client_name,
verbosity_level,
el_min_cpu,
el_max_cpu,
Expand Down Expand Up @@ -209,6 +213,12 @@ def get_config(
min_memory=el_min_mem,
max_memory=el_max_mem,
env_vars=extra_env_vars,
labels=shared_utils.label_maker(
constants.EL_CLIENT_TYPE.erigon,
constants.CLIENT_TYPES.el,
image,
cl_client_name,
),
)


Expand Down
10 changes: 10 additions & 0 deletions src/el/ethereumjs/ethereumjs_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,13 @@ def launch(
el_min_mem = el_min_mem if int(el_min_mem) > 0 else EXECUTION_MIN_MEMORY
el_max_mem = el_max_mem if int(el_max_mem) > 0 else EXECUTION_MAX_MEMORY

cl_client_name = service_name.split("-")[3]

config = get_config(
launcher.el_cl_genesis_data,
image,
existing_el_clients,
cl_client_name,
log_level,
el_min_cpu,
el_max_cpu,
Expand Down Expand Up @@ -127,6 +130,7 @@ def get_config(
el_cl_genesis_data,
image,
existing_el_clients,
cl_client_name,
verbosity_level,
el_min_cpu,
el_max_cpu,
Expand Down Expand Up @@ -189,6 +193,12 @@ def get_config(
min_memory=el_min_mem,
max_memory=el_max_mem,
env_vars=extra_env_vars,
labels=shared_utils.label_maker(
constants.EL_CLIENT_TYPE.ethereumjs,
constants.CLIENT_TYPES.el,
image,
cl_client_name,
),
)


Expand Down
10 changes: 10 additions & 0 deletions src/el/geth/geth_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,14 @@ def launch(
el_min_mem = el_min_mem if int(el_min_mem) > 0 else EXECUTION_MIN_MEMORY
el_max_mem = el_max_mem if int(el_max_mem) > 0 else EXECUTION_MAX_MEMORY

cl_client_name = service_name.split("-")[3]

config = get_config(
launcher.network_id,
launcher.el_cl_genesis_data,
image,
existing_el_clients,
cl_client_name,
log_level,
el_min_cpu,
el_max_cpu,
Expand Down Expand Up @@ -140,6 +143,7 @@ def get_config(
el_cl_genesis_data,
image,
existing_el_clients,
cl_client_name,
verbosity_level,
el_min_cpu,
el_max_cpu,
Expand Down Expand Up @@ -259,6 +263,12 @@ def get_config(
min_memory=el_min_mem,
max_memory=el_max_mem,
env_vars=extra_env_vars,
labels=shared_utils.label_maker(
constants.EL_CLIENT_TYPE.geth,
constants.CLIENT_TYPES.el,
image,
cl_client_name,
),
)


Expand Down
10 changes: 10 additions & 0 deletions src/el/nethermind/nethermind_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,13 @@ def launch(
el_min_mem = el_min_mem if int(el_min_mem) > 0 else EXECUTION_MIN_MEMORY
el_max_mem = el_max_mem if int(el_max_mem) > 0 else EXECUTION_MAX_MEMORY

cl_client_name = service_name.split("-")[3]

config = get_config(
launcher.el_cl_genesis_data,
image,
existing_el_clients,
cl_client_name,
log_level,
el_min_cpu,
el_max_cpu,
Expand Down Expand Up @@ -123,6 +126,7 @@ def get_config(
el_cl_genesis_data,
image,
existing_el_clients,
cl_client_name,
log_level,
el_min_cpu,
el_max_cpu,
Expand Down Expand Up @@ -184,6 +188,12 @@ def get_config(
min_memory=el_min_mem,
max_memory=el_max_mem,
env_vars=extra_env_vars,
labels=shared_utils.label_maker(
constants.EL_CLIENT_TYPE.nethermind,
constants.CLIENT_TYPES.el,
image,
cl_client_name,
),
)


Expand Down
10 changes: 10 additions & 0 deletions src/el/reth/reth_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,13 @@ def launch(
el_min_mem = el_min_mem if int(el_min_mem) > 0 else EXECUTION_MIN_MEMORY
el_max_mem = el_max_mem if int(el_max_mem) > 0 else EXECUTION_MAX_MEMORY

cl_client_name = service_name.split("-")[3]

config = get_config(
launcher.el_cl_genesis_data,
image,
existing_el_clients,
cl_client_name,
log_level,
el_min_cpu,
el_max_cpu,
Expand Down Expand Up @@ -126,6 +129,7 @@ def get_config(
el_cl_genesis_data,
image,
existing_el_clients,
cl_client_name,
verbosity_level,
el_min_cpu,
el_max_cpu,
Expand Down Expand Up @@ -201,6 +205,12 @@ def get_config(
min_memory=el_min_mem,
max_memory=el_max_mem,
env_vars=extra_env_vars,
labels=shared_utils.label_maker(
constants.EL_CLIENT_TYPE.reth,
constants.CLIENT_TYPES.el,
image,
cl_client_name,
),
)


Expand Down
6 changes: 6 additions & 0 deletions src/package_io/constants.star
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ GLOBAL_CLIENT_LOG_LEVEL = struct(
trace="trace",
)

CLIENT_TYPES = struct(
el="execution",
cl="beacon",
validator="validator",
)

VALIDATING_REWARDS_ACCOUNT = "0x878705ba3f8Bc32FCf7F4CAa1A35E72AF65CF766"
MAX_ENR_ENTRIES = 20
MAX_ENODE_ENTRIES = 20
Expand Down
9 changes: 9 additions & 0 deletions src/shared_utils/shared_utils.star
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,12 @@ def read_file_from_service(plan, service_name, filename):

def zfill_custom(value, width):
return ("0" * (width - len(str(value)))) + str(value)


def label_maker(client, client_type, image, connected_client):
return {
"ethereum-package-client": client,
"ethereum-package-client-type": client_type,
"ethereum-package-client-image": image.replace("/", "-").replace(":", "-"),
"ethereum-package-connected-client": connected_client,
}

0 comments on commit 789ed8e

Please sign in to comment.