in modules/python/clusterloader2/network-load/network_load.py [0:0]
def configure_clusterloader2(
override_file,
operation_timeout,
provider,
deployment_recreation_count,
cpu_per_node,
node_count,
fortio_servers_per_node,
fortio_clients_per_node,
fortio_client_queries_per_second,
fortio_client_connections,
fortio_namespaces,
fortio_deployments_per_namespace,
apply_fqdn_cnp):
# calculate CPU request per Pod based on pods/node and node CPU capacity
# Different cloud has different reserved values and number of daemonsets
# Using the same percentage will lead to incorrect nodes number as the number of nodes grow
# For AWS, see: https://github.com/awslabs/amazon-eks-ami/blob/main/templates/al2/runtime/bootstrap.sh#L290
# For Azure, see: https://learn.microsoft.com/en-us/azure/aks/node-resource-reservations#cpu-reservations
pods_per_node = fortio_servers_per_node + fortio_clients_per_node
capacity = CPU_CAPACITY[provider]
cpu_request = (cpu_per_node * 1000 * capacity) // pods_per_node
cpu_request = max(cpu_request, CPU_REQUEST_LIMIT_MILLI)
with open(override_file, 'w', encoding='utf-8') as file:
# generic config
file.write("CL2_GROUP_NAME: cilium-acns-network-load\n")
file.write(f"CL2_OPERATION_TIMEOUT: {operation_timeout}\n")
file.write("CL2_API_SERVER_CALLS_PER_SECOND: 100\n")
# repetition config
file.write(f"CL2_DEPLOYMENT_RECREATION_COUNT: {deployment_recreation_count}\n")
# scale logistics
# file.write(f"CL2_NODES_PER_STEP: {node_per_step}\n")
file.write("CL2_POD_STARTUP_LATENCY_THRESHOLD: 3m\n")
# topology config
file.write(f"CL2_NODES: {node_count}\n")
file.write(f"CL2_FORTIO_SERVERS_PER_NODE: {fortio_servers_per_node}\n")
file.write(f"CL2_FORTIO_CLIENTS_PER_NODE: {fortio_clients_per_node}\n")
file.write(f"CL2_FORTIO_CLIENT_QUERIES_PER_SECOND: {fortio_client_queries_per_second}\n")
file.write(f"CL2_FORTIO_CLIENT_CONNECTIONS: {fortio_client_connections}\n")
file.write(f"CL2_FORTIO_NAMESPACES: {fortio_namespaces}\n")
file.write(f"CL2_FORTIO_DEPLOYMENTS_PER_NAMESPACE: {fortio_deployments_per_namespace}\n")
file.write("CL2_FORTIO_POD_CPU: 10\n")
file.write("CL2_FORTIO_POD_MEMORY: 50\n")
# other test toggles
# creates Hubble DNS metrics
file.write(f"CL2_APPLY_FQDN_CNP: {apply_fqdn_cnp}\n")
# prometheus scrape config
file.write("CL2_CILIUM_METRICS_ENABLED: true\n")
file.write("CL2_PROMETHEUS_SCRAPE_CILIUM_OPERATOR: true\n")
file.write("CL2_PROMETHEUS_SCRAPE_CILIUM_AGENT: true\n")
file.write("CL2_PROMETHEUS_SCRAPE_CILIUM_AGENT_HUBBLE: true\n")
# prometheus server config
file.write("CL2_PROMETHEUS_TOLERATE_MASTER: true\n")
file.write("CL2_PROMETHEUS_MEMORY_LIMIT_FACTOR: 30.0\n")
file.write("CL2_PROMETHEUS_MEMORY_SCALE_FACTOR: 30.0\n")
file.write("CL2_PROMETHEUS_NODE_SELECTOR: \"prometheus: \\\"true\\\"\"\n")
with open(override_file, 'r', encoding='utf-8') as file:
print(f"Content of file {override_file}:\n{file.read()}")
file.close()