From 269e21e9eb170e4b7509d22b08275b5cca71b3ea Mon Sep 17 00:00:00 2001 From: Paige Patton <64206430+paigerube14@users.noreply.github.com> Date: Fri, 16 Jan 2026 13:53:48 -0500 Subject: [PATCH 01/14] adding telemety (#1064) Signed-off-by: Paige Patton --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0885b863..e2bf88c4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -115,7 +115,7 @@ jobs: run: | yq -i '.telemetry.username="${{secrets.TELEMETRY_USERNAME}}"' CI/config/common_test_config.yaml yq -i '.telemetry.password="${{secrets.TELEMETRY_PASSWORD}}"' CI/config/common_test_config.yaml - echo "test_telemetry" > ./CI/tests/functional_tests + echo "test_telemetry" >> ./CI/tests/functional_tests # Final common steps - name: Run Functional tests env: From 0cc82dc65d25ba475dec65cbddc548f57d4f4778 Mon Sep 17 00:00:00 2001 From: Paige Patton <64206430+paigerube14@users.noreply.github.com> Date: Fri, 16 Jan 2026 14:24:03 -0500 Subject: [PATCH 02/14] add service hijacking to add to file not overwrite (#1067) Signed-off-by: Paige Patton --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e2bf88c4..668fee38 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -95,7 +95,7 @@ jobs: echo "test_node" >> ./CI/tests/functional_tests echo "test_pod" >> ./CI/tests/functional_tests echo "test_pod_error" >> ./CI/tests/functional_tests - echo "test_service_hijacking" > ./CI/tests/functional_tests + echo "test_service_hijacking" >> ./CI/tests/functional_tests echo "test_pod_network_filter" >> ./CI/tests/functional_tests echo "test_pod_server" >> ./CI/tests/functional_tests echo "test_time" >> ./CI/tests/functional_tests From 9c261e25990011f76186e14643363090e09dc67d Mon Sep 17 00:00:00 2001 From: Ashish Mahajan Date: Sat, 17 Jan 2026 20:43:49 +0530 Subject: [PATCH 03/14] feat(ci): add stale issues automation workflow (#1055) Signed-off-by: AR21SM --- .github/workflows/stale.yml | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/stale.yml diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 00000000..8526fea3 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,40 @@ +name: Close Stale Issues + +on: + schedule: + # Run daily at 1:00 AM UTC + - cron: '0 1 * * *' + workflow_dispatch: + +permissions: + issues: write + +jobs: + stale: + name: Mark and Close Stale Issues + runs-on: ubuntu-latest + steps: + - name: Mark and close stale issues + uses: actions/stale@v9 + with: + days-before-issue-stale: 60 + days-before-issue-close: 14 + stale-issue-label: 'stale' + stale-issue-message: | + This issue has been automatically marked as stale because it has not had any activity in the last 60 days. + It will be closed in 14 days if no further activity occurs. + If this issue is still relevant, please leave a comment or remove the stale label. + Thank you for your contributions to krkn! + close-issue-message: | + This issue has been automatically closed due to inactivity. + If you believe this issue is still relevant, please feel free to reopen it or create a new issue with updated information. + Thank you for your understanding! + close-issue-reason: 'not_planned' + + days-before-pr-stale: -1 + days-before-pr-close: -1 + + # issues with these labels won't be marked stale + exempt-issue-labels: 'bug,enhancement,good first issue' + + remove-stale-when-updated: true From 9a316550e115e86b8d0e972bdc9becd0dc0e0238 Mon Sep 17 00:00:00 2001 From: Ashish Mahajan Date: Mon, 19 Jan 2026 20:07:30 +0530 Subject: [PATCH 04/14] fix: add missing 'as e' to capture exception in TimeActionsScenarioPlugin (#1057) Signed-off-by: AR21SM Co-authored-by: Paige Patton <64206430+paigerube14@users.noreply.github.com> --- .../time_actions/time_actions_scenario_plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/krkn/scenario_plugins/time_actions/time_actions_scenario_plugin.py b/krkn/scenario_plugins/time_actions/time_actions_scenario_plugin.py index 231123d7..c0eae177 100644 --- a/krkn/scenario_plugins/time_actions/time_actions_scenario_plugin.py +++ b/krkn/scenario_plugins/time_actions/time_actions_scenario_plugin.py @@ -43,7 +43,7 @@ class TimeActionsScenarioPlugin(AbstractScenarioPlugin): cerberus.publish_kraken_status( krkn_config, not_reset, start_time, end_time ) - except (RuntimeError, Exception): + except (RuntimeError, Exception) as e: logging.error( f"TimeActionsScenarioPlugin scenario {scenario} failed with exception: {e}" ) From 05bc201528cccd15202773945ca8e9b226798cae Mon Sep 17 00:00:00 2001 From: Paige Patton <64206430+paigerube14@users.noreply.github.com> Date: Mon, 19 Jan 2026 13:14:04 -0500 Subject: [PATCH 05/14] adding chaos_ai deprecation (#1106) Signed-off-by: Paige Patton --- utils/README.md | 31 +++++++++++++++++++++++++++++++ utils/chaos_ai/README.md | 14 ++++++++++++++ utils/chaos_recommender/README.md | 14 ++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 utils/README.md diff --git a/utils/README.md b/utils/README.md new file mode 100644 index 00000000..2573e5ef --- /dev/null +++ b/utils/README.md @@ -0,0 +1,31 @@ +# ⚠️ DEPRECATED + +This directory is **no longer actively maintained** and will not accept new changes. + +## Migration Notice + +All development efforts have been moved to: + +**[github.com/krkn-chaos/krkn-ai](https://github.com/krkn-chaos/krkn-ai)** + +## What This Means + +- ❌ No new features will be added here +- ❌ Bug fixes will not be accepted +- ❌ Pull requests will be closed and redirected +- ℹ️ Existing code remains for historical reference only + +## Next Steps + +If you're looking to: +- **Use** chaos engineering AI features → Visit [krkn-chaos/krkn-ai](https://github.com/krkn-chaos/krkn-ai) +- **Contribute** improvements → Submit to [krkn-chaos/krkn-ai](https://github.com/krkn-chaos/krkn-ai) +- **Report issues** → Open issues at [krkn-chaos/krkn-ai](https://github.com/krkn-chaos/krkn-ai/issues) + +## Questions? + +Please visit the new repository for documentation, examples, and community support. + +--- + +**Last Updated:** January 2026 diff --git a/utils/chaos_ai/README.md b/utils/chaos_ai/README.md index 4c456f8d..045458d5 100644 --- a/utils/chaos_ai/README.md +++ b/utils/chaos_ai/README.md @@ -1,3 +1,17 @@ +# ⚠️ DEPRECATED - This project has moved + +> **All development has moved to [github.com/krkn-chaos/krkn-ai](https://github.com/krkn-chaos/krkn-ai)** +> +> This directory is no longer maintained. Please visit the new repository for: +> - Latest features and updates +> - Active development and support +> - Bug fixes and improvements +> - Documentation and examples +> +> See [../README.md](../README.md) for more information. + +--- + # aichaos Enhancing Chaos Engineering with AI-assisted fault injection for better resiliency and non-functional testing. diff --git a/utils/chaos_recommender/README.md b/utils/chaos_recommender/README.md index 1d1b0061..0774556f 100644 --- a/utils/chaos_recommender/README.md +++ b/utils/chaos_recommender/README.md @@ -1,3 +1,17 @@ +# ⚠️ DEPRECATED - This project has moved + +> **All development has moved to [github.com/krkn-chaos/krkn-ai](https://github.com/krkn-chaos/krkn-ai)** +> +> This directory is no longer maintained. Please visit the new repository for: +> - Latest features and updates +> - Active development and support +> - Bug fixes and improvements +> - Documentation and examples +> +> See [../README.md](../README.md) for more information. + +--- + # Chaos Recommendation Tool This tool, designed for Redhat Kraken, operates through the command line and offers recommendations for chaos testing. It suggests probable chaos test cases that can disrupt application services by analyzing their behavior and assessing their susceptibility to specific fault types. From 773107245c464b33381f890dbbd152af48698282 Mon Sep 17 00:00:00 2001 From: Naga Ravi Chaitanya Elluri Date: Mon, 19 Jan 2026 14:30:04 -0500 Subject: [PATCH 06/14] Add contribution guidelines reference to the PR template (#1108) Signed-off-by: Naga Ravi Chaitanya Elluri --- .github/PULL_REQUEST_TEMPLATE.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 98c7ffc0..7455f8c3 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -23,6 +23,7 @@ If checked, a documentation PR must be created and merged in the [website reposi <-- Add the link to the corresponding documentation PR in the website repository --> # Checklist before requesting a review +[ ] Ensure the changes and proposed solution have been discussed in the relevant issue and have received acknowledgment from the community or maintainers. See [contributing guidelines](https://krkn-chaos.dev/docs/contribution-guidelines/) See [testing your changes](https://krkn-chaos.dev/docs/developers-guide/testing-changes/) and run on any Kubernetes or OpenShift cluster to validate your changes - [ ] I have performed a self-review of my code by running krkn and specific scenario - [ ] If it is a core feature, I have added thorough unit tests with above 80% coverage @@ -43,4 +44,4 @@ OR python -m coverage run -a -m unittest discover -s tests -v ... <---insert test results output---> -``` \ No newline at end of file +``` From 3fd249bb882d83c81ecb14a6d6a8a4b746f5f03e Mon Sep 17 00:00:00 2001 From: AR21SM Date: Tue, 20 Jan 2026 01:18:59 +0530 Subject: [PATCH 07/14] Add stale PR management to workflow Signed-off-by: AR21SM --- .github/workflows/stale.yml | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 8526fea3..902f4ba2 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,4 +1,4 @@ -name: Close Stale Issues +name: Manage Stale Issues and Pull Requests on: schedule: @@ -8,13 +8,14 @@ on: permissions: issues: write + pull-requests: write jobs: stale: - name: Mark and Close Stale Issues + name: Mark and Close Stale Issues and PRs runs-on: ubuntu-latest steps: - - name: Mark and close stale issues + - name: Mark and close stale issues and PRs uses: actions/stale@v9 with: days-before-issue-stale: 60 @@ -31,10 +32,21 @@ jobs: Thank you for your understanding! close-issue-reason: 'not_planned' - days-before-pr-stale: -1 - days-before-pr-close: -1 + days-before-pr-stale: 90 + days-before-pr-close: 14 + stale-pr-label: 'stale' + stale-pr-message: | + This pull request has been automatically marked as stale because it has not had any activity in the last 90 days. + It will be closed in 14 days if no further activity occurs. + If this PR is still relevant, please rebase it, address any pending reviews, or leave a comment. + Thank you for your contributions to krkn! + close-pr-message: | + This pull request has been automatically closed due to inactivity. + If you believe this PR is still relevant, please feel free to reopen it or create a new pull request with updated changes. + Thank you for your understanding! - # issues with these labels won't be marked stale + # Exempt labels exempt-issue-labels: 'bug,enhancement,good first issue' + exempt-pr-labels: 'pending discussions,hold' remove-stale-when-updated: true From b9dd4e40d34c618eeb011418b3209c4142d16e8a Mon Sep 17 00:00:00 2001 From: Ashish Mahajan Date: Tue, 20 Jan 2026 21:30:50 +0530 Subject: [PATCH 08/14] fix(hogs): correct off-by-one error in random node selection (#1112) Signed-off-by: AR21SM --- krkn/scenario_plugins/hogs/hogs_scenario_plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/krkn/scenario_plugins/hogs/hogs_scenario_plugin.py b/krkn/scenario_plugins/hogs/hogs_scenario_plugin.py index 6b7ced73..804d6b5c 100644 --- a/krkn/scenario_plugins/hogs/hogs_scenario_plugin.py +++ b/krkn/scenario_plugins/hogs/hogs_scenario_plugin.py @@ -53,7 +53,7 @@ class HogsScenarioPlugin(AbstractScenarioPlugin): raise Exception("no available nodes to schedule workload") if not has_selector: - available_nodes = [available_nodes[random.randint(0, len(available_nodes))]] + available_nodes = [available_nodes[random.randint(0, len(available_nodes) - 1)]] if scenario_config.number_of_nodes and len(available_nodes) > scenario_config.number_of_nodes: available_nodes = random.sample(available_nodes, scenario_config.number_of_nodes) From 37ca4bbce750ca460b3657683ff938cdc17872e9 Mon Sep 17 00:00:00 2001 From: Paige Patton <64206430+paigerube14@users.noreply.github.com> Date: Tue, 20 Jan 2026 13:33:28 -0500 Subject: [PATCH 09/14] removing unneeded requirement (#1066) Signed-off-by: Paige Patton --- requirements.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 494eb303..27d44025 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,6 @@ azure-identity==1.16.1 azure-keyvault==4.2.0 azure-mgmt-compute==30.5.0 azure-mgmt-network==27.0.0 -itsdangerous==2.0.1 coverage==7.6.12 datetime==5.4 docker>=6.0,<7.0 # docker 7.0+ has breaking changes with Unix sockets @@ -33,7 +32,6 @@ requests-unixsocket>=0.4.0 # Required for Docker Unix socket support service_identity==24.1.0 PyYAML==6.0.1 setuptools==78.1.1 -werkzeug==3.1.4 wheel==0.42.0 zope.interface==5.4.0 From 819191866d356775db938d21ae03218864de900b Mon Sep 17 00:00:00 2001 From: Darshan Jain Date: Sat, 31 Jan 2026 23:41:49 +0530 Subject: [PATCH 10/14] Add CLAUDE.md for AI-assisted development (#1141) Signed-off-by: ddjain --- CLAUDE.md | 273 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 273 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000..8f01589e --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,273 @@ +# CLAUDE.md - Krkn Chaos Engineering Framework + +## Project Overview + +Krkn (Kraken) is a chaos engineering tool for Kubernetes/OpenShift clusters. It injects deliberate failures to validate cluster resilience. Plugin-based architecture with multi-cloud support (AWS, Azure, GCP, IBM Cloud, VMware, Alibaba, OpenStack). + +## Repository Structure + +``` +krkn/ +├── krkn/ +│ ├── scenario_plugins/ # Chaos scenario plugins (pod, node, network, hogs, etc.) +│ ├── utils/ # Utility functions +│ ├── rollback/ # Rollback management +│ ├── prometheus/ # Prometheus integration +│ └── cerberus/ # Health monitoring +├── tests/ # Unit tests (unittest framework) +├── scenarios/ # Example scenario configs (openshift/, kube/, kind/) +├── config/ # Configuration files +└── CI/ # CI/CD test scripts +``` + +## Quick Start + +```bash +# Setup (ALWAYS use virtual environment) +python3 -m venv venv +source venv/bin/activate +pip install -r requirements.txt + +# Run Krkn +python run_kraken.py --config config/config.yaml + +# Note: Scenarios are specified in config.yaml under kraken.chaos_scenarios +# There is no --scenario flag; edit config/config.yaml to select scenarios + +# Run tests +python -m unittest discover -s tests -v +python -m coverage run -a -m unittest discover -s tests -v +``` + +## Critical Requirements + +### Python Environment +- **Python 3.9+** required +- **NEVER install packages globally** - always use virtual environment +- **CRITICAL**: `docker` must be <7.0 and `requests` must be <2.32 (Unix socket compatibility) + +### Key Dependencies +- **krkn-lib** (5.1.13): Core library for Kubernetes/OpenShift operations +- **kubernetes** (34.1.0): Kubernetes Python client +- **docker** (<7.0), **requests** (<2.32): DO NOT upgrade without verifying compatibility +- Cloud SDKs: boto3 (AWS), azure-mgmt-* (Azure), google-cloud-compute (GCP), ibm_vpc (IBM), pyVmomi (VMware) + +## Plugin Architecture (CRITICAL) + +**Strictly enforced naming conventions:** + +### Naming Rules +- **Module files**: Must end with `_scenario_plugin.py` and use snake_case + - Example: `pod_disruption_scenario_plugin.py` +- **Class names**: Must be CamelCase and end with `ScenarioPlugin` + - Example: `PodDisruptionScenarioPlugin` + - Must match module filename (snake_case ↔ CamelCase) +- **Directory structure**: Plugin dirs CANNOT contain "scenario" or "plugin" + - Location: `krkn/scenario_plugins//` + +### Plugin Implementation +Every plugin MUST: +1. Extend `AbstractScenarioPlugin` +2. Implement `run()` method +3. Implement `get_scenario_types()` method + +```python +from krkn.scenario_plugins import AbstractScenarioPlugin + +class PodDisruptionScenarioPlugin(AbstractScenarioPlugin): + def run(self, config, scenarios_list, kubeconfig_path, wait_duration): + pass + + def get_scenario_types(self): + return ["pod_scenarios", "pod_outage"] +``` + +### Creating a New Plugin +1. Create directory: `krkn/scenario_plugins//` +2. Create module: `_scenario_plugin.py` +3. Create class: `ScenarioPlugin` extending `AbstractScenarioPlugin` +4. Implement `run()` and `get_scenario_types()` +5. Create unit test: `tests/test__scenario_plugin.py` +6. Add example scenario: `scenarios//.yaml` + +**DO NOT**: Violate naming conventions (factory will reject), include "scenario"/"plugin" in directory names, create plugins without tests. + +## Testing + +### Unit Tests +```bash +# Run all tests +python -m unittest discover -s tests -v + +# Specific test +python -m unittest tests.test_pod_disruption_scenario_plugin + +# With coverage +python -m coverage run -a -m unittest discover -s tests -v +python -m coverage html +``` + +**Test requirements:** +- Naming: `test__scenario_plugin.py` +- Mock external dependencies (Kubernetes API, cloud providers) +- Test success, failure, and edge cases +- Keep tests isolated and independent + +### Functional Tests +Located in `CI/tests/`. Can be run locally on a kind cluster with Prometheus and Elasticsearch set up. + +**Setup for local testing:** +1. Deploy Prometheus and Elasticsearch on your kind cluster: + - Prometheus setup: https://krkn-chaos.dev/docs/developers-guide/testing-changes/#prometheus + - Elasticsearch setup: https://krkn-chaos.dev/docs/developers-guide/testing-changes/#elasticsearch + +2. Or disable monitoring features in `config/config.yaml`: + ```yaml + performance_monitoring: + enable_alerts: False + enable_metrics: False + check_critical_alerts: False + ``` + +**Note:** Functional tests run automatically in CI with full monitoring enabled. + +## Cloud Provider Implementations + +Node chaos scenarios are cloud-specific. Each in `krkn/scenario_plugins/node_actions/_node_scenarios.py`: +- AWS, Azure, GCP, IBM Cloud, VMware, Alibaba, OpenStack, Bare Metal + +Implement: stop, start, reboot, terminate instances. + +**When modifying**: Maintain consistency with other providers, handle API errors, add logging, update tests. + +### Adding Cloud Provider Support +1. Create: `krkn/scenario_plugins/node_actions/_node_scenarios.py` +2. Extend: `abstract_node_scenarios.AbstractNodeScenarios` +3. Implement: `stop_instances`, `start_instances`, `reboot_instances`, `terminate_instances` +4. Add SDK to `requirements.txt` +5. Create unit test with mocked SDK +6. Add example scenario: `scenarios/openshift/_node_scenarios.yml` + +## Configuration + +**Main config**: `config/config.yaml` +- `kraken`: Core settings +- `cerberus`: Health monitoring +- `performance_monitoring`: Prometheus +- `elastic`: Elasticsearch telemetry + +**Scenario configs**: `scenarios/` directory +```yaml +- config: + scenario_type: # Must match plugin's get_scenario_types() +``` + +## Code Style + +- **Import order**: Standard library, third-party, local imports +- **Naming**: snake_case (functions/variables), CamelCase (classes) +- **Logging**: Use Python's `logging` module +- **Error handling**: Return appropriate exit codes +- **Docstrings**: Required for public functions/classes + +## Exit Codes + +Krkn uses specific exit codes to communicate execution status: + +- `0`: Success - all scenarios passed, no critical alerts +- `1`: Scenario failure - one or more scenarios failed +- `2`: Critical alerts fired during execution +- `3+`: Health check failure (Cerberus monitoring detected issues) + +**When implementing scenarios:** +- Return `0` on success +- Return `1` on scenario-specific failures +- Propagate health check failures appropriately +- Log exit code reasons clearly + +## Container Support + +Krkn can run inside a container. See `containers/` directory. + +**Building custom image:** +```bash +cd containers +./compile_dockerfile.sh # Generates Dockerfile from template +docker build -t krkn:latest . +``` + +**Running containerized:** +```bash +docker run -v ~/.kube:/root/.kube:Z \ + -v $(pwd)/config:/config:Z \ + -v $(pwd)/scenarios:/scenarios:Z \ + krkn:latest +``` + +## Git Workflow + +- **NEVER commit directly to main** +- **NEVER use `--force` without approval** +- **ALWAYS create feature branches**: `git checkout -b feature/description` +- **ALWAYS run tests before pushing** + +**Conventional commits**: `feat:`, `fix:`, `test:`, `docs:`, `refactor:` + +```bash +git checkout main && git pull origin main +git checkout -b feature/your-feature-name +# Make changes, write tests +python -m unittest discover -s tests -v +git add +git commit -m "feat: description" +git push -u origin feature/your-feature-name +``` + +## Environment Variables + +- `KUBECONFIG`: Path to kubeconfig +- `AWS_*`, `AZURE_*`, `GOOGLE_APPLICATION_CREDENTIALS`: Cloud credentials +- `PROMETHEUS_URL`, `ELASTIC_URL`, `ELASTIC_PASSWORD`: Monitoring config + +**NEVER commit credentials or API keys.** + +## Common Pitfalls + +1. Missing virtual environment - always activate venv +2. Running functional tests without cluster setup +3. Ignoring exit codes +4. Modifying krkn-lib directly (it's a separate package) +5. Upgrading docker/requests beyond version constraints + +## Before Writing Code + +1. Check for existing implementations +2. Review existing plugins as examples +3. Maintain consistency with cloud provider patterns +4. Plan rollback logic +5. Write tests alongside code +6. Update documentation + +## When Adding Dependencies + +1. Check if functionality exists in krkn-lib or current dependencies +2. Verify compatibility with existing versions +3. Pin specific versions in `requirements.txt` +4. Check for security vulnerabilities +5. Test thoroughly for conflicts + +## Common Development Tasks + +### Modifying Existing Plugin +1. Read plugin code and corresponding test +2. Make changes +3. Update/add unit tests +4. Run: `python -m unittest tests.test__scenario_plugin` + +### Writing Unit Tests +1. Create: `tests/test__scenario_plugin.py` +2. Import `unittest` and plugin class +3. Mock external dependencies +4. Test success, failure, and edge cases +5. Run: `python -m unittest tests.test__scenario_plugin` + From 4a0f4e7cab15ccbdb3129e94e2eb641e5f4922b4 Mon Sep 17 00:00:00 2001 From: Chaudary Farhan Saleem Date: Mon, 2 Feb 2026 19:23:44 +0500 Subject: [PATCH 11/14] fix: correct spelling typos in log messages (#1145) - Fix 'wating' - 'waiting' (2 occurrences) - Fix 'successfuly' - 'successfully' (12 occurrences) - Fix 'orginal' - 'original' (1 occurrence) Improves professionalism of log output and code comments. Signed-off-by: farhann_saleem --- krkn/scenario_plugins/abstract_scenario_plugin.py | 2 +- .../node_actions/abstract_node_scenarios.py | 6 +++--- krkn/scenario_plugins/node_actions/aws_node_scenarios.py | 4 ++-- krkn/scenario_plugins/node_actions/bm_node_scenarios.py | 2 +- krkn/scenario_plugins/node_actions/docker_node_scenarios.py | 4 ++-- krkn/scenario_plugins/node_actions/gcp_node_scenarios.py | 4 ++-- .../node_actions/openstack_node_scenarios.py | 4 ++-- .../zone_outage/zone_outage_scenario_plugin.py | 4 ++-- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/krkn/scenario_plugins/abstract_scenario_plugin.py b/krkn/scenario_plugins/abstract_scenario_plugin.py index 676890ae..54da81db 100644 --- a/krkn/scenario_plugins/abstract_scenario_plugin.py +++ b/krkn/scenario_plugins/abstract_scenario_plugin.py @@ -146,7 +146,7 @@ class AbstractScenarioPlugin(ABC): if scenario_telemetry.exit_status != 0: failed_scenarios.append(scenario_config) scenario_telemetries.append(scenario_telemetry) - logging.info(f"wating {wait_duration} before running the next scenario") + logging.info(f"waiting {wait_duration} before running the next scenario") time.sleep(wait_duration) return failed_scenarios, scenario_telemetries diff --git a/krkn/scenario_plugins/node_actions/abstract_node_scenarios.py b/krkn/scenario_plugins/node_actions/abstract_node_scenarios.py index 677892d3..a86f8e4f 100644 --- a/krkn/scenario_plugins/node_actions/abstract_node_scenarios.py +++ b/krkn/scenario_plugins/node_actions/abstract_node_scenarios.py @@ -76,7 +76,7 @@ class abstract_node_scenarios: nodeaction.wait_for_unknown_status(node, timeout, self.kubecli, affected_node) logging.info("The kubelet of the node %s has been stopped" % (node)) - logging.info("stop_kubelet_scenario has been successfuly injected!") + logging.info("stop_kubelet_scenario has been successfully injected!") except Exception as e: logging.error( "Failed to stop the kubelet of the node. Encountered following " @@ -108,7 +108,7 @@ class abstract_node_scenarios: ) nodeaction.wait_for_ready_status(node, timeout, self.kubecli,affected_node) logging.info("The kubelet of the node %s has been restarted" % (node)) - logging.info("restart_kubelet_scenario has been successfuly injected!") + logging.info("restart_kubelet_scenario has been successfully injected!") except Exception as e: logging.error( "Failed to restart the kubelet of the node. Encountered following " @@ -128,7 +128,7 @@ class abstract_node_scenarios: "oc debug node/" + node + " -- chroot /host " "dd if=/dev/urandom of=/proc/sysrq-trigger" ) - logging.info("node_crash_scenario has been successfuly injected!") + logging.info("node_crash_scenario has been successfully injected!") except Exception as e: logging.error( "Failed to crash the node. Encountered following exception: %s. " diff --git a/krkn/scenario_plugins/node_actions/aws_node_scenarios.py b/krkn/scenario_plugins/node_actions/aws_node_scenarios.py index 36704cdd..e11f837b 100644 --- a/krkn/scenario_plugins/node_actions/aws_node_scenarios.py +++ b/krkn/scenario_plugins/node_actions/aws_node_scenarios.py @@ -379,7 +379,7 @@ class aws_node_scenarios(abstract_node_scenarios): logging.info( "Node with instance ID: %s has been terminated" % (instance_id) ) - logging.info("node_termination_scenario has been successfuly injected!") + logging.info("node_termination_scenario has been successfully injected!") except Exception as e: logging.error( "Failed to terminate node instance. Encountered following exception:" @@ -408,7 +408,7 @@ class aws_node_scenarios(abstract_node_scenarios): logging.info( "Node with instance ID: %s has been rebooted" % (instance_id) ) - logging.info("node_reboot_scenario has been successfuly injected!") + logging.info("node_reboot_scenario has been successfully injected!") except Exception as e: logging.error( "Failed to reboot node instance. Encountered following exception:" diff --git a/krkn/scenario_plugins/node_actions/bm_node_scenarios.py b/krkn/scenario_plugins/node_actions/bm_node_scenarios.py index 8d80b075..f9667c70 100644 --- a/krkn/scenario_plugins/node_actions/bm_node_scenarios.py +++ b/krkn/scenario_plugins/node_actions/bm_node_scenarios.py @@ -229,7 +229,7 @@ class bm_node_scenarios(abstract_node_scenarios): nodeaction.wait_for_unknown_status(node, timeout, self.kubecli, affected_node) nodeaction.wait_for_ready_status(node, timeout, self.kubecli, affected_node) logging.info("Node with bmc address: %s has been rebooted" % (bmc_addr)) - logging.info("node_reboot_scenario has been successfuly injected!") + logging.info("node_reboot_scenario has been successfully injected!") except Exception as e: logging.error( "Failed to reboot node instance. Encountered following exception:" diff --git a/krkn/scenario_plugins/node_actions/docker_node_scenarios.py b/krkn/scenario_plugins/node_actions/docker_node_scenarios.py index 37dd0a0e..9731883a 100644 --- a/krkn/scenario_plugins/node_actions/docker_node_scenarios.py +++ b/krkn/scenario_plugins/node_actions/docker_node_scenarios.py @@ -237,7 +237,7 @@ class docker_node_scenarios(abstract_node_scenarios): logging.info( "Node with container ID: %s has been terminated" % (container_id) ) - logging.info("node_termination_scenario has been successfuly injected!") + logging.info("node_termination_scenario has been successfully injected!") except Exception as e: logging.error( "Failed to terminate node instance. Encountered following exception:" @@ -264,7 +264,7 @@ class docker_node_scenarios(abstract_node_scenarios): logging.info( "Node with container ID: %s has been rebooted" % (container_id) ) - logging.info("node_reboot_scenario has been successfuly injected!") + logging.info("node_reboot_scenario has been successfully injected!") except Exception as e: logging.error( "Failed to reboot node instance. Encountered following exception:" diff --git a/krkn/scenario_plugins/node_actions/gcp_node_scenarios.py b/krkn/scenario_plugins/node_actions/gcp_node_scenarios.py index 78eec21d..cf7d6044 100644 --- a/krkn/scenario_plugins/node_actions/gcp_node_scenarios.py +++ b/krkn/scenario_plugins/node_actions/gcp_node_scenarios.py @@ -309,7 +309,7 @@ class gcp_node_scenarios(abstract_node_scenarios): logging.info( "Node with instance ID: %s has been terminated" % instance_id ) - logging.info("node_termination_scenario has been successfuly injected!") + logging.info("node_termination_scenario has been successfully injected!") except Exception as e: logging.error( "Failed to terminate node instance. Encountered following exception:" @@ -341,7 +341,7 @@ class gcp_node_scenarios(abstract_node_scenarios): logging.info( "Node with instance ID: %s has been rebooted" % instance_id ) - logging.info("node_reboot_scenario has been successfuly injected!") + logging.info("node_reboot_scenario has been successfully injected!") except Exception as e: logging.error( "Failed to reboot node instance. Encountered following exception:" diff --git a/krkn/scenario_plugins/node_actions/openstack_node_scenarios.py b/krkn/scenario_plugins/node_actions/openstack_node_scenarios.py index e3840e0a..044bae9b 100644 --- a/krkn/scenario_plugins/node_actions/openstack_node_scenarios.py +++ b/krkn/scenario_plugins/node_actions/openstack_node_scenarios.py @@ -184,7 +184,7 @@ class openstack_node_scenarios(abstract_node_scenarios): nodeaction.wait_for_unknown_status(node, timeout, self.kubecli, affected_node) nodeaction.wait_for_ready_status(node, timeout, self.kubecli, affected_node) logging.info("Node with instance name: %s has been rebooted" % (node)) - logging.info("node_reboot_scenario has been successfuly injected!") + logging.info("node_reboot_scenario has been successfully injected!") except Exception as e: logging.error( "Failed to reboot node instance. Encountered following exception:" @@ -249,7 +249,7 @@ class openstack_node_scenarios(abstract_node_scenarios): node_ip.strip(), service, ssh_private_key, timeout ) logging.info("Service status checked on %s" % (node_ip)) - logging.info("Check service status is successfuly injected!") + logging.info("Check service status is successfully injected!") except Exception as e: logging.error( "Failed to check service status. Encountered following exception:" diff --git a/krkn/scenario_plugins/zone_outage/zone_outage_scenario_plugin.py b/krkn/scenario_plugins/zone_outage/zone_outage_scenario_plugin.py index 3fea90c6..a917366c 100644 --- a/krkn/scenario_plugins/zone_outage/zone_outage_scenario_plugin.py +++ b/krkn/scenario_plugins/zone_outage/zone_outage_scenario_plugin.py @@ -140,7 +140,7 @@ class ZoneOutageScenarioPlugin(AbstractScenarioPlugin): network_association_ids[0], acl_id ) - # capture the orginal_acl_id, created_acl_id and + # capture the original_acl_id, created_acl_id and # new association_id to use during the recovery ids[new_association_id] = original_acl_id @@ -156,7 +156,7 @@ class ZoneOutageScenarioPlugin(AbstractScenarioPlugin): new_association_id, original_acl_id ) logging.info( - "Wating for 60 seconds to make sure " "the changes are in place" + "Waiting for 60 seconds to make sure " "the changes are in place" ) time.sleep(60) From 898ce7664817f0c62fecae7740090ecf4c53fbbe Mon Sep 17 00:00:00 2001 From: Paige Patton <64206430+paigerube14@users.noreply.github.com> Date: Mon, 2 Feb 2026 12:00:33 -0500 Subject: [PATCH 12/14] adding python3.11 updates (#1012) Signed-off-by: Paige Patton --- .github/workflows/tests.yml | 5 +++-- containers/Dockerfile.template | 12 ++++++------ requirements.txt | 4 ++-- tests/test_gcp_node_scenarios.py | 9 +++++---- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 668fee38..167b6575 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -32,13 +32,14 @@ jobs: - name: Install Python uses: actions/setup-python@v4 with: - python-version: '3.9' + python-version: '3.11' architecture: 'x64' - name: Install environment run: | sudo apt-get install build-essential python3-dev pip install --upgrade pip pip install -r requirements.txt + pip install coverage - name: Deploy test workloads run: | @@ -181,7 +182,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: '3.11' - name: Copy badge on GitHub Page Repo env: COLOR: yellow diff --git a/containers/Dockerfile.template b/containers/Dockerfile.template index 3da243e4..4e029d6e 100644 --- a/containers/Dockerfile.template +++ b/containers/Dockerfile.template @@ -41,7 +41,7 @@ ENV KUBECONFIG /home/krkn/.kube/config # This overwrites any existing configuration in /etc/yum.repos.d/kubernetes.repo RUN dnf update && dnf install -y --setopt=install_weak_deps=False \ - git python39 jq yq gettext wget which ipmitool openssh-server &&\ + git python3.11 jq yq gettext wget which ipmitool openssh-server &&\ dnf clean all # copy oc client binary from oc-build image @@ -63,15 +63,15 @@ RUN if [ -n "$PR_NUMBER" ]; then git fetch origin pull/${PR_NUMBER}/head:pr-${PR # if it is a TAG trigger checkout the tag RUN if [ -n "$TAG" ]; then git checkout "$TAG";fi -RUN python3.9 -m ensurepip --upgrade --default-pip -RUN python3.9 -m pip install --upgrade pip setuptools==78.1.1 +RUN python3.11 -m ensurepip --upgrade --default-pip +RUN python3.11 -m pip install --upgrade pip setuptools==78.1.1 # removes the the vulnerable versions of setuptools and pip RUN rm -rf "$(pip cache dir)" RUN rm -rf /tmp/* -RUN rm -rf /usr/local/lib/python3.9/ensurepip/_bundled -RUN pip3.9 install -r requirements.txt -RUN pip3.9 install jsonschema +RUN rm -rf /usr/local/lib/python3.11/ensurepip/_bundled +RUN pip3.11 install -r requirements.txt +RUN pip3.11 install jsonschema LABEL krknctl.title.global="Krkn Base Image" LABEL krknctl.description.global="This is the krkn base image." diff --git a/requirements.txt b/requirements.txt index 27d44025..7c2a0469 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,7 +15,7 @@ google-cloud-compute==1.22.0 ibm_cloud_sdk_core==3.18.0 ibm_vpc==0.20.0 jinja2==3.1.6 -krkn-lib==5.1.13 +krkn-lib==6.0 lxml==5.1.0 kubernetes==34.1.0 numpy==1.26.4 @@ -33,7 +33,7 @@ service_identity==24.1.0 PyYAML==6.0.1 setuptools==78.1.1 wheel==0.42.0 -zope.interface==5.4.0 +zope.interface==6.1 git+https://github.com/vmware/vsphere-automation-sdk-python.git@v8.0.0.0 cryptography>=42.0.4 # not directly required, pinned by Snyk to avoid a vulnerability diff --git a/tests/test_gcp_node_scenarios.py b/tests/test_gcp_node_scenarios.py index 5d4a9c6e..12f5723d 100644 --- a/tests/test_gcp_node_scenarios.py +++ b/tests/test_gcp_node_scenarios.py @@ -43,14 +43,15 @@ class TestGCP(unittest.TestCase): def setUp(self): """Set up test fixtures""" # Mock google.auth before creating GCP instance - self.auth_patcher = patch('google.auth.default') - self.compute_patcher = patch('google.cloud.compute_v1.InstancesClient') + self.auth_patcher = patch('krkn.scenario_plugins.node_actions.gcp_node_scenarios.google.auth.default') + self.compute_patcher = patch('krkn.scenario_plugins.node_actions.gcp_node_scenarios.compute_v1.InstancesClient') self.mock_auth = self.auth_patcher.start() self.mock_compute_client = self.compute_patcher.start() # Configure auth mock to return credentials and project_id - self.mock_auth.return_value = (MagicMock(), 'test-project-123') + mock_credentials = MagicMock() + self.mock_auth.return_value = (mock_credentials, 'test-project-123') # Create GCP instance with mocked dependencies self.gcp = GCP() @@ -67,7 +68,7 @@ class TestGCP(unittest.TestCase): def test_gcp_init_failure(self): """Test GCP class initialization failure""" - with patch('google.auth.default', side_effect=Exception("Auth error")): + with patch('krkn.scenario_plugins.node_actions.gcp_node_scenarios.google.auth.default', side_effect=Exception("Auth error")): with self.assertRaises(Exception): GCP() From 66e364e2935ed28daa630c368049c23aeb1dc158 Mon Sep 17 00:00:00 2001 From: Paige Patton <64206430+paigerube14@users.noreply.github.com> Date: Mon, 2 Feb 2026 13:46:22 -0500 Subject: [PATCH 13/14] wheel updates (#1148) Signed-off-by: Paige Patton --- requirements.txt | 4 ++-- utils/chaos_ai/requirements.txt | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/requirements.txt b/requirements.txt index 7c2a0469..0f435b99 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,7 +15,7 @@ google-cloud-compute==1.22.0 ibm_cloud_sdk_core==3.18.0 ibm_vpc==0.20.0 jinja2==3.1.6 -krkn-lib==6.0 +krkn-lib==6.0.1 lxml==5.1.0 kubernetes==34.1.0 numpy==1.26.4 @@ -32,7 +32,7 @@ requests-unixsocket>=0.4.0 # Required for Docker Unix socket support service_identity==24.1.0 PyYAML==6.0.1 setuptools==78.1.1 -wheel==0.42.0 +wheel>=0.44.0 zope.interface==6.1 git+https://github.com/vmware/vsphere-automation-sdk-python.git@v8.0.0.0 diff --git a/utils/chaos_ai/requirements.txt b/utils/chaos_ai/requirements.txt index 87fbe41e..58143437 100644 --- a/utils/chaos_ai/requirements.txt +++ b/utils/chaos_ai/requirements.txt @@ -3,8 +3,9 @@ pandas notebook jupyterlab jupyter -seaborn +seaborn==0.13.2 requests wheel -Flask==2.1.0 +Flask==2.2.5 flasgger==0.9.5 +pillow==10.2.0 \ No newline at end of file From a9f1ce8f1b054cd5e7c7aaff64f1df6bbd09e0a2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Feb 2026 13:47:47 -0500 Subject: [PATCH 14/14] Bump pillow from 10.2.0 to 10.3.0 in /utils/chaos_ai (#1149) Bumps [pillow](https://github.com/python-pillow/Pillow) from 10.2.0 to 10.3.0. - [Release notes](https://github.com/python-pillow/Pillow/releases) - [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst) - [Commits](https://github.com/python-pillow/Pillow/compare/10.2.0...10.3.0) --- updated-dependencies: - dependency-name: pillow dependency-version: 10.3.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- utils/chaos_ai/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/chaos_ai/requirements.txt b/utils/chaos_ai/requirements.txt index 58143437..1ff4a141 100644 --- a/utils/chaos_ai/requirements.txt +++ b/utils/chaos_ai/requirements.txt @@ -8,4 +8,4 @@ requests wheel Flask==2.2.5 flasgger==0.9.5 -pillow==10.2.0 \ No newline at end of file +pillow==10.3.0 \ No newline at end of file