diff --git a/kraken/application_outage/actions.py b/kraken/application_outage/actions.py index 71844e8a..bc66fb37 100644 --- a/kraken/application_outage/actions.py +++ b/kraken/application_outage/actions.py @@ -6,6 +6,7 @@ from jinja2 import Template import kraken.invoke.command as runcommand from krkn_lib.telemetry import KrknTelemetry from krkn_lib.models.telemetry import ScenarioTelemetry +from krkn_lib.utils.functions import get_yaml_item_value # Reads the scenario config, applies and deletes a network policy to # block the traffic for the specified duration @@ -23,10 +24,18 @@ def run(scenarios_list, config, wait_duration, telemetry: KrknTelemetry) -> (lis with open(app_outage_config, "r") as f: app_outage_config_yaml = yaml.full_load(f) scenario_config = app_outage_config_yaml["application_outage"] - pod_selector = scenario_config.get("pod_selector", "{}") - traffic_type = scenario_config.get("block", "[Ingress, Egress]") - namespace = scenario_config.get("namespace", "") - duration = scenario_config.get("duration", 60) + pod_selector = get_yaml_item_value( + scenario_config, "pod_selector", "{}" + ) + traffic_type = get_yaml_item_value( + scenario_config, "block", "[Ingress, Egress]" + ) + namespace = get_yaml_item_value( + scenario_config, "namespace", "" + ) + duration = get_yaml_item_value( + scenario_config, "duration", 60 + ) start_time = int(time.time()) diff --git a/kraken/managedcluster_scenarios/run.py b/kraken/managedcluster_scenarios/run.py index 17d0de9b..eb6a4f1d 100644 --- a/kraken/managedcluster_scenarios/run.py +++ b/kraken/managedcluster_scenarios/run.py @@ -5,6 +5,7 @@ from kraken.managedcluster_scenarios.managedcluster_scenarios import managedclus import kraken.managedcluster_scenarios.common_managedcluster_functions as common_managedcluster_functions import kraken.cerberus.setup as cerberus from krkn_lib.k8s import KrknKubernetes +from krkn_lib.utils.functions import get_yaml_item_value # Get the managedcluster scenarios object of specfied cloud type # krkn_lib @@ -34,11 +35,19 @@ def run(scenarios_list, config, wait_duration, kubecli: KrknKubernetes): # krkn_lib def inject_managedcluster_scenario(action, managedcluster_scenario, managedcluster_scenario_object, kubecli: KrknKubernetes): # Get the managedcluster scenario configurations - run_kill_count = managedcluster_scenario.get("runs", 1) - instance_kill_count = managedcluster_scenario.get("instance_count", 1) - managedcluster_name = managedcluster_scenario.get("managedcluster_name", "") - label_selector = managedcluster_scenario.get("label_selector", "") - timeout = managedcluster_scenario.get("timeout", 120) + run_kill_count = get_yaml_item_value( + managedcluster_scenario, "runs", 1 + ) + instance_kill_count = get_yaml_item_value( + managedcluster_scenario, "instance_count", 1 + ) + managedcluster_name = get_yaml_item_value( + managedcluster_scenario, "managedcluster_name", "" + ) + label_selector = get_yaml_item_value( + managedcluster_scenario, "label_selector", "" + ) + timeout = get_yaml_item_value(managedcluster_scenario, "timeout", 120) # Get the managedcluster to apply the scenario if managedcluster_name: managedcluster_name_list = managedcluster_name.split(",") diff --git a/kraken/network_chaos/actions.py b/kraken/network_chaos/actions.py index e2921b97..831bde0e 100644 --- a/kraken/network_chaos/actions.py +++ b/kraken/network_chaos/actions.py @@ -9,6 +9,7 @@ from jinja2 import Environment, FileSystemLoader from krkn_lib.k8s import KrknKubernetes from krkn_lib.telemetry import KrknTelemetry from krkn_lib.models.telemetry import ScenarioTelemetry +from krkn_lib.utils.functions import get_yaml_item_value # krkn_lib @@ -29,13 +30,26 @@ def run(scenarios_list, config, wait_duration, kubecli: KrknKubernetes, telemetr param_lst = ["latency", "loss", "bandwidth"] test_config = yaml.safe_load(file) test_dict = test_config["network_chaos"] - test_duration = int(test_dict.get("duration", 300)) - test_interface = test_dict.get("interfaces", []) - test_node = test_dict.get("node_name", "") - test_node_label = test_dict.get("label_selector", "node-role.kubernetes.io/master") - test_execution = test_dict.get("execution", "serial") - test_instance_count = test_dict.get("instance_count", 1) - test_egress = test_dict.get("egress", {"bandwidth": "100mbit"}) + test_duration = int( + get_yaml_item_value(test_dict, "duration", 300) + ) + test_interface = get_yaml_item_value( + test_dict, "interfaces", [] + ) + test_node = get_yaml_item_value(test_dict, "node_name", "") + test_node_label = get_yaml_item_value( + test_dict, "label_selector", + "node-role.kubernetes.io/master" + ) + test_execution = get_yaml_item_value( + test_dict, "execution", "serial" + ) + test_instance_count = get_yaml_item_value( + test_dict, "instance_count", 1 + ) + test_egress = get_yaml_item_value( + test_dict, "egress", {"bandwidth": "100mbit"} + ) if test_node: node_name_list = test_node.split(",") else: diff --git a/kraken/node_actions/run.py b/kraken/node_actions/run.py index 188b29e6..c08ae3e2 100644 --- a/kraken/node_actions/run.py +++ b/kraken/node_actions/run.py @@ -14,6 +14,7 @@ import kraken.node_actions.common_node_functions as common_node_functions import kraken.cerberus.setup as cerberus from krkn_lib.k8s import KrknKubernetes from krkn_lib.telemetry import KrknTelemetry, ScenarioTelemetry +from krkn_lib.utils.functions import get_yaml_item_value node_general = False @@ -92,13 +93,17 @@ def run(scenarios_list, config, wait_duration, kubecli: KrknKubernetes, telemetr def inject_node_scenario(action, node_scenario, node_scenario_object, kubecli: KrknKubernetes): generic_cloud_scenarios = ("stop_kubelet_scenario", "node_crash_scenario") # Get the node scenario configurations - run_kill_count = node_scenario.get("runs", 1) - instance_kill_count = node_scenario.get("instance_count", 1) - node_name = node_scenario.get("node_name", "") - label_selector = node_scenario.get("label_selector", "") - timeout = node_scenario.get("timeout", 120) - service = node_scenario.get("service", "") - ssh_private_key = node_scenario.get("ssh_private_key", "~/.ssh/id_rsa") + run_kill_count = get_yaml_item_value(node_scenario, "runs", 1) + instance_kill_count = get_yaml_item_value( + node_scenario, "instance_count", 1 + ) + node_name = get_yaml_item_value(node_scenario, "node_name", "") + label_selector = get_yaml_item_value(node_scenario, "label_selector", "") + timeout = get_yaml_item_value(node_scenario, "timeout", 120) + service = get_yaml_item_value(node_scenario, "service", "") + ssh_private_key = get_yaml_item_value( + node_scenario, "ssh_private_key", "~/.ssh/id_rsa" + ) # Get the node to apply the scenario if node_name: node_name_list = node_name.split(",") diff --git a/kraken/plugins/__init__.py b/kraken/plugins/__init__.py index a6f86001..e0109641 100644 --- a/kraken/plugins/__init__.py +++ b/kraken/plugins/__init__.py @@ -223,7 +223,7 @@ PLUGINS = Plugins( [ "error" ] - ) + ) ] ) @@ -235,7 +235,7 @@ def run(scenarios: List[str], kubeconfig_path: str, kraken_config: str, failed_p scenario_telemetry.scenario = scenario scenario_telemetry.startTimeStamp = time.time() telemetry.set_parameters_base64(scenario_telemetry, scenario) - logging.info('scenario '+ str(scenario)) + logging.info('scenario ' + str(scenario)) try: PLUGINS.run(scenario, kubeconfig_path, kraken_config) except Exception as e: diff --git a/kraken/pod_scenarios/setup.py b/kraken/pod_scenarios/setup.py index 05538dcd..ccda0ed9 100644 --- a/kraken/pod_scenarios/setup.py +++ b/kraken/pod_scenarios/setup.py @@ -10,6 +10,7 @@ from krkn_lib.k8s import KrknKubernetes from krkn_lib.telemetry import KrknTelemetry from krkn_lib.models.telemetry import ScenarioTelemetry from arcaflow_plugin_sdk import serialization +from krkn_lib.utils.functions import get_yaml_item_value # Run pod based scenarios def run(kubeconfig_path, scenarios_list, config, failed_post_scenarios, wait_duration): @@ -127,15 +128,14 @@ def container_run(kubeconfig_path, return failed_scenarios, scenario_telemetries - def container_killing_in_pod(cont_scenario, kubecli: KrknKubernetes): - scenario_name = cont_scenario.get("name", "") - namespace = cont_scenario.get("namespace", "*") - label_selector = cont_scenario.get("label_selector", None) - pod_names = cont_scenario.get("pod_names", []) - container_name = cont_scenario.get("container_name", "") - kill_action = cont_scenario.get("action", "kill 1") - kill_count = cont_scenario.get("count", 1) + scenario_name = get_yaml_item_value(cont_scenario, "name", "") + namespace = get_yaml_item_value(cont_scenario, "namespace", "*") + label_selector = get_yaml_item_value(cont_scenario, "label_selector", None) + pod_names = get_yaml_item_value(cont_scenario, "pod_names", []) + container_name = get_yaml_item_value(cont_scenario, "container_name", "") + kill_action = get_yaml_item_value(cont_scenario, "action", "kill 1") + kill_count = get_yaml_item_value(cont_scenario, "count", 1) if type(pod_names) != list: logging.error("Please make sure your pod_names are in a list format") # removed_exit diff --git a/kraken/pvc/pvc_scenario.py b/kraken/pvc/pvc_scenario.py index 28e393c2..c07929dc 100644 --- a/kraken/pvc/pvc_scenario.py +++ b/kraken/pvc/pvc_scenario.py @@ -7,6 +7,7 @@ from ..cerberus import setup as cerberus from krkn_lib.k8s import KrknKubernetes from krkn_lib.telemetry import KrknTelemetry from krkn_lib.models.telemetry import ScenarioTelemetry +from krkn_lib.utils.functions import get_yaml_item_value # krkn_lib @@ -27,13 +28,21 @@ def run(scenarios_list, config, kubecli: KrknKubernetes, telemetry: KrknTelemetr with open(app_config, "r") as f: config_yaml = yaml.full_load(f) scenario_config = config_yaml["pvc_scenario"] - pvc_name = scenario_config.get("pvc_name", "") - pod_name = scenario_config.get("pod_name", "") - namespace = scenario_config.get("namespace", "") - target_fill_percentage = scenario_config.get( - "fill_percentage", "50" + pvc_name = get_yaml_item_value( + scenario_config, "pvc_name", "" + ) + pod_name = get_yaml_item_value( + scenario_config, "pod_name", "" + ) + namespace = get_yaml_item_value( + scenario_config, "namespace", "" + ) + target_fill_percentage = get_yaml_item_value( + scenario_config, "fill_percentage", "50" + ) + duration = get_yaml_item_value( + scenario_config, "duration", 60 ) - duration = scenario_config.get("duration", 60) logging.info( "Input params:\n" diff --git a/kraken/service_disruption/common_service_disruption_functions.py b/kraken/service_disruption/common_service_disruption_functions.py index 9017bc99..e72dfa9d 100644 --- a/kraken/service_disruption/common_service_disruption_functions.py +++ b/kraken/service_disruption/common_service_disruption_functions.py @@ -7,10 +7,11 @@ import yaml from krkn_lib.k8s import KrknKubernetes from krkn_lib.telemetry import KrknTelemetry from krkn_lib.models.telemetry import ScenarioTelemetry +from krkn_lib.utils.functions import get_yaml_item_value -def delete_objects(kubecli, namespace): - +def delete_objects(kubecli, namespace): + services = delete_all_services_namespace(kubecli, namespace) daemonsets = delete_all_daemonset_namespace(kubecli, namespace) statefulsets = delete_all_statefulsets_namespace(kubecli, namespace) @@ -20,12 +21,13 @@ def delete_objects(kubecli, namespace): objects = { "daemonsets": daemonsets, "deployments": deployments, "replicasets": replicasets, - "statefulsets": statefulsets, + "statefulsets": statefulsets, "services": services } return objects + def get_list_running_pods(kubecli: KrknKubernetes, namespace: str): running_pods = [] pods = kubecli.list_pods(namespace) @@ -36,6 +38,7 @@ def get_list_running_pods(kubecli: KrknKubernetes, namespace: str): logging.info('all running pods ' + str(running_pods)) return running_pods + def delete_all_deployment_namespace(kubecli: KrknKubernetes, namespace: str): """ Delete all the deployments in the specified namespace @@ -43,20 +46,21 @@ def delete_all_deployment_namespace(kubecli: KrknKubernetes, namespace: str): :param kubecli: krkn kubernetes python package :param namespace: namespace """ - try: + try: deployments = kubecli.get_deployment_ns(namespace) for deployment in deployments: logging.info("Deleting deployment" + deployment) - kubecli.delete_deployment(deployment,namespace) + kubecli.delete_deployment(deployment, namespace) except Exception as e: logging.error( "Exception when calling delete_all_deployment_namespace: %s\n", str(e), ) raise e - + return deployments + def delete_all_daemonset_namespace(kubecli: KrknKubernetes, namespace: str): """ Delete all the daemonset in the specified namespace @@ -64,42 +68,44 @@ def delete_all_daemonset_namespace(kubecli: KrknKubernetes, namespace: str): :param kubecli: krkn kubernetes python package :param namespace: namespace """ - try: + try: daemonsets = kubecli.get_daemonset(namespace) for daemonset in daemonsets: logging.info("Deleting daemonset" + daemonset) - kubecli.delete_daemonset(daemonset,namespace) + kubecli.delete_daemonset(daemonset, namespace) except Exception as e: logging.error( "Exception when calling delete_all_daemonset_namespace: %s\n", str(e), ) raise e - + return daemonsets + def delete_all_statefulsets_namespace(kubecli: KrknKubernetes, namespace: str): """ Delete all the statefulsets in the specified namespace - + :param kubecli: krkn kubernetes python package :param namespace: namespace """ - try: + try: statefulsets = kubecli.get_all_statefulset(namespace) for statefulset in statefulsets: logging.info("Deleting statefulsets" + statefulsets) - kubecli.delete_statefulset(statefulset,namespace) + kubecli.delete_statefulset(statefulset, namespace) except Exception as e: logging.error( "Exception when calling delete_all_statefulsets_namespace: %s\n", str(e), ) raise e - + return statefulsets + def delete_all_replicaset_namespace(kubecli: KrknKubernetes, namespace: str): """ Delete all the replicasets in the specified namespace @@ -107,42 +113,43 @@ def delete_all_replicaset_namespace(kubecli: KrknKubernetes, namespace: str): :param kubecli: krkn kubernetes python package :param namespace: namespace """ - try: + try: replicasets = kubecli.get_all_replicasets(namespace) for replicaset in replicasets: logging.info("Deleting replicaset" + replicaset) - kubecli.delete_replicaset(replicaset,namespace) + kubecli.delete_replicaset(replicaset, namespace) except Exception as e: logging.error( "Exception when calling delete_all_replicaset_namespace: %s\n", str(e), ) raise e - + return replicasets def delete_all_services_namespace(kubecli: KrknKubernetes, namespace: str): """ Delete all the services in the specified namespace - + :param kubecli: krkn kubernetes python package :param namespace: namespace """ - try: + try: services = kubecli.get_all_services(namespace) for service in services: logging.info("Deleting services" + service) - kubecli.delete_services(service,namespace) + kubecli.delete_services(service, namespace) except Exception as e: logging.error( "Exception when calling delete_all_services_namespace: %s\n", str(e), ) raise e - + return services + # krkn_lib def run( scenarios_list, @@ -168,8 +175,12 @@ def run( with open(scenario_config[0], "r") as f: scenario_config_yaml = yaml.full_load(f) for scenario in scenario_config_yaml["scenarios"]: - scenario_namespace = scenario.get("namespace", "") - scenario_label = scenario.get("label_selector", "") + scenario_namespace = get_yaml_item_value( + scenario, "namespace", "" + ) + scenario_label = get_yaml_item_value( + scenario, "label_selector", "" + ) if scenario_namespace is not None and scenario_namespace.strip() != "": if scenario_label is not None and scenario_label.strip() != "": logging.error("You can only have namespace or label set in your namespace scenario") @@ -183,11 +194,15 @@ def run( # removed_exit # sys.exit(1) raise RuntimeError() - delete_count = scenario.get("delete_count", 1) - run_count = scenario.get("runs", 1) - run_sleep = scenario.get("sleep", 10) - wait_time = scenario.get("wait_time", 30) - + delete_count = get_yaml_item_value( + scenario, "delete_count", 1 + ) + run_count = get_yaml_item_value(scenario, "runs", 1) + run_sleep = get_yaml_item_value(scenario, "sleep", 10) + wait_time = get_yaml_item_value(scenario, "wait_time", 30) + + logging.info(str(scenario_namespace) + str(scenario_label) + str(delete_count) + str(run_count) + str(run_sleep) + str(wait_time)) + logging.info("done") start_time = int(time.time()) for i in range(run_count): killed_namespaces = {} @@ -230,7 +245,7 @@ def run( raise RuntimeError() else: failed_post_scenarios = check_all_running_deployment(killed_namespaces, wait_time, kubecli) - + end_time = int(time.time()) cerberus.publish_kraken_status(config, failed_post_scenarios, start_time, end_time) except (Exception, RuntimeError): @@ -244,19 +259,19 @@ def run( return failed_scenarios, scenario_telemetries -def check_all_running_pods(kubecli: KrknKubernetes, namespace_name, wait_time): +def check_all_running_pods(kubecli: KrknKubernetes, namespace_name, wait_time): timer = 0 - while timer < wait_time: + while timer < wait_time: pod_list = kubecli.list_pods(namespace_name) pods_running = 0 - for pod in pod_list: - pod_info = kubecli.get_pod_info(pod,namespace_name) + for pod in pod_list: + pod_info = kubecli.get_pod_info(pod, namespace_name) if pod_info.status != "Running" and pod_info.status != "Succeeded": logging.info("Pods %s still not running or completed" % pod_info.name) break - pods_running +=1 - if len(pod_list) == pods_running: + pods_running += 1 + if len(pod_list) == pods_running: break timer += 5 time.sleep(5) @@ -264,36 +279,36 @@ def check_all_running_pods(kubecli: KrknKubernetes, namespace_name, wait_time): # krkn_lib def check_all_running_deployment(killed_namespaces, wait_time, kubecli: KrknKubernetes): - + timer = 0 while timer < wait_time and killed_namespaces: still_missing_ns = killed_namespaces.copy() for namespace_name, objects in killed_namespaces.items(): still_missing_obj = objects.copy() - for obj_name, obj_list in objects.items(): - if "deployments" == obj_name: + for obj_name, obj_list in objects.items(): + if "deployments" == obj_name: deployments = kubecli.get_deployment_ns(namespace_name) if len(obj_list) == len(deployments): still_missing_obj.pop(obj_name) elif "replicasets" == obj_name: replicasets = kubecli.get_all_replicasets(namespace_name) - if len(obj_list) == len(replicasets): + if len(obj_list) == len(replicasets): still_missing_obj.pop(obj_name) - elif "statefulsets" == obj_name: + elif "statefulsets" == obj_name: statefulsets = kubecli.get_all_statefulset(namespace_name) - if len(obj_list) == len(statefulsets): + if len(obj_list) == len(statefulsets): still_missing_obj.pop(obj_name) - elif "services" == obj_name: + elif "services" == obj_name: services = kubecli.get_all_services(namespace_name) - if len(obj_list) == len(services): + if len(obj_list) == len(services): still_missing_obj.pop(obj_name) - elif "daemonsets" == obj_name: + elif "daemonsets" == obj_name: daemonsets = kubecli.get_daemonset(namespace_name) - if len(obj_list) == len(daemonsets): + if len(obj_list) == len(daemonsets): still_missing_obj.pop(obj_name) logging.info("Still missing objects " + str(still_missing_obj)) killed_namespaces[namespace_name] = still_missing_obj.copy() - if len(killed_namespaces[namespace_name].keys()) == 0: + if len(killed_namespaces[namespace_name].keys()) == 0: logging.info("Wait for pods to become running for namespace: " + namespace_name) check_all_running_pods(kubecli, namespace_name, wait_time) still_missing_ns.pop(namespace_name) diff --git a/kraken/time_actions/common_time_functions.py b/kraken/time_actions/common_time_functions.py index c3347be9..a2688cae 100644 --- a/kraken/time_actions/common_time_functions.py +++ b/kraken/time_actions/common_time_functions.py @@ -9,6 +9,7 @@ from ..invoke import command as runcommand from krkn_lib.k8s import KrknKubernetes from krkn_lib.telemetry import KrknTelemetry from krkn_lib.models.telemetry import ScenarioTelemetry +from krkn_lib.utils.functions import get_yaml_item_value # krkn_lib def pod_exec(pod_name, command, namespace, container_name, kubecli:KrknKubernetes): @@ -88,7 +89,7 @@ def skew_time(scenario, kubecli:KrknKubernetes): return "node", node_names elif "pod" in scenario["object_type"]: - container_name = scenario.get("container_name", "") + container_name = get_yaml_item_value(scenario, "container_name", "") pod_names = [] if "object_name" in scenario.keys() and scenario["object_name"]: for name in scenario["object_name"]: diff --git a/run_kraken.py b/run_kraken.py index f6313733..512b796f 100644 --- a/run_kraken.py +++ b/run_kraken.py @@ -30,6 +30,7 @@ from krkn_lib.k8s import KrknKubernetes from krkn_lib.telemetry import KrknTelemetry from krkn_lib.models.telemetry import ChaosRunTelemetry from krkn_lib.utils import SafeLogger +from krkn_lib.utils.functions import get_yaml_item_value KUBE_BURNER_URL = ( "https://github.com/cloud-bulldozer/kube-burner/" @@ -49,50 +50,78 @@ def main(cfg): with open(cfg, "r") as f: config = yaml.full_load(f) global kubeconfig_path, wait_duration, kraken_config - distribution = config["kraken"].get("distribution", "openshift") + distribution = get_yaml_item_value( + config["kraken"], "distribution", "openshift" + ) kubeconfig_path = os.path.expanduser( - config["kraken"].get("kubeconfig_path", "") + get_yaml_item_value(config["kraken"], "kubeconfig_path", "") ) kraken_config = cfg - chaos_scenarios = config["kraken"].get("chaos_scenarios", []) - publish_running_status = config["kraken"].get("publish_kraken_status", False) - port = config["kraken"].get("port") - signal_address = config["kraken"].get("signal_address") - run_signal = config["kraken"].get("signal_state", "RUN") - litmus_install = config["kraken"].get("litmus_install", True) - litmus_version = config["kraken"].get("litmus_version", "v1.9.1") - litmus_uninstall = config["kraken"].get("litmus_uninstall", False) - litmus_uninstall_before_run = config["kraken"].get( - "litmus_uninstall_before_run", True + chaos_scenarios = get_yaml_item_value( + config["kraken"], "chaos_scenarios", [] ) - wait_duration = config["tunings"].get("wait_duration", 60) - iterations = config["tunings"].get("iterations", 1) - daemon_mode = config["tunings"].get("daemon_mode", False) - deploy_performance_dashboards = config["performance_monitoring"].get( - "deploy_dashboards", False + publish_running_status = get_yaml_item_value( + config["kraken"], "publish_kraken_status", False ) - dashboard_repo = config["performance_monitoring"].get( - "repo", "https://github.com/cloud-bulldozer/performance-dashboards.git" + port = get_yaml_item_value(config["kraken"], "port", 8081) + signal_address = get_yaml_item_value( + config["kraken"], "signal_address", "0.0.0.0") + run_signal = get_yaml_item_value( + config["kraken"], "signal_state", "RUN" ) - capture_metrics = config["performance_monitoring"].get("capture_metrics", False) - kube_burner_url = config["performance_monitoring"].get( - "kube_burner_binary_url", + litmus_install = get_yaml_item_value( + config["kraken"], "litmus_install", False + ) + litmus_version = get_yaml_item_value( + config["kraken"], "litmus_version", "v1.9.1" + ) + litmus_uninstall = get_yaml_item_value( + config["kraken"], "litmus_uninstall", True + ) + litmus_uninstall_before_run = get_yaml_item_value( + config["kraken"], "litmus_uninstall_before_run", True + ) + wait_duration = get_yaml_item_value( + config["tunings"], "wait_duration", 60 + ) + iterations = get_yaml_item_value(config["tunings"], "iterations", 1) + daemon_mode = get_yaml_item_value( + config["tunings"], "daemon_mode", False + ) + deploy_performance_dashboards = get_yaml_item_value( + config["performance_monitoring"], "deploy_dashboards", False + ) + dashboard_repo = get_yaml_item_value( + config["performance_monitoring"], "repo", + "https://github.com/cloud-bulldozer/performance-dashboards.git" + ) + capture_metrics = get_yaml_item_value( + config["performance_monitoring"], "capture_metrics", False + ) + kube_burner_url = get_yaml_item_value( + config["performance_monitoring"], "kube_burner_binary_url", KUBE_BURNER_URL.format(version=KUBE_BURNER_VERSION), ) - config_path = config["performance_monitoring"].get( - "config_path", "config/kube_burner.yaml" + config_path = get_yaml_item_value( + config["performance_monitoring"], "config_path", + "config/kube_burner.yaml" ) - metrics_profile = config["performance_monitoring"].get( - "metrics_profile_path", "config/metrics-aggregated.yaml" + metrics_profile = get_yaml_item_value( + config["performance_monitoring"], "metrics_profile_path", + "config/metrics-aggregated.yaml" ) - prometheus_url = config["performance_monitoring"].get("prometheus_url", "") + prometheus_url = config["performance_monitoring"].get("prometheus_url") prometheus_bearer_token = config["performance_monitoring"].get( - "prometheus_bearer_token", "" + "prometheus_bearer_token" + ) + run_uuid = config["performance_monitoring"].get("uuid") + enable_alerts = get_yaml_item_value( + config["performance_monitoring"], "enable_alerts", False + ) + alert_profile = config["performance_monitoring"].get("alert_profile") + check_critical_alerts = get_yaml_item_value( + config["performance_monitoring"], "check_critical_alerts", False ) - run_uuid = config["performance_monitoring"].get("uuid", "") - enable_alerts = config["performance_monitoring"].get("enable_alerts", False) - alert_profile = config["performance_monitoring"].get("alert_profile", "") - check_critical_alerts = config["performance_monitoring"].get("check_critical_alerts", False) # Initialize clients if (not os.path.isfile(kubeconfig_path) and