mirror of
https://github.com/krkn-chaos/krkn.git
synced 2026-08-25 09:27:36 +00:00
Adding node memory hog scenario
This commit is contained in:
committed by
Naga Ravi Chaitanya Elluri
parent
6456eec76a
commit
9b0bcdbf0e
+7
-3
@@ -2,7 +2,7 @@ kraken:
|
||||
distribution: openshift # Distribution can be kubernetes or openshift
|
||||
kubeconfig_path: /root/.kube/config # Path to kubeconfig
|
||||
exit_on_failure: False # Exit when a post action scenario fails
|
||||
litmus_version: v1.10.0 # Litmus version to install
|
||||
litmus_version: v1.13.6 # Litmus version to install
|
||||
litmus_uninstall: False # If you want to uninstall litmus if failure
|
||||
chaos_scenarios: # List of policies/chaos scenarios to load
|
||||
- container_scenarios: # List of chaos pod scenarios to load
|
||||
@@ -19,8 +19,12 @@ kraken:
|
||||
- time_scenarios: # List of chaos time scenarios to load
|
||||
- scenarios/time_scenarios_example.yml
|
||||
- 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_cpu_hog_engine.yaml
|
||||
- - https://hub.litmuschaos.io/api/chaos/1.13.6?file=charts/generic/node-cpu-hog/rbac.yaml
|
||||
- scenarios/node_hog_engine.yaml
|
||||
- - https://hub.litmuschaos.io/api/chaos/1.13.6?file=charts/generic/node-memory-hog/rbac.yaml
|
||||
- scenarios/node_mem_engine.yaml
|
||||
- - https://hub.litmuschaos.io/api/chaos/1.13.6?file=charts/generic/node-io-stress/rbac.yaml
|
||||
- scenarios/node_io_engine.yaml
|
||||
- cluster_shut_down_scenarios:
|
||||
- - scenarios/cluster_shut_down_scenario.yml
|
||||
- scenarios/post_action_shut_down.py
|
||||
|
||||
@@ -56,7 +56,12 @@ def run(scenarios_list, config, litmus_namespaces, litmus_uninstall, wait_durati
|
||||
|
||||
# Install litmus and wait until pod is running
|
||||
def install_litmus(version):
|
||||
runcommand.invoke("kubectl apply -f " "https://litmuschaos.github.io/litmus/litmus-operator-%s.yaml" % version)
|
||||
litmus_install = runcommand.invoke(
|
||||
"kubectl apply -f " "https://litmuschaos.github.io/litmus/litmus-operator-%s.yaml" % version
|
||||
)
|
||||
if "unable" in litmus_install:
|
||||
logging.info("Unable to install litmus because " + str(litmus_install))
|
||||
sys.exit(1)
|
||||
|
||||
runcommand.invoke(
|
||||
"oc patch -n litmus deployment.apps/chaos-operator-ce --type=json --patch ' "
|
||||
@@ -112,7 +117,7 @@ def check_experiment(engine_name, experiment_name, namespace):
|
||||
chaos_result = runcommand.invoke(
|
||||
"kubectl get chaosresult %s"
|
||||
"-%s -n %s -o "
|
||||
"jsonpath='{.status.experimentstatus.verdict}'" % (engine_name, experiment_name, namespace)
|
||||
"jsonpath='{.status.experimentStatus.verdict}'" % (engine_name, experiment_name, namespace)
|
||||
)
|
||||
result_counter = 0
|
||||
status = chaos_result.strip()
|
||||
@@ -122,7 +127,7 @@ def check_experiment(engine_name, experiment_name, namespace):
|
||||
chaos_result = runcommand.invoke(
|
||||
"kubectl get chaosresult %s"
|
||||
"-%s -n %s -o "
|
||||
"jsonpath='{.status.experimentstatus.verdict}'" % (engine_name, experiment_name, namespace)
|
||||
"jsonpath='{.status.experimentStatus.verdict}'" % (engine_name, experiment_name, namespace)
|
||||
)
|
||||
status = chaos_result.strip()
|
||||
if result_counter >= max_tries:
|
||||
@@ -139,7 +144,7 @@ def check_experiment(engine_name, experiment_name, namespace):
|
||||
chaos_result = runcommand.invoke(
|
||||
"kubectl get chaosresult %s"
|
||||
"-%s -n %s -o jsonpath="
|
||||
"'{.status.experimentstatus.failStep}'" % (engine_name, experiment_name, namespace)
|
||||
"'{.status.experimentStatus.failStep}'" % (engine_name, experiment_name, namespace)
|
||||
)
|
||||
logging.info("Chaos result failed information: " + str(chaos_result))
|
||||
return False
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
apiVersion: litmuschaos.io/v1alpha1
|
||||
kind: ChaosEngine
|
||||
metadata:
|
||||
name: nginx-chaos
|
||||
namespace: default
|
||||
spec:
|
||||
# It can be delete/retain
|
||||
jobCleanUpPolicy: 'retain'
|
||||
# It can be active/stop
|
||||
engineState: 'active'
|
||||
chaosServiceAccount: node-io-stress-sa
|
||||
experiments:
|
||||
- name: node-io-stress
|
||||
spec:
|
||||
components:
|
||||
env:
|
||||
# set chaos duration (in sec) as desired
|
||||
- name: TOTAL_CHAOS_DURATION
|
||||
value: '40'
|
||||
|
||||
## specify the size as percentage of free space on the file system
|
||||
- name: FILESYSTEM_UTILIZATION_PERCENTAGE
|
||||
value: '100'
|
||||
|
||||
## Number of core of CPU
|
||||
- name: CPU
|
||||
value: '1'
|
||||
|
||||
## Total number of workers default value is 4
|
||||
- name: NUMBER_OF_WORKERS
|
||||
value: '3'
|
||||
|
||||
## enter the comma separated target nodes name
|
||||
- name: TARGET_NODES
|
||||
value: '<node_name>'
|
||||
@@ -0,0 +1,28 @@
|
||||
apiVersion: litmuschaos.io/v1alpha1
|
||||
kind: ChaosEngine
|
||||
metadata:
|
||||
name: nginx-chaos
|
||||
namespace: default
|
||||
spec:
|
||||
# It can be delete/retain
|
||||
jobCleanUpPolicy: 'retain'
|
||||
# It can be active/stop
|
||||
engineState: 'active'
|
||||
chaosServiceAccount: node-memory-hog-sa
|
||||
experiments:
|
||||
- name: node-memory-hog
|
||||
spec:
|
||||
components:
|
||||
env:
|
||||
# set chaos duration (in sec) as desired
|
||||
- name: TOTAL_CHAOS_DURATION
|
||||
value: '30'
|
||||
|
||||
## Specify the size as percent of total node capacity Ex: '30'
|
||||
## Note: For consuming memory in mebibytes change the variable to MEMORY_CONSUMPTION_MEBIBYTES
|
||||
- name: MEMORY_CONSUMPTION_PERCENTAGE
|
||||
value: '30'
|
||||
|
||||
# ENTER THE COMMA SEPARATED TARGET NODES NAME
|
||||
- name: TARGET_NODES
|
||||
value: '<node_name>'
|
||||
Reference in New Issue
Block a user