<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Developers Guide on Krkn</title><link>https://deploy-preview-247--krkn-chaos.netlify.app/docs/developers-guide/</link><description>Recent content in Developers Guide on Krkn</description><generator>Hugo</generator><language>en</language><atom:link href="https://deploy-preview-247--krkn-chaos.netlify.app/docs/developers-guide/index.xml" rel="self" type="application/rss+xml"/><item><title>Krkn-lib</title><link>https://deploy-preview-247--krkn-chaos.netlify.app/docs/developers-guide/krkn-lib/</link><pubDate>Thu, 05 Jan 2017 00:00:00 +0000</pubDate><guid>https://deploy-preview-247--krkn-chaos.netlify.app/docs/developers-guide/krkn-lib/</guid><description>&lt;p>&lt;img src="https://img.shields.io/pypi/v/krkn-lib?label=PyPi" alt="PyPI">&lt;/p>
&lt;h1 id="krkn-lib">
 krkn-lib
 &lt;a class="td-heading-self-link" href="#krkn-lib" aria-label="Heading self-link">&lt;/a>
&lt;/h1>
&lt;h2 id="krkn-chaos-and-resiliency-testing-tool-foundation-library">
 Krkn Chaos and resiliency testing tool Foundation Library
 &lt;a class="td-heading-self-link" href="#krkn-chaos-and-resiliency-testing-tool-foundation-library" aria-label="Heading self-link">&lt;/a>
&lt;/h2>
&lt;h3 id="contents">
 Contents
 &lt;a class="td-heading-self-link" href="#contents" aria-label="Heading self-link">&lt;/a>
&lt;/h3>
&lt;p>The Library contains Classes, Models and helper functions used in &lt;a href="https://github.com/krkn-chaos/krkn">Kraken&lt;/a> to interact with
Kubernetes, Openshift and other external APIS.
The goal of this library is to give to developers the building blocks to realize new Chaos
Scenarios and to increase the testability and the modularity of the Krkn codebase.&lt;/p></description></item><item><title>Adding scenarios via plugin api</title><link>https://deploy-preview-247--krkn-chaos.netlify.app/docs/developers-guide/scenario_plugin_api/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://deploy-preview-247--krkn-chaos.netlify.app/docs/developers-guide/scenario_plugin_api/</guid><description>&lt;h1 id="scenario-plugin-api">
 Scenario Plugin API:
 &lt;a class="td-heading-self-link" href="#scenario-plugin-api" aria-label="Heading self-link">&lt;/a>
&lt;/h1>
&lt;p>This API enables seamless integration of Scenario Plugins for Krkn. Plugins are automatically
detected and loaded by the plugin loader, provided they extend the &lt;code>AbstractPluginScenario&lt;/code>
abstract class, implement the required methods, and adhere to the specified &lt;a href="https://deploy-preview-247--krkn-chaos.netlify.app/docs/developers-guide/scenario_plugin_api/#naming-conventions">naming conventions&lt;/a>.&lt;/p>
&lt;h2 id="plugin-folder">
 Plugin folder:
 &lt;a class="td-heading-self-link" href="#plugin-folder" aria-label="Heading self-link">&lt;/a>
&lt;/h2>
&lt;p>The plugin loader automatically loads plugins found in the &lt;code>krkn/scenario_plugins&lt;/code> directory,
relative to the Krkn root folder. Each plugin must reside in its own directory and can consist
of one or more Python files. The entry point for each plugin is a Python class that extends the
&lt;a href="https://github.com/krkn-chaos/krkn/blob/main/krkn/scenario_plugins/abstract_scenario_plugin.py">AbstractPluginScenario&lt;/a> abstract class and implements its required methods.&lt;/p></description></item><item><title>Adding New Scenario to Krkn-hub</title><link>https://deploy-preview-247--krkn-chaos.netlify.app/docs/developers-guide/editing-krkn-hub/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://deploy-preview-247--krkn-chaos.netlify.app/docs/developers-guide/editing-krkn-hub/</guid><description>&lt;h2 id="addingediting-a-new-scenario-to-krkn-hub">
 Adding/Editing a New Scenario to Krkn-hub
 &lt;a class="td-heading-self-link" href="#addingediting-a-new-scenario-to-krkn-hub" aria-label="Heading self-link">&lt;/a>
