Commit 43edfd5a authored by Barnabas Busa's avatar Barnabas Busa Committed by GitHub

feat: add supernode label to every container (#788)

parent 4d07aea8
......@@ -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,
......@@ -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,
)
......@@ -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,
)
......@@ -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,
......
......@@ -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,
)
......@@ -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,
......
......@@ -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,
)
......@@ -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,
......
......@@ -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,
)
......@@ -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,
......
......@@ -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,
)
......@@ -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,
......
......@@ -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,
)
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
......@@ -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:
......
......@@ -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:
......@@ -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
......
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
......@@ -103,11 +103,12 @@ def get_config(
"files": files,
"env_vars": participant.vc_extra_env_vars,
"labels": shared_utils.label_maker(
constants.CL_TYPE.teku,
constants.CLIENT_TYPES.validator,
image,
cl_context.client_name,
participant.vc_extra_labels,
client=constants.CL_TYPE.teku,
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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment