From aee838d3acea556999ab9e26460f4ba84be2b991 Mon Sep 17 00:00:00 2001 From: yogananth subramanian Date: Tue, 6 May 2025 22:21:59 +0530 Subject: [PATCH] Fix: Add support for tains (#790) (#791) --- docs/hog_scenarios.md | 2 ++ krkn/scenario_plugins/hogs/hogs_scenario_plugin.py | 2 +- scenarios/kube/cpu-hog.yml | 1 + scenarios/kube/io-hog.yml | 3 ++- scenarios/kube/memory-hog.yml | 1 + 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/hog_scenarios.md b/docs/hog_scenarios.md index fa10108a..321e6e8f 100644 --- a/docs/hog_scenarios.md +++ b/docs/hog_scenarios.md @@ -18,6 +18,8 @@ these workloads will use a predetermined amount of resources for a specified dur |`namespace`| string | the namespace where the stress workload will be deployed | |`node-selector`| string (Optional) | defines the node selector for choosing target nodes. If not specified, one schedulable node in the cluster will be chosen at random. If multiple nodes match the selector, all of them will be subjected to stress. If number-of-nodes is specified, that many nodes will be randomly selected from those identified by the selector. | |`number-of-nodes`| number (Optional) | restricts the number of selected nodes by the selector| +|`taints`| list (Optional) default [] | list of taints for which tolerations need to created. Example: ["node-role.kubernetes.io/master:NoSchedule"]| + #### `cpu-hog` options diff --git a/krkn/scenario_plugins/hogs/hogs_scenario_plugin.py b/krkn/scenario_plugins/hogs/hogs_scenario_plugin.py index 2ef0180c..37fa7519 100644 --- a/krkn/scenario_plugins/hogs/hogs_scenario_plugin.py +++ b/krkn/scenario_plugins/hogs/hogs_scenario_plugin.py @@ -33,7 +33,7 @@ class HogsScenarioPlugin(AbstractScenarioPlugin): else: node_selector = scenario_config.node_selector - available_nodes = lib_telemetry.get_lib_kubernetes().list_schedulable_nodes(node_selector) + available_nodes = lib_telemetry.get_lib_kubernetes().list_nodes(node_selector) if len(available_nodes) == 0: raise Exception("no available nodes to schedule workload") diff --git a/scenarios/kube/cpu-hog.yml b/scenarios/kube/cpu-hog.yml index 0601efa7..eeb130e2 100644 --- a/scenarios/kube/cpu-hog.yml +++ b/scenarios/kube/cpu-hog.yml @@ -7,3 +7,4 @@ cpu-load-percentage: 90 cpu-method: all node-selector: "node-role.kubernetes.io/worker=" number-of-nodes: 2 +taints: [] #example ["node-role.kubernetes.io/master:NoSchedule"] diff --git a/scenarios/kube/io-hog.yml b/scenarios/kube/io-hog.yml index bca41c2a..606ad259 100644 --- a/scenarios/kube/io-hog.yml +++ b/scenarios/kube/io-hog.yml @@ -11,4 +11,5 @@ io-target-pod-volume: hostPath: path: /root # a path writable by kubelet in the root filesystem of the node node-selector: "node-role.kubernetes.io/worker=" -number-of-nodes: '' \ No newline at end of file +number-of-nodes: '' +taints: [] #example ["node-role.kubernetes.io/master:NoSchedule"] \ No newline at end of file diff --git a/scenarios/kube/memory-hog.yml b/scenarios/kube/memory-hog.yml index c426fcb8..f69eb082 100644 --- a/scenarios/kube/memory-hog.yml +++ b/scenarios/kube/memory-hog.yml @@ -6,3 +6,4 @@ namespace: default memory-vm-bytes: 90% node-selector: "node-role.kubernetes.io/worker=" number-of-nodes: '' +taints: [] #example ["node-role.kubernetes.io/master:NoSchedule"]