&lt;/h2>
&lt;ol>
&lt;li>
&lt;p>Create folder with scenario name under &lt;a href="https://github.com/krkn-chaos/krkn-hub/tree/main">krkn-hub&lt;/a>&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Create generic scenario template with environment variables&lt;/p>
&lt;p>a. See &lt;a href="https://github.com/krkn-chaos/krkn-hub/blob/main/application-outages/app_outages.yaml.template">scenario.yaml&lt;/a> for example&lt;/p>
&lt;p>b. Almost all parameters should be set using a variable (these will be set in the env.sh file or through the command line environment variables)&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Add defaults for any environment variables in an &amp;ldquo;env.sh&amp;rdquo; file&lt;/p>
&lt;p>a. See &lt;a href="https://github.com/krkn-chaos/krkn-hub/blob/main/application-outages/env.sh">env.sh&lt;/a> for example&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Create script to run.sh chaos scenario
a. See &lt;a href="https://github.com/krkn-chaos/krkn-hub/blob/main/application-outages/run.sh">run.sh&lt;/a> for example&lt;/p></description></item><item><title>Adding New Scenario to Krknctl</title><link>https://deploy-preview-247--krkn-chaos.netlify.app/docs/developers-guide/krknctl-edits/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://deploy-preview-247--krkn-chaos.netlify.app/docs/developers-guide/krknctl-edits/</guid><description>&lt;h1 id="adding-a-new-scenario-to-krknctl">
 Adding a New Scenario to Krknctl
 &lt;a class="td-heading-self-link" href="#adding-a-new-scenario-to-krknctl" aria-label="Heading self-link">&lt;/a>
&lt;/h1>
&lt;p>For krknctl to find the parameters of the scenario it uses a krknctl input json file. Once this file is added to krkn-hub, krknctl will be able to find it along with the details of how to run the scenario.&lt;/p>
&lt;h2 id="add-krknctl-input-json">
 Add KrknCtl Input Json
 &lt;a class="td-heading-self-link" href="#add-krknctl-input-json" aria-label="Heading self-link">&lt;/a>
&lt;/h2>
&lt;p>This file adds every environment variable that is set up for krkn-hub to be defined as a flag to the krknctl cli command. There are a number of different type of variables that you can use, each with their own required fields. See below for an example of the different variable types&lt;/p></description></item><item><title>Adding to Krkn Test Suite</title><link>https://deploy-preview-247--krkn-chaos.netlify.app/docs/developers-guide/add-tests-krkn/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://deploy-preview-247--krkn-chaos.netlify.app/docs/developers-guide/add-tests-krkn/</guid><description>&lt;p>This guide covers how to add both unit tests and functional tests to the krkn project. Tests are essential for ensuring code quality and preventing regressions.&lt;/p>
&lt;h1 id="unit-tests">
 Unit Tests
 &lt;a class="td-heading-self-link" href="#unit-tests" aria-label="Heading self-link">&lt;/a>
&lt;/h1>
&lt;p>Unit tests in krkn are located in the &lt;code>tests/&lt;/code> directory and use Python&amp;rsquo;s &lt;code>unittest&lt;/code> framework with comprehensive mocking to avoid requiring external dependencies like cloud providers or Kubernetes clusters.&lt;/p>
&lt;h2 id="creating-a-unit-test">
 Creating a Unit Test
 &lt;a class="td-heading-self-link" href="#creating-a-unit-test" aria-label="Heading self-link">&lt;/a>
&lt;/h2>
&lt;h3 id="1-file-location-and-naming">
 1. File Location and Naming
 &lt;a class="td-heading-self-link" href="#1-file-location-and-naming" aria-label="Heading self-link">&lt;/a>
&lt;/h3>
&lt;p>Place your test file in the &lt;code>tests/&lt;/code> directory with the naming pattern &lt;code>test_&amp;lt;feature&amp;gt;.py&lt;/code>:&lt;/p></description></item><item><title>Testing your changes</title><link>https://deploy-preview-247--krkn-chaos.netlify.app/docs/developers-guide/testing-changes/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://deploy-preview-247--krkn-chaos.netlify.app/docs/developers-guide/testing-changes/</guid><description>&lt;ul>
&lt;li>&lt;a href="https://deploy-preview-247--krkn-chaos.netlify.app/docs/developers-guide/testing-changes/#configure-kind-testing-environment">Configure Kind environment&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://deploy-preview-247--krkn-chaos.netlify.app/docs/developers-guide/testing-changes/#testing-changes-in-krkn-lib">Testing Changes in Krkn-lib&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://deploy-preview-247--krkn-chaos.netlify.app/docs/developers-guide/testing-changes/#testing-changes-in-krkn">Testing Changes in Krkn&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://deploy-preview-247--krkn-chaos.netlify.app/docs/developers-guide/testing-changes/#testing-changes-for-krkn-hub">Testing Changes in Krkn-hub&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://deploy-preview-247--krkn-chaos.netlify.app/docs/developers-guide/testing-changes/#testing-changes-in-krknctl">Testing Changes in Krknctl&lt;/a>&lt;/li>
&lt;/ul>
&lt;p>This page gives details about how you can get a kind cluster configured to be able to run on krkn-lib (the lowest level of krkn-chaos repos) up through krknctl (our easiest way to run and highest level repo)&lt;/p>
&lt;h2 id="configure-kind-testing-environment">
 Configure Kind Testing Environment
 &lt;a class="td-heading-self-link" href="#configure-kind-testing-environment" aria-label="Heading self-link">&lt;/a>
