From 46a182329179d504c86d2276a9b73bc8097a8a76 Mon Sep 17 00:00:00 2001 From: prubenda Date: Tue, 6 Jul 2021 12:02:41 -0400 Subject: [PATCH] Adding killing of specific containers in pods --- README.md | 2 + config/config.yaml | 6 ++- docs/container_scenarios.md | 17 ++++++ kraken/kubernetes/client.py | 42 ++++++++++----- kraken/pod_scenarios/setup.py | 99 +++++++++++++++++++++++++++++++++++ run_kraken.py | 6 ++- scenarios/container_etcd.yml | 7 +++ 7 files changed, 163 insertions(+), 16 deletions(-) create mode 100644 docs/container_scenarios.md create mode 100755 scenarios/container_etcd.yml diff --git a/README.md b/README.md index 88cf4155..36d2d3e7 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,8 @@ Kraken supports pod, node, time/date and [litmus](https://github.com/litmuschaos - [Pod Scenarios](docs/pod_scenarios.md) +- [Container Scenarios](docs/container_scenarios.md) + - [Node Scenarios](docs/node_scenarios.md) - [Time Scenarios](docs/time_scenarios.md) diff --git a/config/config.yaml b/config/config.yaml index 0ac60143..8f4ae482 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -5,7 +5,9 @@ kraken: litmus_version: v1.10.0 # Litmus version to install litmus_uninstall: False # If you want to uninstall litmus if failure chaos_scenarios: # List of policies/chaos scenarios to load - - pod_scenarios: # List of chaos pod scenarios to load + - container_scenarios: # List of chaos pod scenarios to load + - - scenarios/container_etcd.yml + - pod_scenarios: - - scenarios/etcd.yml - - scenarios/regex_openshift_pod_kill.yml - scenarios/post_action_regex.py @@ -19,7 +21,7 @@ kraken: - litmus_scenarios: # List of litmus scenarios to load - - https://hub.litmuschaos.io/api/chaos/1.10.0?file=charts/generic/node-cpu-hog/rbac.yaml - scenarios/node_hog_engine.yaml - - cluster_shut_down_scenarios: + - cluster_shut_down_scenarios: - - scenarios/cluster_shut_down_scenario.yml - scenarios/post_action_shut_down.py cerberus: diff --git a/docs/container_scenarios.md b/docs/container_scenarios.md new file mode 100644 index 00000000..1efd550a --- /dev/null +++ b/docs/container_scenarios.md @@ -0,0 +1,17 @@ +### Container Scenarios +Kraken uses the `oc exec` command to `kill` specific containers in a pod. +This can be based on the pods namespace or labels. If you know the exact object you want to kill, you can also specify the specific container name or pod name in the scenario yaml file. +These scenarios are in a simple yaml format that you can manipulate to run your specific tests or use the pre-existing scenarios to see how it works + +#### Example Config +The following are the components of Kubernetes/OpenShift for which a basic chaos scenario config exists today. + +``` +scenarios: +- name: "" + namespace: "" # can specify "*" if you want to find in all namespaces + label_selector: "