Commit 4c4831bc authored by Barnabas Busa's avatar Barnabas Busa Committed by GitHub

fix: no default resource limits (#768)

parent 8fec454f
...@@ -220,7 +220,7 @@ participants: ...@@ -220,7 +220,7 @@ participants:
# Resource management for el containers # Resource management for el containers
# CPU is milicores # CPU is milicores
# RAM is in MB # RAM is in MB
# Defaults are set per client # Defaults to 0, which results in no resource limits
el_min_cpu: 0 el_min_cpu: 0
el_max_cpu: 0 el_max_cpu: 0
el_min_mem: 0 el_min_mem: 0
...@@ -278,7 +278,7 @@ participants: ...@@ -278,7 +278,7 @@ participants:
# Resource management for cl containers # Resource management for cl containers
# CPU is milicores # CPU is milicores
# RAM is in MB # RAM is in MB
# Defaults are set per client # Defaults to 0, which results in no resource limits
cl_min_cpu: 0 cl_min_cpu: 0
cl_max_cpu: 0 cl_max_cpu: 0
cl_min_mem: 0 cl_min_mem: 0
...@@ -340,7 +340,7 @@ participants: ...@@ -340,7 +340,7 @@ participants:
# Resource management for vc containers # Resource management for vc containers
# CPU is milicores # CPU is milicores
# RAM is in MB # RAM is in MB
# Defaults are set per client # Defaults to 0, which results in no resource limits
vc_min_cpu: 0 vc_min_cpu: 0
vc_max_cpu: 0 vc_max_cpu: 0
vc_min_mem: 0 vc_min_mem: 0
......
...@@ -95,7 +95,7 @@ def launch( ...@@ -95,7 +95,7 @@ def launch(
or constants.NETWORK_NAME.shadowfork in network_params.network or constants.NETWORK_NAME.shadowfork in network_params.network
else None else None
) )
network_name = shared_utils.get_network_name(network_params.network)
for index, participant in enumerate(participants): for index, participant in enumerate(participants):
cl_type = participant.cl_type cl_type = participant.cl_type
el_type = participant.el_type el_type = participant.el_type
...@@ -104,6 +104,26 @@ def launch( ...@@ -104,6 +104,26 @@ def launch(
global_node_selectors, global_node_selectors,
) )
tolerations = input_parser.get_client_tolerations(
participant.cl_tolerations, participant.tolerations, global_tolerations
)
(
cl_min_cpu,
cl_max_cpu,
cl_min_mem,
cl_max_mem,
cl_volume_size,
) = shared_utils.get_cpu_mem_resource_limits(
participant.cl_min_cpu,
participant.cl_max_cpu,
participant.cl_min_mem,
participant.cl_max_mem,
participant.cl_volume_size,
network_name,
participant.cl_type,
)
if cl_type not in cl_launchers: if cl_type not in cl_launchers:
fail( fail(
"Unsupported launcher '{0}', need one of '{1}'".format( "Unsupported launcher '{0}', need one of '{1}'".format(
...@@ -158,10 +178,10 @@ def launch( ...@@ -158,10 +178,10 @@ def launch(
el_context, el_context,
full_name, full_name,
new_cl_node_validator_keystores, new_cl_node_validator_keystores,
participant.cl_min_cpu, cl_min_cpu,
participant.cl_max_cpu, cl_max_cpu,
participant.cl_min_mem, cl_min_mem,
participant.cl_max_mem, cl_max_mem,
participant.snooper_enabled, participant.snooper_enabled,
snooper_engine_context, snooper_engine_context,
participant.blobber_enabled, participant.blobber_enabled,
...@@ -170,10 +190,8 @@ def launch( ...@@ -170,10 +190,8 @@ def launch(
participant.cl_extra_env_vars, participant.cl_extra_env_vars,
participant.cl_extra_labels, participant.cl_extra_labels,
persistent, persistent,
participant.cl_volume_size, cl_volume_size,
participant.cl_tolerations, tolerations,
participant.tolerations,
global_tolerations,
node_selectors, node_selectors,
participant.use_separate_vc, participant.use_separate_vc,
participant.keymanager_enabled, participant.keymanager_enabled,
...@@ -195,10 +213,10 @@ def launch( ...@@ -195,10 +213,10 @@ def launch(
el_context, el_context,
full_name, full_name,
new_cl_node_validator_keystores, new_cl_node_validator_keystores,
participant.cl_min_cpu, cl_min_cpu,
participant.cl_max_cpu, cl_max_cpu,
participant.cl_min_mem, cl_min_mem,
participant.cl_max_mem, cl_max_mem,
participant.snooper_enabled, participant.snooper_enabled,
snooper_engine_context, snooper_engine_context,
participant.blobber_enabled, participant.blobber_enabled,
...@@ -207,10 +225,8 @@ def launch( ...@@ -207,10 +225,8 @@ def launch(
participant.cl_extra_env_vars, participant.cl_extra_env_vars,
participant.cl_extra_labels, participant.cl_extra_labels,
persistent, persistent,
participant.cl_volume_size, cl_volume_size,
participant.cl_tolerations, tolerations,
participant.tolerations,
global_tolerations,
node_selectors, node_selectors,
participant.use_separate_vc, participant.use_separate_vc,
participant.keymanager_enabled, participant.keymanager_enabled,
......
...@@ -15,10 +15,6 @@ BEACON_DISCOVERY_PORT_NUM = 9000 ...@@ -15,10 +15,6 @@ BEACON_DISCOVERY_PORT_NUM = 9000
BEACON_HTTP_PORT_NUM = 4000 BEACON_HTTP_PORT_NUM = 4000
BEACON_METRICS_PORT_NUM = 8008 BEACON_METRICS_PORT_NUM = 8008
# The min/max CPU/memory that the beacon node can use
BEACON_MIN_CPU = 50
BEACON_MIN_MEMORY = 1024
BEACON_METRICS_PATH = "/metrics" BEACON_METRICS_PATH = "/metrics"
MIN_PEERS = 1 MIN_PEERS = 1
...@@ -58,9 +54,7 @@ def launch( ...@@ -58,9 +54,7 @@ def launch(
extra_labels, extra_labels,
persistent, persistent,
cl_volume_size, cl_volume_size,
cl_tolerations, tolerations,
participant_tolerations,
global_tolerations,
node_selectors, node_selectors,
use_separate_vc, use_separate_vc,
keymanager_enabled, keymanager_enabled,
...@@ -74,33 +68,8 @@ def launch( ...@@ -74,33 +68,8 @@ def launch(
participant_log_level, global_log_level, VERBOSITY_LEVELS participant_log_level, global_log_level, VERBOSITY_LEVELS
) )
tolerations = input_parser.get_client_tolerations(
cl_tolerations, participant_tolerations, global_tolerations
)
extra_params = [param for param in extra_params] extra_params = [param for param in extra_params]
network_name = shared_utils.get_network_name(launcher.network)
cl_min_cpu = int(cl_min_cpu) if int(cl_min_cpu) > 0 else BEACON_MIN_CPU
cl_max_cpu = (
int(cl_max_cpu)
if int(cl_max_cpu) > 0
else constants.RAM_CPU_OVERRIDES[network_name]["grandine_max_cpu"]
)
cl_min_mem = int(cl_min_mem) if int(cl_min_mem) > 0 else BEACON_MIN_MEMORY
cl_max_mem = (
int(cl_max_mem)
if int(cl_max_mem) > 0
else constants.RAM_CPU_OVERRIDES[network_name]["grandine_max_mem"]
)
cl_volume_size = (
int(cl_volume_size)
if int(cl_volume_size) > 0
else constants.VOLUME_SIZE[network_name]["grandine_volume_size"]
)
config = get_beacon_config( config = get_beacon_config(
plan, plan,
launcher.el_cl_genesis_data, launcher.el_cl_genesis_data,
...@@ -386,33 +355,42 @@ def get_beacon_config( ...@@ -386,33 +355,42 @@ def get_beacon_config(
persistent_key="data-{0}".format(service_name), persistent_key="data-{0}".format(service_name),
size=cl_volume_size, size=cl_volume_size,
) )
config_args = {
return ServiceConfig( "image": image,
image=image, "ports": used_ports,
ports=used_ports, "public_ports": public_ports,
public_ports=public_ports, "cmd": cmd,
cmd=cmd, "files": files,
env_vars=extra_env_vars, "env_vars": extra_env_vars,
files=files, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "ready_conditions": cl_node_ready_conditions.get_ready_conditions(
ready_conditions=cl_node_ready_conditions.get_ready_conditions(
constants.HTTP_PORT_ID constants.HTTP_PORT_ID
), ),
min_cpu=cl_min_cpu, "labels": shared_utils.label_maker(
max_cpu=cl_max_cpu,
min_memory=cl_min_mem,
max_memory=cl_max_mem,
labels=shared_utils.label_maker(
constants.CL_TYPE.grandine, constants.CL_TYPE.grandine,
constants.CLIENT_TYPES.cl, constants.CLIENT_TYPES.cl,
image, image,
el_context.client_name, el_context.client_name,
extra_labels, extra_labels,
), ),
user=User(uid=0, gid=0), "tolerations": tolerations,
tolerations=tolerations, "node_selectors": node_selectors,
node_selectors=node_selectors, "user": User(uid=0, gid=0),
) }
if cl_min_cpu > 0:
config_args["min_cpu"] = cl_min_cpu
if cl_max_cpu > 0:
config_args["max_cpu"] = cl_max_cpu
if cl_min_mem > 0:
config_args["min_memory"] = cl_min_mem
if cl_max_mem > 0:
config_args["max_memory"] = cl_max_mem
return ServiceConfig(**config_args)
def new_grandine_launcher( def new_grandine_launcher(
......
...@@ -60,9 +60,7 @@ def launch( ...@@ -60,9 +60,7 @@ def launch(
extra_labels, extra_labels,
persistent, persistent,
cl_volume_size, cl_volume_size,
cl_tolerations, tolerations,
participant_tolerations,
global_tolerations,
node_selectors, node_selectors,
use_separate_vc, use_separate_vc,
keymanager_enabled, keymanager_enabled,
...@@ -77,31 +75,6 @@ def launch( ...@@ -77,31 +75,6 @@ def launch(
participant_log_level, global_log_level, VERBOSITY_LEVELS participant_log_level, global_log_level, VERBOSITY_LEVELS
) )
tolerations = input_parser.get_client_tolerations(
cl_tolerations, participant_tolerations, global_tolerations
)
network_name = shared_utils.get_network_name(launcher.network)
cl_min_cpu = int(cl_min_cpu) if int(cl_min_cpu) > 0 else BEACON_MIN_CPU
cl_max_cpu = (
int(cl_max_cpu)
if int(cl_max_cpu) > 0
else constants.RAM_CPU_OVERRIDES[network_name]["lighthouse_max_cpu"]
)
cl_min_mem = int(cl_min_mem) if int(cl_min_mem) > 0 else BEACON_MIN_MEMORY
cl_max_mem = (
int(cl_max_mem)
if int(cl_max_mem) > 0
else constants.RAM_CPU_OVERRIDES[network_name]["lighthouse_max_mem"]
)
cl_volume_size = (
int(cl_volume_size)
if int(cl_volume_size) > 0
else constants.VOLUME_SIZE[network_name]["lighthouse_volume_size"]
)
# Launch Beacon node # Launch Beacon node
beacon_config = get_beacon_config( beacon_config = get_beacon_config(
plan, plan,
...@@ -374,31 +347,41 @@ def get_beacon_config( ...@@ -374,31 +347,41 @@ def get_beacon_config(
) )
env = {RUST_BACKTRACE_ENVVAR_NAME: RUST_FULL_BACKTRACE_KEYWORD} env = {RUST_BACKTRACE_ENVVAR_NAME: RUST_FULL_BACKTRACE_KEYWORD}
env.update(extra_env_vars) env.update(extra_env_vars)
return ServiceConfig( config_args = {
image=image, "image": image,
ports=used_ports, "ports": used_ports,
public_ports=public_ports, "public_ports": public_ports,
cmd=cmd, "cmd": cmd,
files=files, "files": files,
env_vars=env, "env_vars": env,
private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
ready_conditions=cl_node_ready_conditions.get_ready_conditions( "ready_conditions": cl_node_ready_conditions.get_ready_conditions(
constants.HTTP_PORT_ID constants.HTTP_PORT_ID
), ),
min_cpu=cl_min_cpu, "labels": shared_utils.label_maker(
max_cpu=cl_max_cpu,
min_memory=cl_min_mem,
max_memory=cl_max_mem,
labels=shared_utils.label_maker(
constants.CL_TYPE.lighthouse, constants.CL_TYPE.lighthouse,
constants.CLIENT_TYPES.cl, constants.CLIENT_TYPES.cl,
image, image,
el_context.client_name, el_context.client_name,
extra_labels, extra_labels,
), ),
tolerations=tolerations, "tolerations": tolerations,
node_selectors=node_selectors, "node_selectors": node_selectors,
) }
if cl_min_cpu > 0:
config_args["min_cpu"] = cl_min_cpu
if cl_max_cpu > 0:
config_args["max_cpu"] = cl_max_cpu
if cl_min_mem > 0:
config_args["min_memory"] = cl_min_mem
if cl_max_mem > 0:
config_args["max_memory"] = cl_max_mem
return ServiceConfig(**config_args)
def new_lighthouse_launcher(el_cl_genesis_data, jwt_file, network_params): def new_lighthouse_launcher(el_cl_genesis_data, jwt_file, network_params):
......
...@@ -15,10 +15,6 @@ BEACON_DISCOVERY_PORT_NUM = 9000 ...@@ -15,10 +15,6 @@ BEACON_DISCOVERY_PORT_NUM = 9000
BEACON_HTTP_PORT_NUM = 4000 BEACON_HTTP_PORT_NUM = 4000
BEACON_METRICS_PORT_NUM = 8008 BEACON_METRICS_PORT_NUM = 8008
# The min/max CPU/memory that the beacon node can use
BEACON_MIN_CPU = 50
BEACON_MIN_MEMORY = 256
METRICS_PATH = "/metrics" METRICS_PATH = "/metrics"
VERBOSITY_LEVELS = { VERBOSITY_LEVELS = {
...@@ -54,9 +50,7 @@ def launch( ...@@ -54,9 +50,7 @@ def launch(
extra_labels, extra_labels,
persistent, persistent,
cl_volume_size, cl_volume_size,
cl_tolerations, tolerations,
participant_tolerations,
global_tolerations,
node_selectors, node_selectors,
use_separate_vc, use_separate_vc,
keymanager_enabled, keymanager_enabled,
...@@ -70,31 +64,6 @@ def launch( ...@@ -70,31 +64,6 @@ def launch(
participant_log_level, global_log_level, VERBOSITY_LEVELS participant_log_level, global_log_level, VERBOSITY_LEVELS
) )
tolerations = input_parser.get_client_tolerations(
cl_tolerations, participant_tolerations, global_tolerations
)
network_name = shared_utils.get_network_name(launcher.network)
cl_min_cpu = int(cl_min_cpu) if int(cl_min_cpu) > 0 else BEACON_MIN_CPU
cl_max_cpu = (
int(cl_max_cpu)
if int(cl_max_cpu) > 0
else constants.RAM_CPU_OVERRIDES[network_name]["lodestar_max_cpu"]
)
cl_min_mem = int(cl_min_mem) if int(cl_min_mem) > 0 else BEACON_MIN_MEMORY
cl_max_mem = (
int(cl_max_mem)
if int(cl_max_mem) > 0
else constants.RAM_CPU_OVERRIDES[network_name]["lodestar_max_mem"]
)
cl_volume_size = (
int(cl_volume_size)
if int(cl_volume_size) > 0
else constants.VOLUME_SIZE[network_name]["lodestar_volume_size"]
)
# Launch Beacon node # Launch Beacon node
beacon_config = get_beacon_config( beacon_config = get_beacon_config(
plan, plan,
...@@ -368,31 +337,41 @@ def get_beacon_config( ...@@ -368,31 +337,41 @@ def get_beacon_config(
if preset == "minimal": if preset == "minimal":
extra_env_vars["LODESTAR_PRESET"] = "minimal" extra_env_vars["LODESTAR_PRESET"] = "minimal"
return ServiceConfig( config_args = {
image=image, "image": image,
ports=used_ports, "ports": used_ports,
public_ports=public_ports, "public_ports": public_ports,
cmd=cmd, "cmd": cmd,
env_vars=extra_env_vars, "files": files,
files=files, "env_vars": extra_env_vars,
private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
ready_conditions=cl_node_ready_conditions.get_ready_conditions( "ready_conditions": cl_node_ready_conditions.get_ready_conditions(
constants.HTTP_PORT_ID constants.HTTP_PORT_ID
), ),
min_cpu=cl_min_cpu, "labels": shared_utils.label_maker(
max_cpu=cl_max_cpu,
min_memory=cl_min_mem,
max_memory=cl_max_mem,
labels=shared_utils.label_maker(
constants.CL_TYPE.lodestar, constants.CL_TYPE.lodestar,
constants.CLIENT_TYPES.cl, constants.CLIENT_TYPES.cl,
image, image,
el_context.client_name, el_context.client_name,
extra_labels, extra_labels,
), ),
tolerations=tolerations, "tolerations": tolerations,
node_selectors=node_selectors, "node_selectors": node_selectors,
) }
if cl_min_cpu > 0:
config_args["min_cpu"] = cl_min_cpu
if cl_max_cpu > 0:
config_args["max_cpu"] = cl_max_cpu
if cl_min_mem > 0:
config_args["min_memory"] = cl_min_mem
if cl_max_mem > 0:
config_args["max_memory"] = cl_max_mem
return ServiceConfig(**config_args)
def new_lodestar_launcher(el_cl_genesis_data, jwt_file, network_params): def new_lodestar_launcher(el_cl_genesis_data, jwt_file, network_params):
......
...@@ -70,9 +70,7 @@ def launch( ...@@ -70,9 +70,7 @@ def launch(
extra_labels, extra_labels,
persistent, persistent,
cl_volume_size, cl_volume_size,
cl_tolerations, tolerations,
participant_tolerations,
global_tolerations,
node_selectors, node_selectors,
use_separate_vc, use_separate_vc,
keymanager_enabled, keymanager_enabled,
...@@ -87,31 +85,6 @@ def launch( ...@@ -87,31 +85,6 @@ def launch(
participant_log_level, global_log_level, VERBOSITY_LEVELS participant_log_level, global_log_level, VERBOSITY_LEVELS
) )
tolerations = input_parser.get_client_tolerations(
cl_tolerations, participant_tolerations, global_tolerations
)
network_name = shared_utils.get_network_name(launcher.network)
cl_min_cpu = int(cl_min_cpu) if int(cl_min_cpu) > 0 else BEACON_MIN_CPU
cl_max_cpu = (
int(cl_max_cpu)
if int(cl_max_cpu) > 0
else constants.RAM_CPU_OVERRIDES[network_name]["nimbus_max_cpu"]
)
cl_min_mem = int(cl_min_mem) if int(cl_min_mem) > 0 else BEACON_MIN_MEMORY
cl_max_mem = (
int(cl_max_mem)
if int(cl_max_mem) > 0
else constants.RAM_CPU_OVERRIDES[network_name]["nimbus_max_mem"]
)
cl_volume_size = (
int(cl_volume_size)
if int(cl_volume_size) > 0
else constants.VOLUME_SIZE[network_name]["nimbus_volume_size"]
)
beacon_config = get_beacon_config( beacon_config = get_beacon_config(
plan, plan,
launcher.el_cl_genesis_data, launcher.el_cl_genesis_data,
...@@ -365,32 +338,42 @@ def get_beacon_config( ...@@ -365,32 +338,42 @@ def get_beacon_config(
size=cl_volume_size, size=cl_volume_size,
) )
return ServiceConfig( config_args = {
image=image, "image": image,
ports=used_ports, "ports": used_ports,
public_ports=public_ports, "public_ports": public_ports,
cmd=cmd, "cmd": cmd,
env_vars=extra_env_vars, "files": files,
files=files, "env_vars": extra_env_vars,
private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
ready_conditions=cl_node_ready_conditions.get_ready_conditions( "ready_conditions": cl_node_ready_conditions.get_ready_conditions(
constants.HTTP_PORT_ID constants.HTTP_PORT_ID
), ),
min_cpu=cl_min_cpu, "labels": shared_utils.label_maker(
max_cpu=cl_max_cpu,
min_memory=cl_min_mem,
max_memory=cl_max_mem,
labels=shared_utils.label_maker(
constants.CL_TYPE.nimbus, constants.CL_TYPE.nimbus,
constants.CLIENT_TYPES.cl, constants.CLIENT_TYPES.cl,
image, image,
el_context.client_name, el_context.client_name,
extra_labels, extra_labels,
), ),
user=User(uid=0, gid=0), "tolerations": tolerations,
tolerations=tolerations, "node_selectors": node_selectors,
node_selectors=node_selectors, "user": User(uid=0, gid=0),
) }
if cl_min_cpu > 0:
config_args["min_cpu"] = cl_min_cpu
if cl_max_cpu > 0:
config_args["max_cpu"] = cl_max_cpu
if cl_min_mem > 0:
config_args["min_memory"] = cl_min_mem
if cl_max_mem > 0:
config_args["max_memory"] = cl_max_mem
return ServiceConfig(**config_args)
def new_nimbus_launcher(el_cl_genesis_data, jwt_file, network_params, keymanager_file): def new_nimbus_launcher(el_cl_genesis_data, jwt_file, network_params, keymanager_file):
......
...@@ -17,10 +17,6 @@ HTTP_PORT_NUM = 3500 ...@@ -17,10 +17,6 @@ HTTP_PORT_NUM = 3500
BEACON_MONITORING_PORT_NUM = 8080 BEACON_MONITORING_PORT_NUM = 8080
PROFILING_PORT_NUM = 6060 PROFILING_PORT_NUM = 6060
# The min/max CPU/memory that the beacon node can use
BEACON_MIN_CPU = 100
BEACON_MIN_MEMORY = 256
METRICS_PATH = "/metrics" METRICS_PATH = "/metrics"
MIN_PEERS = 1 MIN_PEERS = 1
...@@ -58,9 +54,7 @@ def launch( ...@@ -58,9 +54,7 @@ def launch(
extra_labels, extra_labels,
persistent, persistent,
cl_volume_size, cl_volume_size,
cl_tolerations, tolerations,
participant_tolerations,
global_tolerations,
node_selectors, node_selectors,
use_separate_vc, use_separate_vc,
keymanager_enabled, keymanager_enabled,
...@@ -74,31 +68,6 @@ def launch( ...@@ -74,31 +68,6 @@ def launch(
participant_log_level, global_log_level, VERBOSITY_LEVELS participant_log_level, global_log_level, VERBOSITY_LEVELS
) )
tolerations = input_parser.get_client_tolerations(
cl_tolerations, participant_tolerations, global_tolerations
)
network_name = shared_utils.get_network_name(launcher.network)
cl_min_cpu = int(cl_min_cpu) if int(cl_min_cpu) > 0 else BEACON_MIN_CPU
cl_max_cpu = (
int(cl_max_cpu)
if int(cl_max_cpu) > 0
else constants.RAM_CPU_OVERRIDES[network_name]["prysm_max_cpu"]
)
cl_min_mem = int(cl_min_mem) if int(cl_min_mem) > 0 else BEACON_MIN_MEMORY
cl_max_mem = (
int(cl_max_mem)
if int(cl_max_mem) > 0
else constants.RAM_CPU_OVERRIDES[network_name]["prysm_max_mem"]
)
cl_volume_size = (
int(cl_volume_size)
if int(cl_volume_size) > 0
else constants.VOLUME_SIZE[network_name]["prysm_volume_size"]
)
beacon_config = get_beacon_config( beacon_config = get_beacon_config(
plan, plan,
launcher.el_cl_genesis_data, launcher.el_cl_genesis_data,
...@@ -359,31 +328,41 @@ def get_beacon_config( ...@@ -359,31 +328,41 @@ def get_beacon_config(
size=cl_volume_size, size=cl_volume_size,
) )
return ServiceConfig( config_args = {
image=beacon_image, "image": beacon_image,
ports=used_ports, "ports": used_ports,
public_ports=public_ports, "public_ports": public_ports,
cmd=cmd, "cmd": cmd,
env_vars=extra_env_vars, "files": files,
files=files, "env_vars": extra_env_vars,
private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
ready_conditions=cl_node_ready_conditions.get_ready_conditions( "ready_conditions": cl_node_ready_conditions.get_ready_conditions(
constants.HTTP_PORT_ID constants.HTTP_PORT_ID
), ),
min_cpu=cl_min_cpu, "labels": shared_utils.label_maker(
max_cpu=cl_max_cpu,
min_memory=cl_min_mem,
max_memory=cl_max_mem,
labels=shared_utils.label_maker(
constants.CL_TYPE.prysm, constants.CL_TYPE.prysm,
constants.CLIENT_TYPES.cl, constants.CLIENT_TYPES.cl,
beacon_image, beacon_image,
el_context.client_name, el_context.client_name,
extra_labels, extra_labels,
), ),
tolerations=tolerations, "tolerations": tolerations,
node_selectors=node_selectors, "node_selectors": node_selectors,
) }
if cl_min_cpu > 0:
config_args["min_cpu"] = cl_min_cpu
if cl_max_cpu > 0:
config_args["max_cpu"] = cl_max_cpu
if cl_min_mem > 0:
config_args["min_memory"] = cl_min_mem
if cl_max_mem > 0:
config_args["max_memory"] = cl_max_mem
return ServiceConfig(**config_args)
def new_prysm_launcher( def new_prysm_launcher(
......
...@@ -18,10 +18,6 @@ BEACON_DISCOVERY_PORT_NUM = 9000 ...@@ -18,10 +18,6 @@ BEACON_DISCOVERY_PORT_NUM = 9000
BEACON_HTTP_PORT_NUM = 4000 BEACON_HTTP_PORT_NUM = 4000
BEACON_METRICS_PORT_NUM = 8008 BEACON_METRICS_PORT_NUM = 8008
# The min/max CPU/memory that the beacon node can use
BEACON_MIN_CPU = 50
BEACON_MIN_MEMORY = 1024
BEACON_METRICS_PATH = "/metrics" BEACON_METRICS_PATH = "/metrics"
MIN_PEERS = 1 MIN_PEERS = 1
...@@ -61,9 +57,7 @@ def launch( ...@@ -61,9 +57,7 @@ def launch(
extra_labels, extra_labels,
persistent, persistent,
cl_volume_size, cl_volume_size,
cl_tolerations, tolerations,
participant_tolerations,
global_tolerations,
node_selectors, node_selectors,
use_separate_vc, use_separate_vc,
keymanager_enabled, keymanager_enabled,
...@@ -77,33 +71,8 @@ def launch( ...@@ -77,33 +71,8 @@ def launch(
participant_log_level, global_log_level, VERBOSITY_LEVELS participant_log_level, global_log_level, VERBOSITY_LEVELS
) )
tolerations = input_parser.get_client_tolerations(
cl_tolerations, participant_tolerations, global_tolerations
)
extra_params = [param for param in extra_params] extra_params = [param for param in extra_params]
network_name = shared_utils.get_network_name(launcher.network)
cl_min_cpu = int(cl_min_cpu) if int(cl_min_cpu) > 0 else BEACON_MIN_CPU
cl_max_cpu = (
int(cl_max_cpu)
if int(cl_max_cpu) > 0
else constants.RAM_CPU_OVERRIDES[network_name]["teku_max_cpu"]
)
cl_min_mem = int(cl_min_mem) if int(cl_min_mem) > 0 else BEACON_MIN_MEMORY
cl_max_mem = (
int(cl_max_mem)
if int(cl_max_mem) > 0
else constants.RAM_CPU_OVERRIDES[network_name]["teku_max_mem"]
)
cl_volume_size = (
int(cl_volume_size)
if int(cl_volume_size) > 0
else constants.VOLUME_SIZE[network_name]["teku_volume_size"]
)
config = get_beacon_config( config = get_beacon_config(
plan, plan,
launcher.el_cl_genesis_data, launcher.el_cl_genesis_data,
...@@ -410,32 +379,42 @@ def get_beacon_config( ...@@ -410,32 +379,42 @@ def get_beacon_config(
size=cl_volume_size, size=cl_volume_size,
) )
return ServiceConfig( config_args = {
image=image, "image": image,
ports=used_ports, "ports": used_ports,
public_ports=public_ports, "public_ports": public_ports,
cmd=cmd, "cmd": cmd,
env_vars=extra_env_vars, "files": files,
files=files, "env_vars": extra_env_vars,
private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
ready_conditions=cl_node_ready_conditions.get_ready_conditions( "ready_conditions": cl_node_ready_conditions.get_ready_conditions(
constants.HTTP_PORT_ID constants.HTTP_PORT_ID
), ),
min_cpu=cl_min_cpu, "labels": shared_utils.label_maker(
max_cpu=cl_max_cpu,
min_memory=cl_min_mem,
max_memory=cl_max_mem,
labels=shared_utils.label_maker(
constants.CL_TYPE.teku, constants.CL_TYPE.teku,
constants.CLIENT_TYPES.cl, constants.CLIENT_TYPES.cl,
image, image,
el_context.client_name, el_context.client_name,
extra_labels, extra_labels,
), ),
user=User(uid=0, gid=0), "tolerations": tolerations,
tolerations=tolerations, "node_selectors": node_selectors,
node_selectors=node_selectors, "user": User(uid=0, gid=0),
) }
if cl_min_cpu > 0:
config_args["min_cpu"] = cl_min_cpu
if cl_max_cpu > 0:
config_args["max_cpu"] = cl_max_cpu
if cl_min_mem > 0:
config_args["min_memory"] = cl_min_mem
if cl_max_mem > 0:
config_args["max_memory"] = cl_max_mem
return ServiceConfig(**config_args)
def new_teku_launcher(el_cl_genesis_data, jwt_file, network_params, keymanager_file): def new_teku_launcher(el_cl_genesis_data, jwt_file, network_params, keymanager_file):
......
...@@ -17,12 +17,6 @@ DISCOVERY_PORT_NUM = 30303 ...@@ -17,12 +17,6 @@ DISCOVERY_PORT_NUM = 30303
ENGINE_HTTP_RPC_PORT_NUM = 8551 ENGINE_HTTP_RPC_PORT_NUM = 8551
METRICS_PORT_NUM = 9001 METRICS_PORT_NUM = 9001
# The min/max CPU/memory that the execution node can use
EXECUTION_MIN_CPU = 100
EXECUTION_MAX_CPU = 1000
EXECUTION_MIN_MEMORY = 512
EXECUTION_MAX_MEMORY = 2048
JAVA_OPTS = {"JAVA_OPTS": "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n"} JAVA_OPTS = {"JAVA_OPTS": "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n"}
ENTRYPOINT_ARGS = ["sh", "-c"] ENTRYPOINT_ARGS = ["sh", "-c"]
...@@ -62,27 +56,6 @@ def launch( ...@@ -62,27 +56,6 @@ def launch(
participant_log_level, global_log_level, VERBOSITY_LEVELS participant_log_level, global_log_level, VERBOSITY_LEVELS
) )
network_name = shared_utils.get_network_name(launcher.network)
el_min_cpu = int(el_min_cpu) if int(el_min_cpu) > 0 else EXECUTION_MIN_CPU
el_max_cpu = (
int(el_max_cpu)
if int(el_max_cpu) > 0
else constants.RAM_CPU_OVERRIDES[network_name]["besu_max_cpu"]
)
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 constants.RAM_CPU_OVERRIDES[network_name]["besu_max_mem"]
)
el_volume_size = (
el_volume_size
if int(el_volume_size) > 0
else constants.VOLUME_SIZE[network_name]["besu_volume_size"]
)
cl_client_name = service_name.split("-")[3] cl_client_name = service_name.split("-")[3]
config = get_config( config = get_config(
...@@ -270,30 +243,37 @@ def get_config( ...@@ -270,30 +243,37 @@ def get_config(
persistent_key="data-{0}".format(service_name), persistent_key="data-{0}".format(service_name),
size=el_volume_size, size=el_volume_size,
) )
return ServiceConfig(
image=image, config_args = {
ports=used_ports, "image": image,
public_ports=public_ports, "ports": used_ports,
cmd=[cmd_str], "public_ports": public_ports,
files=files, "cmd": [cmd_str],
env_vars=extra_env_vars, "files": files,
entrypoint=ENTRYPOINT_ARGS, "entrypoint": ENTRYPOINT_ARGS,
private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
min_cpu=el_min_cpu, "env_vars": extra_env_vars,
max_cpu=el_max_cpu, "labels": shared_utils.label_maker(
min_memory=el_min_mem,
max_memory=el_max_mem,
labels=shared_utils.label_maker(
constants.EL_TYPE.besu, constants.EL_TYPE.besu,
constants.CLIENT_TYPES.el, constants.CLIENT_TYPES.el,
image, image,
cl_client_name, cl_client_name,
extra_labels, extra_labels,
), ),
user=User(uid=0, gid=0), "user": User(uid=0, gid=0),
tolerations=tolerations, "tolerations": tolerations,
node_selectors=node_selectors, "node_selectors": node_selectors,
) }
if el_min_cpu > 0:
config_args["min_cpu"] = el_min_cpu
if el_max_cpu > 0:
config_args["max_cpu"] = el_max_cpu
if el_min_mem > 0:
config_args["min_memory"] = el_min_mem
if el_max_mem > 0:
config_args["max_memory"] = el_max_mem
return ServiceConfig(**config_args)
def new_besu_launcher(el_cl_genesis_data, jwt_file, network): def new_besu_launcher(el_cl_genesis_data, jwt_file, network):
......
...@@ -36,16 +36,6 @@ def launch( ...@@ -36,16 +36,6 @@ def launch(
), ),
"launch_method": geth.launch, "launch_method": geth.launch,
}, },
constants.EL_TYPE.geth_builder: {
"launcher": geth.new_geth_launcher(
el_cl_data,
jwt_file,
network_params.network,
network_id,
el_cl_data.prague_time,
),
"launch_method": geth.launch,
},
constants.EL_TYPE.besu: { constants.EL_TYPE.besu: {
"launcher": besu.new_besu_launcher( "launcher": besu.new_besu_launcher(
el_cl_data, el_cl_data,
...@@ -108,7 +98,7 @@ def launch( ...@@ -108,7 +98,7 @@ def launch(
} }
all_el_contexts = [] all_el_contexts = []
network_name = shared_utils.get_network_name(network_params.network)
for index, participant in enumerate(participants): for index, participant in enumerate(participants):
cl_type = participant.cl_type cl_type = participant.cl_type
el_type = participant.el_type el_type = participant.el_type
...@@ -119,6 +109,23 @@ def launch( ...@@ -119,6 +109,23 @@ def launch(
tolerations = input_parser.get_client_tolerations( tolerations = input_parser.get_client_tolerations(
participant.el_tolerations, participant.tolerations, global_tolerations participant.el_tolerations, participant.tolerations, global_tolerations
) )
(
el_min_cpu,
el_max_cpu,
el_min_mem,
el_max_mem,
el_volume_size,
) = shared_utils.get_cpu_mem_resource_limits(
participant.el_min_cpu,
participant.el_max_cpu,
participant.el_min_mem,
participant.el_max_mem,
participant.el_volume_size,
network_name,
participant.el_type,
)
if el_type not in el_launchers: if el_type not in el_launchers:
fail( fail(
"Unsupported launcher '{0}', need one of '{1}'".format( "Unsupported launcher '{0}', need one of '{1}'".format(
...@@ -144,15 +151,15 @@ def launch( ...@@ -144,15 +151,15 @@ def launch(
participant.el_log_level, participant.el_log_level,
global_log_level, global_log_level,
all_el_contexts, all_el_contexts,
participant.el_min_cpu, el_min_cpu,
participant.el_max_cpu, el_max_cpu,
participant.el_min_mem, el_min_mem,
participant.el_max_mem, el_max_mem,
participant.el_extra_params, participant.el_extra_params,
participant.el_extra_env_vars, participant.el_extra_env_vars,
participant.el_extra_labels, participant.el_extra_labels,
persistent, persistent,
participant.el_volume_size, el_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
port_publisher, port_publisher,
......
...@@ -16,10 +16,6 @@ DISCOVERY_PORT_NUM = 30303 ...@@ -16,10 +16,6 @@ DISCOVERY_PORT_NUM = 30303
ENGINE_RPC_PORT_NUM = 8551 ENGINE_RPC_PORT_NUM = 8551
METRICS_PORT_NUM = 9001 METRICS_PORT_NUM = 9001
# The min/max CPU/memory that the execution node can use
EXECUTION_MIN_CPU = 100
EXECUTION_MIN_MEMORY = 512
ENTRYPOINT_ARGS = ["sh", "-c"] ENTRYPOINT_ARGS = ["sh", "-c"]
VERBOSITY_LEVELS = { VERBOSITY_LEVELS = {
...@@ -57,27 +53,6 @@ def launch( ...@@ -57,27 +53,6 @@ def launch(
participant_log_level, global_log_level, VERBOSITY_LEVELS participant_log_level, global_log_level, VERBOSITY_LEVELS
) )
network_name = shared_utils.get_network_name(launcher.network)
el_min_cpu = int(el_min_cpu) if int(el_min_cpu) > 0 else EXECUTION_MIN_CPU
el_max_cpu = (
int(el_max_cpu)
if int(el_max_cpu) > 0
else constants.RAM_CPU_OVERRIDES[network_name]["erigon_max_cpu"]
)
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 constants.RAM_CPU_OVERRIDES[network_name]["erigon_max_mem"]
)
el_volume_size = (
el_volume_size
if int(el_volume_size) > 0
else constants.VOLUME_SIZE[network_name]["erigon_volume_size"]
)
cl_client_name = service_name.split("-")[3] cl_client_name = service_name.split("-")[3]
config = get_config( config = get_config(
...@@ -265,30 +240,36 @@ def get_config( ...@@ -265,30 +240,36 @@ def get_config(
else: else:
command_arg_str = " ".join(cmd) command_arg_str = " ".join(cmd)
return ServiceConfig( config_args = {
image=image, "image": image,
ports=used_ports, "ports": used_ports,
public_ports=public_ports, "public_ports": public_ports,
cmd=[command_arg_str], "cmd": [command_arg_str],
files=files, "files": files,
entrypoint=ENTRYPOINT_ARGS, "entrypoint": ENTRYPOINT_ARGS,
private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
min_cpu=el_min_cpu, "env_vars": extra_env_vars,
max_cpu=el_max_cpu, "labels": shared_utils.label_maker(
min_memory=el_min_mem,
max_memory=el_max_mem,
env_vars=extra_env_vars,
labels=shared_utils.label_maker(
constants.EL_TYPE.erigon, constants.EL_TYPE.erigon,
constants.CLIENT_TYPES.el, constants.CLIENT_TYPES.el,
image, image,
cl_client_name, cl_client_name,
extra_labels, extra_labels,
), ),
user=User(uid=0, gid=0), "tolerations": tolerations,
tolerations=tolerations, "node_selectors": node_selectors,
node_selectors=node_selectors, "user": User(uid=0, gid=0),
) }
if el_min_cpu > 0:
config_args["min_cpu"] = el_min_cpu
if el_max_cpu > 0:
config_args["max_cpu"] = el_max_cpu
if el_min_mem > 0:
config_args["min_memory"] = el_min_mem
if el_max_mem > 0:
config_args["max_memory"] = el_max_mem
return ServiceConfig(**config_args)
def new_erigon_launcher(el_cl_genesis_data, jwt_file, network, networkid, prague_time): def new_erigon_launcher(el_cl_genesis_data, jwt_file, network, networkid, prague_time):
......
...@@ -13,10 +13,6 @@ DISCOVERY_PORT_NUM = 30303 ...@@ -13,10 +13,6 @@ DISCOVERY_PORT_NUM = 30303
ENGINE_RPC_PORT_NUM = 8551 ENGINE_RPC_PORT_NUM = 8551
METRICS_PORT_NUM = 9001 METRICS_PORT_NUM = 9001
# The min/max CPU/memory that the execution node can use
EXECUTION_MIN_CPU = 100
EXECUTION_MIN_MEMORY = 256
METRICS_PATH = "/metrics" METRICS_PATH = "/metrics"
# The dirpath of the execution data directory on the client container # The dirpath of the execution data directory on the client container
...@@ -59,27 +55,6 @@ def launch( ...@@ -59,27 +55,6 @@ def launch(
participant_log_level, global_log_level, VERBOSITY_LEVELS participant_log_level, global_log_level, VERBOSITY_LEVELS
) )
network_name = shared_utils.get_network_name(launcher.network)
el_min_cpu = int(el_min_cpu) if int(el_min_cpu) > 0 else EXECUTION_MIN_CPU
el_max_cpu = (
int(el_max_cpu)
if int(el_max_cpu) > 0
else constants.RAM_CPU_OVERRIDES[network_name]["ethereumjs_max_cpu"]
)
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 constants.RAM_CPU_OVERRIDES[network_name]["ethereumjs_max_mem"]
)
el_volume_size = (
el_volume_size
if int(el_volume_size) > 0
else constants.VOLUME_SIZE[network_name]["ethereumjs_volume_size"]
)
cl_client_name = service_name.split("-")[3] cl_client_name = service_name.split("-")[3]
config = get_config( config = get_config(
...@@ -253,29 +228,36 @@ def get_config( ...@@ -253,29 +228,36 @@ def get_config(
persistent_key="data-{0}".format(service_name), persistent_key="data-{0}".format(service_name),
size=el_volume_size, size=el_volume_size,
) )
return ServiceConfig(
image=image, config_args = {
ports=used_ports, "image": image,
public_ports=public_ports, "ports": used_ports,
cmd=cmd, "public_ports": public_ports,
files=files, "cmd": cmd,
entrypoint=ENTRYPOINT_ARGS, "files": files,
private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "entrypoint": ENTRYPOINT_ARGS,
min_cpu=el_min_cpu, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
max_cpu=el_max_cpu, "env_vars": extra_env_vars,
min_memory=el_min_mem, "labels": shared_utils.label_maker(
max_memory=el_max_mem,
env_vars=extra_env_vars,
labels=shared_utils.label_maker(
constants.EL_TYPE.ethereumjs, constants.EL_TYPE.ethereumjs,
constants.CLIENT_TYPES.el, constants.CLIENT_TYPES.el,
image, image,
cl_client_name, cl_client_name,
extra_labels, extra_labels,
), ),
tolerations=tolerations, "tolerations": tolerations,
node_selectors=node_selectors, "node_selectors": node_selectors,
) }
if el_min_cpu > 0:
config_args["min_cpu"] = el_min_cpu
if el_max_cpu > 0:
config_args["max_cpu"] = el_max_cpu
if el_min_mem > 0:
config_args["min_memory"] = el_min_mem
if el_max_mem > 0:
config_args["max_memory"] = el_max_mem
return ServiceConfig(**config_args)
def new_ethereumjs_launcher(el_cl_genesis_data, jwt_file, network): def new_ethereumjs_launcher(el_cl_genesis_data, jwt_file, network):
......
...@@ -15,10 +15,6 @@ DISCOVERY_PORT_NUM = 30303 ...@@ -15,10 +15,6 @@ DISCOVERY_PORT_NUM = 30303
ENGINE_RPC_PORT_NUM = 8551 ENGINE_RPC_PORT_NUM = 8551
METRICS_PORT_NUM = 9001 METRICS_PORT_NUM = 9001
# The min/max CPU/memory that the execution node can use
EXECUTION_MIN_CPU = 300
EXECUTION_MIN_MEMORY = 512
# TODO(old) Scale this dynamically based on CPUs available and Geth nodes mining # TODO(old) Scale this dynamically based on CPUs available and Geth nodes mining
NUM_MINING_THREADS = 1 NUM_MINING_THREADS = 1
...@@ -68,27 +64,6 @@ def launch( ...@@ -68,27 +64,6 @@ def launch(
participant_log_level, global_log_level, VERBOSITY_LEVELS participant_log_level, global_log_level, VERBOSITY_LEVELS
) )
network_name = shared_utils.get_network_name(launcher.network)
el_min_cpu = int(el_min_cpu) if int(el_min_cpu) > 0 else EXECUTION_MIN_CPU
el_max_cpu = (
int(el_max_cpu)
if int(el_max_cpu) > 0
else constants.RAM_CPU_OVERRIDES[network_name]["geth_max_cpu"]
)
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 constants.RAM_CPU_OVERRIDES[network_name]["geth_max_mem"]
)
el_volume_size = (
el_volume_size
if int(el_volume_size) > 0
else constants.VOLUME_SIZE[network_name]["geth_volume_size"]
)
cl_client_name = service_name.split("-")[3] cl_client_name = service_name.split("-")[3]
config = get_config( config = get_config(
...@@ -348,29 +323,35 @@ def get_config( ...@@ -348,29 +323,35 @@ def get_config(
persistent_key="data-{0}".format(service_name), persistent_key="data-{0}".format(service_name),
size=el_volume_size, size=el_volume_size,
) )
return ServiceConfig( config_args = {
image=image, "image": image,
ports=used_ports, "ports": used_ports,
public_ports=public_ports, "public_ports": public_ports,
cmd=[command_str], "cmd": [command_str],
files=files, "files": files,
entrypoint=ENTRYPOINT_ARGS, "entrypoint": ENTRYPOINT_ARGS,
private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
min_cpu=el_min_cpu, "env_vars": extra_env_vars,
max_cpu=el_max_cpu, "labels": shared_utils.label_maker(
min_memory=el_min_mem,
max_memory=el_max_mem,
env_vars=extra_env_vars,
labels=shared_utils.label_maker(
constants.EL_TYPE.geth, constants.EL_TYPE.geth,
constants.CLIENT_TYPES.el, constants.CLIENT_TYPES.el,
image, image,
cl_client_name, cl_client_name,
extra_labels, extra_labels,
), ),
tolerations=tolerations, "tolerations": tolerations,
node_selectors=node_selectors, "node_selectors": node_selectors,
) }
if el_min_cpu > 0:
config_args["min_cpu"] = el_min_cpu
if el_max_cpu > 0:
config_args["max_cpu"] = el_max_cpu
if el_min_mem > 0:
config_args["min_memory"] = el_min_mem
if el_max_mem > 0:
config_args["max_memory"] = el_max_mem
return ServiceConfig(**config_args)
def new_geth_launcher( def new_geth_launcher(
......
...@@ -17,10 +17,6 @@ DISCOVERY_PORT_NUM = 30303 ...@@ -17,10 +17,6 @@ DISCOVERY_PORT_NUM = 30303
ENGINE_RPC_PORT_NUM = 8551 ENGINE_RPC_PORT_NUM = 8551
METRICS_PORT_NUM = 9001 METRICS_PORT_NUM = 9001
# The min/max CPU/memory that the execution node can use
EXECUTION_MIN_CPU = 100
EXECUTION_MIN_MEMORY = 512
VERBOSITY_LEVELS = { VERBOSITY_LEVELS = {
constants.GLOBAL_LOG_LEVEL.error: "ERROR", constants.GLOBAL_LOG_LEVEL.error: "ERROR",
constants.GLOBAL_LOG_LEVEL.warn: "WARN", constants.GLOBAL_LOG_LEVEL.warn: "WARN",
...@@ -56,27 +52,6 @@ def launch( ...@@ -56,27 +52,6 @@ def launch(
participant_log_level, global_log_level, VERBOSITY_LEVELS participant_log_level, global_log_level, VERBOSITY_LEVELS
) )
network_name = shared_utils.get_network_name(launcher.network)
el_min_cpu = int(el_min_cpu) if int(el_min_cpu) > 0 else EXECUTION_MIN_CPU
el_max_cpu = (
int(el_max_cpu)
if int(el_max_cpu) > 0
else constants.RAM_CPU_OVERRIDES[network_name]["nethermind_max_cpu"]
)
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 constants.RAM_CPU_OVERRIDES[network_name]["nethermind_max_mem"]
)
el_volume_size = (
el_volume_size
if int(el_volume_size) > 0
else constants.VOLUME_SIZE[network_name]["nethermind_volume_size"]
)
cl_client_name = service_name.split("-")[3] cl_client_name = service_name.split("-")[3]
config = get_config( config = get_config(
...@@ -262,28 +237,34 @@ def get_config( ...@@ -262,28 +237,34 @@ def get_config(
size=el_volume_size, size=el_volume_size,
) )
return ServiceConfig( config_args = {
image=image, "image": image,
ports=used_ports, "ports": used_ports,
public_ports=public_ports, "public_ports": public_ports,
cmd=cmd, "cmd": cmd,
files=files, "files": files,
private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
min_cpu=el_min_cpu, "env_vars": extra_env_vars,
max_cpu=el_max_cpu, "labels": shared_utils.label_maker(
min_memory=el_min_mem,
max_memory=el_max_mem,
env_vars=extra_env_vars,
labels=shared_utils.label_maker(
constants.EL_TYPE.nethermind, constants.EL_TYPE.nethermind,
constants.CLIENT_TYPES.el, constants.CLIENT_TYPES.el,
image, image,
cl_client_name, cl_client_name,
extra_labels, extra_labels,
), ),
tolerations=tolerations, "tolerations": tolerations,
node_selectors=node_selectors, "node_selectors": node_selectors,
) }
if el_min_cpu > 0:
config_args["min_cpu"] = el_min_cpu
if el_max_cpu > 0:
config_args["max_cpu"] = el_max_cpu
if el_min_mem > 0:
config_args["min_memory"] = el_min_mem
if el_max_mem > 0:
config_args["max_memory"] = el_max_mem
return ServiceConfig(**config_args)
def new_nethermind_launcher(el_cl_genesis_data, jwt_file, network): def new_nethermind_launcher(el_cl_genesis_data, jwt_file, network):
......
...@@ -11,10 +11,6 @@ DISCOVERY_PORT_NUM = 30303 ...@@ -11,10 +11,6 @@ DISCOVERY_PORT_NUM = 30303
ENGINE_RPC_PORT_NUM = 8551 ENGINE_RPC_PORT_NUM = 8551
METRICS_PORT_NUM = 9001 METRICS_PORT_NUM = 9001
# The min/max CPU/memory that the execution node can use
EXECUTION_MIN_CPU = 100
EXECUTION_MIN_MEMORY = 256
# Paths # Paths
METRICS_PATH = "/metrics" METRICS_PATH = "/metrics"
...@@ -57,27 +53,6 @@ def launch( ...@@ -57,27 +53,6 @@ def launch(
participant_log_level, global_log_level, VERBOSITY_LEVELS participant_log_level, global_log_level, VERBOSITY_LEVELS
) )
network_name = shared_utils.get_network_name(launcher.network)
el_min_cpu = int(el_min_cpu) if int(el_min_cpu) > 0 else EXECUTION_MIN_CPU
el_max_cpu = (
int(el_max_cpu)
if int(el_max_cpu) > 0
else constants.RAM_CPU_OVERRIDES[network_name]["nimbus_eth1_max_cpu"]
)
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 constants.RAM_CPU_OVERRIDES[network_name]["nimbus_eth1_max_mem"]
)
el_volume_size = (
el_volume_size
if int(el_volume_size) > 0
else constants.VOLUME_SIZE[network_name]["nimbus_eth1_volume_size"]
)
cl_client_name = service_name.split("-")[3] cl_client_name = service_name.split("-")[3]
config = get_config( config = get_config(
...@@ -248,28 +223,34 @@ def get_config( ...@@ -248,28 +223,34 @@ def get_config(
size=el_volume_size, size=el_volume_size,
) )
return ServiceConfig( config_args = {
image=image, "image": image,
ports=used_ports, "ports": used_ports,
public_ports=public_ports, "public_ports": public_ports,
cmd=cmd, "cmd": cmd,
files=files, "files": files,
private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
min_cpu=el_min_cpu, "env_vars": extra_env_vars,
max_cpu=el_max_cpu, "labels": shared_utils.label_maker(
min_memory=el_min_mem,
max_memory=el_max_mem,
env_vars=extra_env_vars,
labels=shared_utils.label_maker(
constants.EL_TYPE.nimbus, constants.EL_TYPE.nimbus,
constants.CLIENT_TYPES.el, constants.CLIENT_TYPES.el,
image, image,
cl_client_name, cl_client_name,
extra_labels, extra_labels,
), ),
tolerations=tolerations, "tolerations": tolerations,
node_selectors=node_selectors, "node_selectors": node_selectors,
) }
if el_min_cpu > 0:
config_args["min_cpu"] = el_min_cpu
if el_max_cpu > 0:
config_args["max_cpu"] = el_max_cpu
if el_min_mem > 0:
config_args["min_memory"] = el_min_mem
if el_max_mem > 0:
config_args["max_memory"] = el_max_mem
return ServiceConfig(**config_args)
def new_nimbus_launcher(el_cl_genesis_data, jwt_file, network): def new_nimbus_launcher(el_cl_genesis_data, jwt_file, network):
......
...@@ -13,10 +13,6 @@ DISCOVERY_PORT_NUM = 30303 ...@@ -13,10 +13,6 @@ DISCOVERY_PORT_NUM = 30303
ENGINE_RPC_PORT_NUM = 8551 ENGINE_RPC_PORT_NUM = 8551
METRICS_PORT_NUM = 9001 METRICS_PORT_NUM = 9001
# The min/max CPU/memory that the execution node can use
EXECUTION_MIN_CPU = 100
EXECUTION_MIN_MEMORY = 256
# Paths # Paths
METRICS_PATH = "/metrics" METRICS_PATH = "/metrics"
...@@ -61,27 +57,6 @@ def launch( ...@@ -61,27 +57,6 @@ def launch(
participant_log_level, global_log_level, VERBOSITY_LEVELS participant_log_level, global_log_level, VERBOSITY_LEVELS
) )
network_name = shared_utils.get_network_name(launcher.network)
el_min_cpu = int(el_min_cpu) if int(el_min_cpu) > 0 else EXECUTION_MIN_CPU
el_max_cpu = (
int(el_max_cpu)
if int(el_max_cpu) > 0
else constants.RAM_CPU_OVERRIDES[network_name]["reth_max_cpu"]
)
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 constants.RAM_CPU_OVERRIDES[network_name]["reth_max_mem"]
)
el_volume_size = (
el_volume_size
if int(el_volume_size) > 0
else constants.VOLUME_SIZE[network_name]["reth_volume_size"]
)
cl_client_name = service_name.split("-")[3] cl_client_name = service_name.split("-")[3]
config = get_config( config = get_config(
...@@ -266,29 +241,35 @@ def get_config( ...@@ -266,29 +241,35 @@ def get_config(
mev_rs_builder.MEV_BUILDER_MOUNT_DIRPATH_ON_SERVICE mev_rs_builder.MEV_BUILDER_MOUNT_DIRPATH_ON_SERVICE
] = mev_rs_builder.MEV_BUILDER_FILES_ARTIFACT_NAME ] = mev_rs_builder.MEV_BUILDER_FILES_ARTIFACT_NAME
return ServiceConfig( config_args = {
image=image, "image": image,
ports=used_ports, "ports": used_ports,
public_ports=public_ports, "public_ports": public_ports,
cmd=[cmd_str], "cmd": [cmd_str],
files=files, "files": files,
entrypoint=ENTRYPOINT_ARGS, "entrypoint": ENTRYPOINT_ARGS,
private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
min_cpu=el_min_cpu, "env_vars": extra_env_vars,
max_cpu=el_max_cpu, "labels": shared_utils.label_maker(
min_memory=el_min_mem, constants.EL_TYPE.geth,
max_memory=el_max_mem,
env_vars=extra_env_vars,
labels=shared_utils.label_maker(
constants.EL_TYPE.reth,
constants.CLIENT_TYPES.el, constants.CLIENT_TYPES.el,
image, image,
cl_client_name, cl_client_name,
extra_labels, extra_labels,
), ),
tolerations=tolerations, "tolerations": tolerations,
node_selectors=node_selectors, "node_selectors": node_selectors,
) }
if el_min_cpu > 0:
config_args["min_cpu"] = el_min_cpu
if el_max_cpu > 0:
config_args["max_cpu"] = el_max_cpu
if el_min_mem > 0:
config_args["min_memory"] = el_min_mem
if el_max_mem > 0:
config_args["max_memory"] = el_max_mem
return ServiceConfig(**config_args)
def new_reth_launcher(el_cl_genesis_data, jwt_file, network, builder=False): def new_reth_launcher(el_cl_genesis_data, jwt_file, network, builder=False):
......
EL_TYPE = struct( EL_TYPE = struct(
geth_builder="geth-builder",
geth="geth", geth="geth",
erigon="erigon", erigon="erigon",
nethermind="nethermind", nethermind="nethermind",
...@@ -250,174 +249,3 @@ VOLUME_SIZE = { ...@@ -250,174 +249,3 @@ VOLUME_SIZE = {
"grandine_volume_size": 1000, # 1GB "grandine_volume_size": 1000, # 1GB
}, },
} }
RAM_CPU_OVERRIDES = {
"mainnet": {
"geth_max_mem": 16384, # 16GB
"geth_max_cpu": 4000, # 4 cores
"erigon_max_mem": 16384, # 16GB
"erigon_max_cpu": 4000, # 4 cores
"nethermind_max_mem": 16384, # 16GB
"nethermind_max_cpu": 4000, # 4 cores
"besu_max_mem": 16384, # 16GB
"besu_max_cpu": 4000, # 4 cores
"reth_max_mem": 16384, # 16GB
"reth_max_cpu": 4000, # 4 cores
"ethereumjs_max_mem": 16384, # 16GB
"ethereumjs_max_cpu": 4000, # 4 cores
"nimbus_eth1_max_mem": 16384, # 16GB
"nimbus_eth1_max_cpu": 4000, # 4 cores
"prysm_max_mem": 16384, # 16GB
"prysm_max_cpu": 4000, # 4 cores
"lighthouse_max_mem": 16384, # 16GB
"lighthouse_max_cpu": 4000, # 4 cores
"teku_max_mem": 16384, # 16GB
"teku_max_cpu": 4000, # 4 cores
"nimbus_max_mem": 16384, # 16GB
"nimbus_max_cpu": 4000, # 4 cores
"lodestar_max_mem": 16384, # 16GB
"lodestar_max_cpu": 4000, # 4 cores
"grandine_max_mem": 16384, # 16GB
"grandine_max_cpu": 4000, # 4 cores
},
"sepolia": {
"geth_max_mem": 4096, # 4GB
"geth_max_cpu": 1000, # 1 core
"erigon_max_mem": 4096, # 4GB
"erigon_max_cpu": 1000, # 1 core
"nethermind_max_mem": 4096, # 4GB
"nethermind_max_cpu": 1000, # 1 core
"besu_max_mem": 4096, # 4GB
"besu_max_cpu": 1000, # 1 core
"reth_max_mem": 4096, # 4GB
"reth_max_cpu": 1000, # 1 core
"ethereumjs_max_mem": 4096, # 4GB
"ethereumjs_max_cpu": 1000, # 1 core
"nimbus_eth1_max_mem": 4096, # 4GB
"nimbus_eth1_max_cpu": 1000, # 1 core
"prysm_max_mem": 4096, # 4GB
"prysm_max_cpu": 1000, # 1 core
"lighthouse_max_mem": 4096, # 4GB
"lighthouse_max_cpu": 1000, # 1 core
"teku_max_mem": 4096, # 4GB
"teku_max_cpu": 1000, # 1 core
"nimbus_max_mem": 4096, # 4GB
"nimbus_max_cpu": 1000, # 1 core
"lodestar_max_mem": 4096, # 4GB
"lodestar_max_cpu": 1000, # 1 core
"grandine_max_mem": 4096, # 4GB
"grandine_max_cpu": 1000, # 1 core
},
"holesky": {
"geth_max_mem": 8192, # 8GB
"geth_max_cpu": 2000, # 2 cores
"erigon_max_mem": 8192, # 8GB
"erigon_max_cpu": 2000, # 2 cores
"nethermind_max_mem": 8192, # 8GB
"nethermind_max_cpu": 2000, # 2 cores
"besu_max_mem": 8192, # 8GB
"besu_max_cpu": 2000, # 2 cores
"reth_max_mem": 8192, # 8GB
"reth_max_cpu": 2000, # 2 cores
"ethereumjs_max_mem": 8192, # 8GB
"ethereumjs_max_cpu": 2000, # 2 cores
"nimbus_eth1_max_mem": 8192, # 8GB
"nimbus_eth1_max_cpu": 2000, # 2 cores
"prysm_max_mem": 8192, # 8GB
"prysm_max_cpu": 2000, # 2 cores
"lighthouse_max_mem": 8192, # 8GB
"lighthouse_max_cpu": 2000, # 2 cores
"teku_max_mem": 8192, # 8GB
"teku_max_cpu": 2000, # 2 cores
"nimbus_max_mem": 8192, # 8GB
"nimbus_max_cpu": 2000, # 2 cores
"lodestar_max_mem": 8192, # 8GB
"lodestar_max_cpu": 2000, # 2 cores
"grandine_max_mem": 8192, # 8GB
"grandine_max_cpu": 2000, # 2 cores
},
"devnets": {
"geth_max_mem": 4096, # 4GB
"geth_max_cpu": 1000, # 1 core
"erigon_max_mem": 4096, # 4GB
"erigon_max_cpu": 1000, # 1 core
"nethermind_max_mem": 4096, # 4GB
"nethermind_max_cpu": 1000, # 1 core
"besu_max_mem": 4096, # 4GB
"besu_max_cpu": 1000, # 1 core
"reth_max_mem": 4096, # 4GB
"reth_max_cpu": 1000, # 1 core
"ethereumjs_max_mem": 4096, # 4GB
"ethereumjs_max_cpu": 1000, # 1 core
"nimbus_eth1_max_mem": 4096, # 4GB
"nimbus_eth1_max_cpu": 1000, # 1 core
"prysm_max_mem": 4096, # 4GB
"prysm_max_cpu": 1000, # 1 core
"lighthouse_max_mem": 4096, # 4GB
"lighthouse_max_cpu": 1000, # 1 core
"teku_max_mem": 4096, # 4GB
"teku_max_cpu": 1000, # 1 core
"nimbus_max_mem": 4096, # 4GB
"nimbus_max_cpu": 1000, # 1 core
"lodestar_max_mem": 4096, # 4GB
"lodestar_max_cpu": 1000, # 1 core
"grandine_max_mem": 4096, # 4GB
"grandine_max_cpu": 1000, # 1 core
},
"ephemery": {
"geth_max_mem": 1024, # 1GB
"geth_max_cpu": 1000, # 1 core
"erigon_max_mem": 1024, # 1GB
"erigon_max_cpu": 1000, # 1 core
"nethermind_max_mem": 1024, # 1GB
"nethermind_max_cpu": 1000, # 1 core
"besu_max_mem": 1024, # 1GB
"besu_max_cpu": 1000, # 1 core
"reth_max_mem": 1024, # 1GB
"reth_max_cpu": 1000, # 1 core
"ethereumjs_max_mem": 1024, # 1GB
"ethereumjs_max_cpu": 1000, # 1 core
"nimbus_eth1_max_mem": 1024, # 1GB
"nimbus_eth1_max_cpu": 1000, # 1 core
"prysm_max_mem": 1024, # 1GB
"prysm_max_cpu": 1000, # 1 core
"lighthouse_max_mem": 1024, # 1GB
"lighthouse_max_cpu": 1000, # 1 core
"teku_max_mem": 1024, # 1GB
"teku_max_cpu": 1000, # 1 core
"nimbus_max_mem": 1024, # 1GB
"nimbus_max_cpu": 1000, # 1 core
"lodestar_max_mem": 1024, # 1GB
"lodestar_max_cpu": 1000, # 1 core
"grandine_max_mem": 1024, # 1GB
"grandine_max_cpu": 1000, # 1 core
},
"kurtosis": {
"geth_max_mem": 1024, # 1GB
"geth_max_cpu": 1000, # 1 core
"erigon_max_mem": 1024, # 1GB
"erigon_max_cpu": 1000, # 1 core
"nethermind_max_mem": 2048, # 2GB
"nethermind_max_cpu": 1000, # 1 core
"besu_max_mem": 1024, # 1GB
"besu_max_cpu": 1000, # 1 core
"reth_max_mem": 1024, # 1GB
"reth_max_cpu": 1000, # 1 core
"ethereumjs_max_mem": 1024, # 1GB
"ethereumjs_max_cpu": 1000, # 1 core
"nimbus_eth1_max_mem": 1024, # 1GB
"nimbus_eth1_max_cpu": 1000, # 1 core
"prysm_max_mem": 1024, # 1GB
"prysm_max_cpu": 1000, # 1 core
"lighthouse_max_mem": 1024, # 1GB
"lighthouse_max_cpu": 1000, # 1 core
"teku_max_mem": 2048, # 2GB
"teku_max_cpu": 1000, # 1 core
"nimbus_max_mem": 1024, # 1GB
"nimbus_max_cpu": 1000, # 1 core
"lodestar_max_mem": 2048, # 2GB
"lodestar_max_cpu": 1000, # 1 core
"grandine_max_mem": 2048, # 2GB
"grandine_max_cpu": 1000, # 1 core
},
}
...@@ -1119,7 +1119,7 @@ def enrich_mev_extra_params(parsed_arguments_dict, mev_prefix, mev_port, mev_typ ...@@ -1119,7 +1119,7 @@ def enrich_mev_extra_params(parsed_arguments_dict, mev_prefix, mev_port, mev_typ
) )
if mev_type == constants.FLASHBOTS_MEV_TYPE: if mev_type == constants.FLASHBOTS_MEV_TYPE:
mev_participant = default_participant() mev_participant = default_participant()
mev_participant["el_type"] = "geth-builder" mev_participant["el_type"] = "geth"
mev_participant.update( mev_participant.update(
{ {
"el_image": parsed_arguments_dict["mev_params"]["mev_builder_image"], "el_image": parsed_arguments_dict["mev_params"]["mev_builder_image"],
......
...@@ -343,7 +343,6 @@ def launch_participant_network( ...@@ -343,7 +343,6 @@ def launch_participant_network(
service_name="vc-{0}".format(full_name), service_name="vc-{0}".format(full_name),
vc_type=vc_type, vc_type=vc_type,
image=participant.vc_image, image=participant.vc_image,
participant_log_level=participant.vc_log_level,
global_log_level=global_log_level, global_log_level=global_log_level,
cl_context=cl_context, cl_context=cl_context,
el_context=el_context, el_context=el_context,
...@@ -351,20 +350,11 @@ def launch_participant_network( ...@@ -351,20 +350,11 @@ def launch_participant_network(
snooper_enabled=participant.snooper_enabled, snooper_enabled=participant.snooper_enabled,
snooper_beacon_context=snooper_beacon_context, snooper_beacon_context=snooper_beacon_context,
node_keystore_files=vc_keystores, node_keystore_files=vc_keystores,
vc_min_cpu=participant.vc_min_cpu, participant=participant,
vc_max_cpu=participant.vc_max_cpu,
vc_min_mem=participant.vc_min_mem,
vc_max_mem=participant.vc_max_mem,
extra_params=participant.vc_extra_params,
extra_env_vars=participant.vc_extra_env_vars,
extra_labels=participant.vc_extra_labels,
prysm_password_relative_filepath=prysm_password_relative_filepath, prysm_password_relative_filepath=prysm_password_relative_filepath,
prysm_password_artifact_uuid=prysm_password_artifact_uuid, prysm_password_artifact_uuid=prysm_password_artifact_uuid,
vc_tolerations=participant.vc_tolerations,
participant_tolerations=participant.tolerations,
global_tolerations=global_tolerations, global_tolerations=global_tolerations,
node_selectors=node_selectors, node_selectors=node_selectors,
keymanager_enabled=participant.keymanager_enabled,
preset=network_params.preset, preset=network_params.preset,
network=network_params.network, network=network_params.network,
electra_fork_epoch=network_params.electra_fork_epoch, electra_fork_epoch=network_params.electra_fork_epoch,
......
...@@ -318,3 +318,18 @@ def get_additional_service_standard_public_port( ...@@ -318,3 +318,18 @@ def get_additional_service_standard_public_port(
) )
public_ports = get_port_specs({port_id: public_ports_for_component[port_index]}) public_ports = get_port_specs({port_id: public_ports_for_component[port_index]})
return public_ports return public_ports
def get_cpu_mem_resource_limits(
min_cpu, max_cpu, min_mem, max_mem, volume_size, network_name, client_type
):
min_cpu = int(min_cpu) if int(min_cpu) > 0 else 0
max_cpu = int(max_cpu) if int(max_cpu) > 0 else 0
min_mem = int(min_mem) if int(min_mem) > 0 else 0
max_mem = int(max_mem) if int(max_mem) > 0 else 0
volume_size = (
int(volume_size)
if int(volume_size) > 0
else constants.VOLUME_SIZE[network_name][client_type + "_volume_size"]
)
return min_cpu, max_cpu, min_mem, max_mem, volume_size
...@@ -118,24 +118,34 @@ def get_config( ...@@ -118,24 +118,34 @@ def get_config(
shared_utils.get_port_specs(public_keymanager_port_assignment) shared_utils.get_port_specs(public_keymanager_port_assignment)
) )
return ServiceConfig( config_args = {
image=image, "image": image,
ports=ports, "ports": ports,
public_ports=public_ports, "public_ports": public_ports,
cmd=cmd, "cmd": cmd,
env_vars=env, "files": files,
files=files, "env_vars": env,
min_cpu=vc_min_cpu, "labels": shared_utils.label_maker(
max_cpu=vc_max_cpu, constants.CL_TYPE.lighthouse,
min_memory=vc_min_mem,
max_memory=vc_max_mem,
labels=shared_utils.label_maker(
constants.VC_TYPE.lighthouse,
constants.CLIENT_TYPES.validator, constants.CLIENT_TYPES.validator,
image, image,
cl_context.client_name, cl_context.client_name,
extra_labels, extra_labels,
), ),
tolerations=tolerations, "tolerations": tolerations,
node_selectors=node_selectors, "node_selectors": node_selectors,
) }
if vc_min_cpu > 0:
config_args["min_cpu"] = vc_min_cpu
if vc_max_cpu > 0:
config_args["max_cpu"] = vc_max_cpu
if vc_min_mem > 0:
config_args["min_memory"] = vc_min_mem
if vc_max_mem > 0:
config_args["max_memory"] = vc_max_mem
return ServiceConfig(**config_args)
...@@ -117,24 +117,34 @@ def get_config( ...@@ -117,24 +117,34 @@ def get_config(
if preset == "minimal": if preset == "minimal":
extra_env_vars["LODESTAR_PRESET"] = "minimal" extra_env_vars["LODESTAR_PRESET"] = "minimal"
return ServiceConfig( config_args = {
image=image, "image": image,
ports=ports, "ports": ports,
public_ports=public_ports, "public_ports": public_ports,
cmd=cmd, "cmd": cmd,
env_vars=extra_env_vars, "files": files,
files=files, "env_vars": extra_env_vars,
min_cpu=vc_min_cpu, "labels": shared_utils.label_maker(
max_cpu=vc_max_cpu, constants.CL_TYPE.lodestar,
min_memory=vc_min_mem,
max_memory=vc_max_mem,
labels=shared_utils.label_maker(
constants.VC_TYPE.lodestar,
constants.CLIENT_TYPES.validator, constants.CLIENT_TYPES.validator,
image, image,
cl_context.client_name, cl_context.client_name,
extra_labels, extra_labels,
), ),
tolerations=tolerations, "tolerations": tolerations,
node_selectors=node_selectors, "node_selectors": node_selectors,
) }
if vc_min_cpu > 0:
config_args["min_cpu"] = vc_min_cpu
if vc_max_cpu > 0:
config_args["max_cpu"] = vc_max_cpu
if vc_min_mem > 0:
config_args["min_memory"] = vc_min_mem
if vc_max_mem > 0:
config_args["max_memory"] = vc_max_mem
return ServiceConfig(**config_args)
...@@ -90,25 +90,35 @@ def get_config( ...@@ -90,25 +90,35 @@ def get_config(
shared_utils.get_port_specs(public_keymanager_port_assignment) shared_utils.get_port_specs(public_keymanager_port_assignment)
) )
return ServiceConfig( config_args = {
image=image, "image": image,
ports=ports, "ports": ports,
public_ports=public_ports, "public_ports": public_ports,
cmd=cmd, "cmd": cmd,
env_vars=extra_env_vars, "files": files,
files=files, "env_vars": extra_env_vars,
min_cpu=vc_min_cpu, "labels": shared_utils.label_maker(
max_cpu=vc_max_cpu, constants.CL_TYPE.nimbus,
min_memory=vc_min_mem,
max_memory=vc_max_mem,
labels=shared_utils.label_maker(
constants.VC_TYPE.nimbus,
constants.CLIENT_TYPES.validator, constants.CLIENT_TYPES.validator,
image, image,
cl_context.client_name, cl_context.client_name,
extra_labels, extra_labels,
), ),
user=User(uid=0, gid=0), "tolerations": tolerations,
tolerations=tolerations, "node_selectors": node_selectors,
node_selectors=node_selectors, "user": User(uid=0, gid=0),
) }
if vc_min_cpu > 0:
config_args["min_cpu"] = vc_min_cpu
if vc_max_cpu > 0:
config_args["max_cpu"] = vc_max_cpu
if vc_min_mem > 0:
config_args["min_memory"] = vc_min_mem
if vc_max_mem > 0:
config_args["max_memory"] = vc_max_mem
return ServiceConfig(**config_args)
...@@ -110,24 +110,34 @@ def get_config( ...@@ -110,24 +110,34 @@ def get_config(
) )
public_ports.update(shared_utils.get_port_specs(public_gprc_port_assignment)) public_ports.update(shared_utils.get_port_specs(public_gprc_port_assignment))
return ServiceConfig( config_args = {
image=image, "image": image,
ports=ports, "ports": ports,
public_ports=public_ports, "public_ports": public_ports,
cmd=cmd, "cmd": cmd,
env_vars=extra_env_vars, "files": files,
files=files, "env_vars": extra_env_vars,
min_cpu=vc_min_cpu, "labels": shared_utils.label_maker(
max_cpu=vc_max_cpu, constants.CL_TYPE.prysm,
min_memory=vc_min_mem,
max_memory=vc_max_mem,
labels=shared_utils.label_maker(
constants.VC_TYPE.prysm,
constants.CLIENT_TYPES.validator, constants.CLIENT_TYPES.validator,
image, image,
cl_context.client_name, cl_context.client_name,
extra_labels, extra_labels,
), ),
tolerations=tolerations, "tolerations": tolerations,
node_selectors=node_selectors, "node_selectors": node_selectors,
) }
if vc_min_cpu > 0:
config_args["min_cpu"] = vc_min_cpu
if vc_max_cpu > 0:
config_args["max_cpu"] = vc_max_cpu
if vc_min_mem > 0:
config_args["min_memory"] = vc_min_mem
if vc_max_mem > 0:
config_args["max_memory"] = vc_max_mem
return ServiceConfig(**config_args)
...@@ -101,24 +101,34 @@ def get_config( ...@@ -101,24 +101,34 @@ def get_config(
shared_utils.get_port_specs(public_keymanager_port_assignment) shared_utils.get_port_specs(public_keymanager_port_assignment)
) )
return ServiceConfig( config_args = {
image=image, "image": image,
ports=ports, "ports": ports,
public_ports=public_ports, "public_ports": public_ports,
cmd=cmd, "cmd": cmd,
env_vars=extra_env_vars, "files": files,
files=files, "env_vars": extra_env_vars,
min_cpu=vc_min_cpu, "labels": shared_utils.label_maker(
max_cpu=vc_max_cpu, constants.CL_TYPE.teku,
min_memory=vc_min_mem,
max_memory=vc_max_mem,
labels=shared_utils.label_maker(
constants.VC_TYPE.teku,
constants.CLIENT_TYPES.validator, constants.CLIENT_TYPES.validator,
image, image,
cl_context.client_name, cl_context.client_name,
extra_labels, extra_labels,
), ),
tolerations=tolerations, "tolerations": tolerations,
node_selectors=node_selectors, "node_selectors": node_selectors,
) }
if vc_min_cpu > 0:
config_args["min_cpu"] = vc_min_cpu
if vc_max_cpu > 0:
config_args["max_cpu"] = vc_max_cpu
if vc_min_mem > 0:
config_args["min_memory"] = vc_min_mem
if vc_max_mem > 0:
config_args["max_memory"] = vc_max_mem
return ServiceConfig(**config_args)
...@@ -9,12 +9,7 @@ nimbus = import_module("./nimbus.star") ...@@ -9,12 +9,7 @@ nimbus = import_module("./nimbus.star")
prysm = import_module("./prysm.star") prysm = import_module("./prysm.star")
teku = import_module("./teku.star") teku = import_module("./teku.star")
vc_shared = import_module("./shared.star") vc_shared = import_module("./shared.star")
shared_utils = import_module("../shared_utils/shared_utils.star")
# The defaults for min/max CPU/memory that the validator client can use
MIN_CPU = 50
MAX_CPU = 300
MIN_MEMORY = 128
MAX_MEMORY = 512
def launch( def launch(
...@@ -24,7 +19,6 @@ def launch( ...@@ -24,7 +19,6 @@ def launch(
service_name, service_name,
vc_type, vc_type,
image, image,
participant_log_level,
global_log_level, global_log_level,
cl_context, cl_context,
el_context, el_context,
...@@ -32,20 +26,11 @@ def launch( ...@@ -32,20 +26,11 @@ def launch(
snooper_enabled, snooper_enabled,
snooper_beacon_context, snooper_beacon_context,
node_keystore_files, node_keystore_files,
vc_min_cpu, participant,
vc_max_cpu,
vc_min_mem,
vc_max_mem,
extra_params,
extra_env_vars,
extra_labels,
prysm_password_relative_filepath, prysm_password_relative_filepath,
prysm_password_artifact_uuid, prysm_password_artifact_uuid,
vc_tolerations,
participant_tolerations,
global_tolerations, global_tolerations,
node_selectors, node_selectors,
keymanager_enabled,
preset, preset,
network, # TODO: remove when deneb rebase is done network, # TODO: remove when deneb rebase is done
electra_fork_epoch, # TODO: remove when deneb rebase is done electra_fork_epoch, # TODO: remove when deneb rebase is done
...@@ -56,7 +41,7 @@ def launch( ...@@ -56,7 +41,7 @@ def launch(
return None return None
tolerations = input_parser.get_client_tolerations( tolerations = input_parser.get_client_tolerations(
vc_tolerations, participant_tolerations, global_tolerations participant.vc_tolerations, participant.tolerations, global_tolerations
) )
if snooper_enabled: if snooper_enabled:
...@@ -68,11 +53,27 @@ def launch( ...@@ -68,11 +53,27 @@ def launch(
beacon_http_url = "{0}".format( beacon_http_url = "{0}".format(
cl_context.beacon_http_url, cl_context.beacon_http_url,
) )
vc_min_cpu = int(vc_min_cpu) if int(vc_min_cpu) > 0 else MIN_CPU
vc_max_cpu = int(vc_max_cpu) if int(vc_max_cpu) > 0 else MAX_CPU
vc_min_mem = int(vc_min_mem) if int(vc_min_mem) > 0 else MIN_MEMORY
vc_max_mem = int(vc_max_mem) if int(vc_max_mem) > 0 else MAX_MEMORY
(
vc_min_cpu,
vc_max_cpu,
vc_min_mem,
vc_max_mem,
_,
) = shared_utils.get_cpu_mem_resource_limits(
participant.vc_min_cpu,
participant.vc_max_cpu,
participant.vc_min_mem,
participant.vc_max_mem,
0,
network,
vc_type,
)
extra_params = participant.vc_extra_params
extra_env_vars = participant.vc_extra_env_vars
extra_labels = participant.vc_extra_labels
participant_log_level = participant.vc_log_level
keymanager_enabled = participant.keymanager_enabled
if vc_type == constants.VC_TYPE.lighthouse: if vc_type == constants.VC_TYPE.lighthouse:
config = lighthouse.get_config( config = lighthouse.get_config(
el_cl_genesis_data=launcher.el_cl_genesis_data, el_cl_genesis_data=launcher.el_cl_genesis_data,
......
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