&lt;/h2>
&lt;ol>
&lt;li>
&lt;p>&lt;a href="https://kind.sigs.k8s.io/docs/user/quick-start/#installation">Install kind&lt;/a>&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Create cluster using &lt;a href="https://github.com/krkn-chaos/krkn-lib/blob/main/kind-config.yml">kind-config.yml&lt;/a> under &lt;em>krkn-lib&lt;/em> base folder&lt;/p></description></item><item><title>Health Check Plugins</title><link>https://deploy-preview-247--krkn-chaos.netlify.app/docs/developers-guide/health-check-plugins/</link><pubDate>Mon, 01 Jan 2024 00:00:00 +0000</pubDate><guid>https://deploy-preview-247--krkn-chaos.netlify.app/docs/developers-guide/health-check-plugins/</guid><description>&lt;h1 id="health-check-plugins">
 Health Check Plugins
 &lt;a class="td-heading-self-link" href="#health-check-plugins" aria-label="Heading self-link">&lt;/a>
&lt;/h1>
&lt;p>Health check plugins allow Krkn to continuously monitor the health of your services and infrastructure &lt;strong>during&lt;/strong> chaos experiments. They run in background threads alongside the chaos scenario, detecting outages, tracking downtime duration, and collecting telemetry data.&lt;/p>
&lt;h2 id="overview">
 Overview
 &lt;a class="td-heading-self-link" href="#overview" aria-label="Heading self-link">&lt;/a>
&lt;/h2>
&lt;p>The health check system uses a plugin architecture:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>&lt;code>HealthCheckFactory&lt;/code>&lt;/strong> — automatically discovers and loads all plugins from the &lt;code>krkn.health_checks&lt;/code> package&lt;/li>
&lt;li>&lt;strong>&lt;code>AbstractHealthCheckPlugin&lt;/code>&lt;/strong> — base class all plugins must extend&lt;/li>
&lt;li>Plugins run in separate threads and write telemetry to a shared queue&lt;/li>
&lt;li>The factory tracks all active plugin instances and provides lifecycle management (&lt;code>increment_all_iterations&lt;/code>, &lt;code>stop_all&lt;/code>)&lt;/li>
&lt;/ul>
&lt;h3 id="exit-codes">
 Exit Codes
 &lt;a class="td-heading-self-link" href="#exit-codes" aria-label="Heading self-link">&lt;/a>
&lt;/h3>
&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th>Code&lt;/th>
 &lt;th>Meaning&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td>&lt;code>0&lt;/code>&lt;/td>
 &lt;td>Success — all health checks passed&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>2&lt;/code>&lt;/td>
 &lt;td>Critical alert detected during the run&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>3&lt;/code>&lt;/td>
 &lt;td>Health check failure (e.g. &lt;code>exit_on_failure: true&lt;/code> triggered)&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table>
&lt;hr>
&lt;h2 id="built-in-plugins">
 Built-in Plugins
 &lt;a class="td-heading-self-link" href="#built-in-plugins" aria-label="Heading self-link">&lt;/a>
&lt;/h2>
&lt;h3 id="http-health-check-health_checks">
 &lt;a href="https://deploy-preview-247--krkn-chaos.netlify.app/docs/krkn/health-checks/">HTTP Health Check&lt;/a> (&lt;code>health_checks&lt;/code>)
 &lt;a class="td-heading-self-link" href="#http-health-check-health_checks" aria-label="Heading self-link">&lt;/a>
&lt;/h3>
&lt;p>Monitors HTTP endpoints by making periodic GET requests. Tracks status changes, measures downtime duration, and records telemetry for each state transition.&lt;/p></description></item></channel></rss>