Skip to content

feat:add node taints to cpu and memory scenarios#43

Merged
rh-rahulshetty merged 1 commit intokrkn-chaos:mainfrom
FAUST-BENCHOU:feature/add-node-taints-to-scenarios
Nov 26, 2025
Merged

feat:add node taints to cpu and memory scenarios#43
rh-rahulshetty merged 1 commit intokrkn-chaos:mainfrom
FAUST-BENCHOU:feature/add-node-taints-to-scenarios

Conversation

@FAUST-BENCHOU
Copy link
Contributor

Close #40
Support taints such as
taints=[
"node-role.kubernetes.io/master:NoSchedule",
"dedicated=workload:NoSchedule",
]
taints will be added in cpu hog and memory hog scenario

Signed-off-by: zhoujinyu <2319109590@qq.com>
@rh-rahulshetty
Copy link
Collaborator

Changes looks good and confirmed to be working with the KrknHub runner. But seems like we are missing the --taints input variables for the Krknctl runner.

Raised below changes to update the parameter in krknctl inputs json:

@FAUST-BENCHOU
Copy link
Contributor Author

@rh-rahulshetty Hi, I’m a bit confused about this point, krknctl runner seems to work well,so I wanted to double-check my understanding.

Locally I tested both CLI_RUNNER and HUB_RUNNER, and in both cases the generated command does include the taints parameter. Concretely:

runner_ctl = KrknRunner(
    config=config,
    output_dir=output_dir,
    runner_type=KrknRunnerType.CLI_RUNNER,
)

runner_hub = KrknRunner(
    config=config,
    output_dir=output_dir,
    runner_type=KrknRunnerType.HUB_RUNNER,
)

cpu_scenario = NodeCPUHogScenario(
    cluster_components=config.cluster_components
)
test_taints = ["node-role.kubernetes.io/master:NoSchedule", "worker:NoSchedule"]
cpu_scenario.taint.value = json.dumps(test_taints)

# Use KrknRunner.runner_command to generate commands (project-standard method)
krknctl_command = runner_ctl.runner_command(cpu_scenario)
krknhub_command = runner_hub.runner_command(cpu_scenario)

The outputs are:

krknctl command:
  krknctl run node-cpu-hog --telemetry-prometheus-backup False --wait-duration 30 --kubeconfig /var/folders/.../tmp3zk8cajd.yaml --chaos-duration "60" --cpu-percentage "40" --node-selector "kubernetes.io/hostname=node-1" 
--taints "["node-role.kubernetes.io/master:NoSchedule", "worker:NoSchedule"]" --number-of-nodes "1" --image "quay.io/krkn-chaos/krkn-hog"
krknhub command:
  podman run --env-host=true -e PUBLISH_KRAKEN_STATUS="False" -e TELEMETRY_PROMETHEUS_BACKUP="False" -e WAIT_DURATION=30 -e TOTAL_CHAOS_DURATION="60" -e NODE_CPU_PERCENTAGE="40" -e NODE_SELECTOR="kubernetes.io/hostname=node-1" 
-e TAINTS="["node-role.kubernetes.io/master:NoSchedule", "worker:NoSchedule"]" -e NUMBER_OF_NODES="1" -e IMAGE="quay.io/krkn-chaos/krkn-hog" --net=host -v /var/folders/.../tmp3zk8cajd.yaml:/home/krkn/.kube/config:Z containers.krkn-chaos.dev/krkn-chaos/krkn-hub:node-cpu-hog

As you can see, both runners have --taints / -e TAINTS in their commands.Because of that, I’m not entirely sure what you meant by:

But seems like we are missing the --taints input variables for the Krknctl runner.

Is there a specific scenario or code path where --taints is not being passed through, or did I misunderstand the original comment?

@rh-rahulshetty
Copy link
Collaborator

@FAUST-BENCHOU Krkn-AI does generate the right krknctl/krknhub commands with the taints parameter but in case of krknctl, it was not a input variable set in the framework. While I was running the test, I noticed that krknctl scenario were still failing since it was not accepting value set through --taints.

This PR krkn-chaos/krkn-hub#307 helps to bring that as a input parameter to krknctl run command when executing the hog scenarios.

Copy link
Collaborator

@rh-rahulshetty rh-rahulshetty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All changes verified after fixing the taints parameter issue in krknctl. Good to merge!

image

@rh-rahulshetty rh-rahulshetty merged commit 1e0c3b9 into krkn-chaos:main Nov 26, 2025
1 check passed
@FAUST-BENCHOU
Copy link
Contributor Author

Thanks a lot for the detailed explanation, that really helps clarify things.
I had worried that my changes in krkn-ai might have introduced a new issue, so it’s good to know it was actually a missing input on the krknctl side and that it’s now been fixed and merged.
From my side the current PR should be fine, but if you notice anything odd or think something could be improved, I’m very happy to adjust it. I’ll also keep testing the taints behaviour with krknctl, and will follow up with additional fixes if I run into any problems.🙃

@rh-rahulshetty
Copy link
Collaborator

@FAUST-BENCHOU No worries :) and also thank you for all the contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check for taint on node scenarios

3 participants