diff --git a/kraken/time_actions/common_time_functions.py b/kraken/time_actions/common_time_functions.py index 516510cd..e27cbb90 100644 --- a/kraken/time_actions/common_time_functions.py +++ b/kraken/time_actions/common_time_functions.py @@ -57,15 +57,28 @@ def skew_time(scenario): logging.error("Need to set namespace when using pod name") sys.exit(1) pod_names.append([name, scenario["namespace"]]) - elif "label_selector" in scenario.keys() and scenario["label_selector"]: - pod_names = kubecli.get_all_pods(scenario["label_selector"]) elif "namespace" in scenario.keys() and scenario["namespace"]: - pod_names = kubecli.list_pods(scenario["namespace"]) + if "label_selector" not in scenario.keys(): + logging.info( + "label_selector key not found, querying for all the pods in namespace: %s" % (scenario["namespace"]) + ) + pod_names = kubecli.list_pods(scenario["namespace"]) + else: + logging.info( + "Querying for the pods matching the %s label_selector in namespace %s" + % (scenario["label_selector"], scenario["namespace"]) + ) + pod_names = kubecli.list_pods(scenario["namespace"], scenario["label_selector"]) counter = 0 for pod_name in pod_names: pod_names[counter] = [pod_name, scenario["namespace"]] counter += 1 + elif "label_selector" in scenario.keys() and scenario["label_selector"]: + pod_names = kubecli.get_all_pods(scenario["label_selector"]) + if len(pod_names) == 0: + logging.info("Cannot find pods matching the namespace/label_selector, please check") + sys.exit(1) for pod in pod_names: if len(pod) > 1: pod_exec(pod[0], skew_command, pod[1]) diff --git a/run_kraken.py b/run_kraken.py index 830e3b1f..9786db86 100644 --- a/run_kraken.py +++ b/run_kraken.py @@ -209,7 +209,11 @@ def main(cfg): logging.error("Post scenarios are still failing at the end of all iterations") sys.exit(1) - logging.info("Successfully finished running Kraken. UUID for the run: %s. Exiting" % (run_uuid)) + run_dir = os.getcwd() + "/kraken.report" + logging.info( + "Successfully finished running Kraken. UUID for the run: %s. Report generated at %s. Exiting" + % (run_uuid, run_dir) + ) else: logging.error("Cannot find a config at %s, please check" % (cfg)) sys.exit(1) diff --git a/scenarios/time_scenarios_example.yml b/scenarios/time_scenarios_example.yml index 9b190b65..b4aed4c2 100644 --- a/scenarios/time_scenarios_example.yml +++ b/scenarios/time_scenarios_example.yml @@ -1,7 +1,8 @@ time_scenarios: - action: skew_time object_type: pod - label_selector: app=multus + namespace: openshift-etcd + label_selector: app=etcd - action: skew_date object_type: node label_selector: node-role.kubernetes.io/worker