Skip to content

Commit

Permalink
feat: add supernode label to every container (#788)
Browse files Browse the repository at this point in the history
  • Loading branch information
barnabasbusa authored Oct 4, 2024
1 parent 4d07aea commit 43edfd5
Show file tree
Hide file tree
Showing 21 changed files with 119 additions and 91 deletions.
2 changes: 2 additions & 0 deletions src/cl/cl_context.star
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def new_cl_context(
snooper_enabled=False,
snooper_engine_context=None,
validator_keystore_files_artifact_uuid="",
supernode=False,
):
return struct(
client_name=client_name,
Expand All @@ -27,4 +28,5 @@ def new_cl_context(
snooper_enabled=snooper_enabled,
snooper_engine_context=snooper_engine_context,
validator_keystore_files_artifact_uuid=validator_keystore_files_artifact_uuid,
supernode=supernode,
)
12 changes: 7 additions & 5 deletions src/cl/grandine/grandine_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def launch(
validator_keystore_files_artifact_uuid=node_keystore_files.files_artifact_uuid
if node_keystore_files
else "",
supernode=participant.supernode,
)


Expand Down Expand Up @@ -338,11 +339,12 @@ def get_beacon_config(
constants.HTTP_PORT_ID
),
"labels": shared_utils.label_maker(
constants.CL_TYPE.grandine,
constants.CLIENT_TYPES.cl,
participant.cl_image,
el_context.client_name,
participant.cl_extra_labels,
client=constants.CL_TYPE.grandine,
client_type=constants.CLIENT_TYPES.cl,
image=participant.cl_image,
connected_client=el_context.client_name,
extra_labels=participant.cl_extra_labels,
supernode=participant.supernode,
),
"tolerations": tolerations,
"node_selectors": node_selectors,
Expand Down
12 changes: 7 additions & 5 deletions src/cl/lighthouse/lighthouse_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def launch(
validator_keystore_files_artifact_uuid=node_keystore_files.files_artifact_uuid
if node_keystore_files
else "",
supernode=participant.supernode,
)


Expand Down Expand Up @@ -336,11 +337,12 @@ def get_beacon_config(
constants.HTTP_PORT_ID
),
"labels": shared_utils.label_maker(
constants.CL_TYPE.lighthouse,
constants.CLIENT_TYPES.cl,
participant.cl_image,
el_context.client_name,
participant.cl_extra_labels,
client=constants.CL_TYPE.lighthouse,
client_type=constants.CLIENT_TYPES.cl,
image=participant.cl_image,
connected_client=el_context.client_name,
extra_labels=participant.cl_extra_labels,
supernode=participant.supernode,
),
"tolerations": tolerations,
"node_selectors": node_selectors,
Expand Down
12 changes: 7 additions & 5 deletions src/cl/lodestar/lodestar_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ def launch(
validator_keystore_files_artifact_uuid=node_keystore_files.files_artifact_uuid
if node_keystore_files
else "",
supernode=participant.supernode,
)


Expand Down Expand Up @@ -328,11 +329,12 @@ def get_beacon_config(
constants.HTTP_PORT_ID
),
"labels": shared_utils.label_maker(
constants.CL_TYPE.lodestar,
constants.CLIENT_TYPES.cl,
participant.cl_image,
el_context.client_name,
participant.cl_extra_labels,
client=constants.CL_TYPE.lodestar,
client_type=constants.CLIENT_TYPES.cl,
image=participant.cl_image,
connected_client=el_context.client_name,
extra_labels=participant.cl_extra_labels,
supernode=participant.supernode,
),
"tolerations": tolerations,
"node_selectors": node_selectors,
Expand Down
12 changes: 7 additions & 5 deletions src/cl/nimbus/nimbus_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ def launch(
validator_keystore_files_artifact_uuid=node_keystore_files.files_artifact_uuid
if node_keystore_files
else "",
supernode=participant.supernode,
)


Expand Down Expand Up @@ -317,11 +318,12 @@ def get_beacon_config(
constants.HTTP_PORT_ID
),
"labels": shared_utils.label_maker(
constants.CL_TYPE.nimbus,
constants.CLIENT_TYPES.cl,
participant.cl_image,
el_context.client_name,
participant.cl_extra_labels,
client=constants.CL_TYPE.nimbus,
client_type=constants.CLIENT_TYPES.cl,
image=participant.cl_image,
connected_client=el_context.client_name,
extra_labels=participant.cl_extra_labels,
supernode=participant.supernode,
),
"tolerations": tolerations,
"node_selectors": node_selectors,
Expand Down
12 changes: 7 additions & 5 deletions src/cl/prysm/prysm_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ def launch(
validator_keystore_files_artifact_uuid=node_keystore_files.files_artifact_uuid
if node_keystore_files
else "",
supernode=participant.supernode,
)


Expand Down Expand Up @@ -320,11 +321,12 @@ def get_beacon_config(
constants.HTTP_PORT_ID
),
"labels": shared_utils.label_maker(
constants.CL_TYPE.prysm,
constants.CLIENT_TYPES.cl,
participant.cl_image,
el_context.client_name,
participant.cl_extra_labels,
client=constants.CL_TYPE.prysm,
client_type=constants.CLIENT_TYPES.cl,
image=participant.cl_image,
connected_client=el_context.client_name,
extra_labels=participant.cl_extra_labels,
supernode=participant.supernode,
),
"tolerations": tolerations,
"node_selectors": node_selectors,
Expand Down
12 changes: 7 additions & 5 deletions src/cl/teku/teku_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def launch(
validator_keystore_files_artifact_uuid=node_keystore_files.files_artifact_uuid
if node_keystore_files
else "",
supernode=participant.supernode,
)


Expand Down Expand Up @@ -358,11 +359,12 @@ def get_beacon_config(
constants.HTTP_PORT_ID
),
"labels": shared_utils.label_maker(
constants.CL_TYPE.teku,
constants.CLIENT_TYPES.cl,
participant.cl_image,
el_context.client_name,
participant.cl_extra_labels,
client=constants.CL_TYPE.teku,
client_type=constants.CLIENT_TYPES.cl,
image=participant.cl_image,
connected_client=el_context.client_name,
extra_labels=participant.cl_extra_labels,
supernode=participant.supernode,
),
"tolerations": tolerations,
"node_selectors": node_selectors,
Expand Down
11 changes: 6 additions & 5 deletions src/el/besu/besu_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,12 @@ def get_config(
"private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
"env_vars": env_vars,
"labels": shared_utils.label_maker(
constants.EL_TYPE.besu,
constants.CLIENT_TYPES.el,
participant.el_image,
cl_client_name,
participant.el_extra_labels,
client=constants.EL_TYPE.besu,
client_type=constants.CLIENT_TYPES.el,
image=participant.el_image,
connected_client=cl_client_name,
extra_labels=participant.el_extra_labels,
supernode=participant.supernode,
),
"user": User(uid=0, gid=0),
"tolerations": tolerations,
Expand Down
11 changes: 6 additions & 5 deletions src/el/erigon/erigon_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,12 @@ def get_config(
"private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
"env_vars": env_vars,
"labels": shared_utils.label_maker(
constants.EL_TYPE.erigon,
constants.CLIENT_TYPES.el,
participant.el_image,
cl_client_name,
participant.el_extra_labels,
client=constants.EL_TYPE.erigon,
client_type=constants.CLIENT_TYPES.el,
image=participant.el_image,
connected_client=cl_client_name,
extra_labels=participant.el_extra_labels,
supernode=participant.supernode,
),
"tolerations": tolerations,
"node_selectors": node_selectors,
Expand Down
11 changes: 6 additions & 5 deletions src/el/ethereumjs/ethereumjs_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,12 @@ def get_config(
"private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
"env_vars": env_vars,
"labels": shared_utils.label_maker(
constants.EL_TYPE.ethereumjs,
constants.CLIENT_TYPES.el,
participant.el_image,
cl_client_name,
participant.el_extra_labels,
client=constants.EL_TYPE.ethereumjs,
client_type=constants.CLIENT_TYPES.el,
image=participant.el_image,
connected_client=cl_client_name,
extra_labels=participant.el_extra_labels,
supernode=participant.supernode,
),
"tolerations": tolerations,
"node_selectors": node_selectors,
Expand Down
11 changes: 6 additions & 5 deletions src/el/geth/geth_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,12 @@ def get_config(
"private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
"env_vars": env_vars,
"labels": shared_utils.label_maker(
constants.EL_TYPE.geth,
constants.CLIENT_TYPES.el,
participant.el_image,
cl_client_name,
participant.el_extra_labels,
client=constants.EL_TYPE.geth,
client_type=constants.CLIENT_TYPES.el,
image=participant.el_image,
connected_client=cl_client_name,
extra_labels=participant.el_extra_labels,
supernode=participant.supernode,
),
"tolerations": tolerations,
"node_selectors": node_selectors,
Expand Down
11 changes: 6 additions & 5 deletions src/el/nethermind/nethermind_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,12 @@ def get_config(
"private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
"env_vars": env_vars,
"labels": shared_utils.label_maker(
constants.EL_TYPE.nethermind,
constants.CLIENT_TYPES.el,
participant.el_image,
cl_client_name,
participant.el_extra_labels,
client=constants.EL_TYPE.nethermind,
client_type=constants.CLIENT_TYPES.el,
image=participant.el_image,
connected_client=cl_client_name,
extra_labels=participant.el_extra_labels,
supernode=participant.supernode,
),
"tolerations": tolerations,
"node_selectors": node_selectors,
Expand Down
11 changes: 6 additions & 5 deletions src/el/nimbus-eth1/nimbus_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,12 @@ def get_config(
"private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
"env_vars": env_vars,
"labels": shared_utils.label_maker(
constants.EL_TYPE.nimbus,
constants.CLIENT_TYPES.el,
participant.el_image,
cl_client_name,
participant.el_extra_labels,
client=constants.EL_TYPE.nimbus,
client_type=constants.CLIENT_TYPES.el,
image=participant.el_image,
connected_client=cl_client_name,
extra_labels=participant.el_extra_labels,
supernode=participant.supernode,
),
"tolerations": tolerations,
"node_selectors": node_selectors,
Expand Down
11 changes: 6 additions & 5 deletions src/el/reth/reth_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,12 @@ def get_config(
"private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
"env_vars": env_vars,
"labels": shared_utils.label_maker(
constants.EL_TYPE.reth,
constants.CLIENT_TYPES.el,
participant.el_image,
cl_client_name,
participant.el_extra_labels,
client=constants.EL_TYPE.besu,
client_type=constants.CLIENT_TYPES.el,
image=participant.el_image,
connected_client=cl_client_name,
extra_labels=participant.el_extra_labels,
supernode=participant.supernode,
),
"tolerations": tolerations,
"node_selectors": node_selectors,
Expand Down
1 change: 1 addition & 0 deletions src/prometheus/prometheus_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def get_metrics_jobs(
"service": context.beacon_service_name,
"client_type": BEACON_CLIENT_TYPE,
"client_name": context.client_name,
"supernode": str(context.supernode),
}
additional_config = beacon_metrics_info[METRICS_INFO_ADDITIONAL_CONFIG_KEY]
if additional_config != None:
Expand Down
3 changes: 2 additions & 1 deletion src/shared_utils/shared_utils.star
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def zfill_custom(value, width):
return ("0" * (width - len(str(value)))) + str(value)


def label_maker(client, client_type, image, connected_client, extra_labels):
def label_maker(client, client_type, image, connected_client, extra_labels, supernode):
# Extract sha256 hash if present
sha256 = ""
if "@sha256:" in image:
Expand All @@ -85,6 +85,7 @@ def label_maker(client, client_type, image, connected_client, extra_labels):
.split("@")[0], # drop the sha256 part of the image from the label
"ethereum-package.sha256": sha256,
"ethereum-package.connected-client": connected_client,
"ethereum-package.supernode": str(supernode),
}

# Add extra_labels to the labels dictionary
Expand Down
11 changes: 6 additions & 5 deletions src/vc/lighthouse.star
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,12 @@ def get_config(
"files": files,
"env_vars": env,
"labels": shared_utils.label_maker(
constants.CL_TYPE.lighthouse,
constants.CLIENT_TYPES.validator,
image,
cl_context.client_name,
participant.vc_extra_labels,
client=constants.CL_TYPE.lighthouse,
client_type=constants.CLIENT_TYPES.validator,
image=image,
connected_client=cl_context.client_name,
extra_labels=participant.vc_extra_labels,
supernode=participant.supernode,
),
"tolerations": tolerations,
"node_selectors": node_selectors,
Expand Down
11 changes: 6 additions & 5 deletions src/vc/lodestar.star
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,12 @@ def get_config(
"files": files,
"env_vars": env_vars,
"labels": shared_utils.label_maker(
constants.CL_TYPE.lodestar,
constants.CLIENT_TYPES.validator,
image,
cl_context.client_name,
participant.vc_extra_labels,
client=constants.CL_TYPE.lodestar,
client_type=constants.CLIENT_TYPES.validator,
image=image,
connected_client=cl_context.client_name,
extra_labels=participant.vc_extra_labels,
supernode=participant.supernode,
),
"tolerations": tolerations,
"node_selectors": node_selectors,
Expand Down
11 changes: 6 additions & 5 deletions src/vc/nimbus.star
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,12 @@ def get_config(
"files": files,
"env_vars": participant.vc_extra_env_vars,
"labels": shared_utils.label_maker(
constants.CL_TYPE.nimbus,
constants.CLIENT_TYPES.validator,
image,
cl_context.client_name,
participant.vc_extra_labels,
client=constants.CL_TYPE.nimbus,
client_type=constants.CLIENT_TYPES.validator,
image=image,
connected_client=cl_context.client_name,
extra_labels=participant.vc_extra_labels,
supernode=participant.supernode,
),
"tolerations": tolerations,
"node_selectors": node_selectors,
Expand Down
11 changes: 6 additions & 5 deletions src/vc/prysm.star
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,12 @@ def get_config(
"files": files,
"env_vars": participant.vc_extra_env_vars,
"labels": shared_utils.label_maker(
constants.CL_TYPE.prysm,
constants.CLIENT_TYPES.validator,
image,
cl_context.client_name,
participant.vc_extra_labels,
client=constants.CL_TYPE.prysm,
client_type=constants.CLIENT_TYPES.validator,
image=image,
connected_client=cl_context.client_name,
extra_labels=participant.vc_extra_labels,
supernode=participant.supernode,
),
"tolerations": tolerations,
"node_selectors": node_selectors,
Expand Down
Loading

0 comments on commit 43edfd5

Please sign in to comment.