diff --git a/CI/scenarios/cluster_shut_down_scenario.yml b/CI/scenarios/cluster_shut_down_scenario.yml new file mode 100644 index 000000000..11e9ca4b3 --- /dev/null +++ b/CI/scenarios/cluster_shut_down_scenario.yml @@ -0,0 +1,4 @@ +cluster_shut_down_scenario: # Scenario to stop all the nodes for specified duration and restart the nodes + runs: 1 # Number of times to execute the cluster_shut_down scenario + shut_down_duration: 120 # duration in seconds to shut down the cluster + cloud_type: aws # cloud type on which Kubernetes/OpenShift runs diff --git a/CI/scenarios/node_scenarios_example.yml b/CI/scenarios/node_scenarios_example.yml new file mode 100644 index 000000000..50c0ba35a --- /dev/null +++ b/CI/scenarios/node_scenarios_example.yml @@ -0,0 +1,17 @@ +node_scenarios: + - actions: # node chaos scenarios to be injected + - node_stop_start_scenario + - stop_start_kubelet_scenario + - node_crash_scenario + node_name: # node on which scenario has to be injected + label_selector: node-role.kubernetes.io/worker # when node_name is not specified, a node with matching label_selector is selected for node chaos scenario injection + instance_kill_count: 1 # number of times to inject each scenario under actions + timeout: 120 # duration to wait for completion of node scenario injection + cloud_type: aws # cloud type on which Kubernetes/OpenShift runs + - actions: + - node_reboot_scenario + node_name: + label_selector: node-role.kubernetes.io/infra + instance_kill_count: 1 + timeout: 120 + cloud_type: aws diff --git a/ansible/templates/kraken.j2 b/ansible/templates/kraken.j2 index 798e2aa74..0bad999a3 100644 --- a/ansible/templates/kraken.j2 +++ b/ansible/templates/kraken.j2 @@ -2,6 +2,8 @@ kraken: kubeconfig_path: {{ kubeconfig_path }} # Path to kubeconfig exit_on_failure: {{ exit_on_failure }} # Exit when a post action scenario fails scenarios: {{ scenarios }} # List of policies/chaos scenarios to load + node_scenarios: {{ node_scenarios }} # List of chaos node scenarios to load + cluster_shut_down_scenario: {{ cluster_shut_down_scenario }} cerberus: cerberus_enabled: {{ cerberus_enabled }} # Enable it when cerberus is previously installed diff --git a/ansible/vars/kraken_vars.yml b/ansible/vars/kraken_vars.yml index f35de5336..d6e92f680 100644 --- a/ansible/vars/kraken_vars.yml +++ b/ansible/vars/kraken_vars.yml @@ -22,6 +22,8 @@ kraken_repository: "{{ lookup('env', 'KRAKEN_REPOSITORY')|default('https://githu # scenarios to inject scenarios_folder_path: "{{ lookup('env', 'SCENARIOS_FOLDER_PATH')|default('CI/scenarios/', true) }}" scenarios: "{{ lookup('env', 'SCENARIOS')|default('[[scenarios/etcd.yml, scenarios/post_action_etcd_example.sh], [scenarios/openshift-apiserver.yml, scenarios/post_action_openshift-kube-apiserver.yml], [scenarios/openshift-kube-apiserver.yml, scenarios/post_action_openshift-apiserver.yml], [scenarios/regex_openshift_pod_kill.yml, scenarios/post_action_regex.py]]', true) }}" +node_scenarios: "{{ lookup('env', 'NODE_SCENARIOS')|default('[scenarios/node_scenarios_example.yml]', true) }}" +cluster_shut_down_scenario: "{{ lookup('env', 'CLUSTER_SHUT_DOWN_SCENARIO')|default('[scenarios/cluster_shut_down_scenario.yml]', true) }}" exit_on_failure: "{{ lookup('env', 'EXIT_ON_FAILURE')|default(false, true) }}"