diff --git a/README.md b/README.md index 6a58f474..739e0a80 100644 --- a/README.md +++ b/README.md @@ -56,8 +56,8 @@ Instructions on how to setup the config and the options supported can be found a ### Kubernetes/OpenShift chaos scenarios supported -Scenario type | Kubernetes | OpenShift ---------------------------- | ------------- | -------------------- | +Scenario type | Kubernetes | OpenShift +--------------------------- | ------------- |--------------------| [Pod Scenarios](docs/pod_scenarios.md) | :heavy_check_mark: | :heavy_check_mark: | [Container Scenarios](docs/container_scenarios.md) | :heavy_check_mark: | :heavy_check_mark: | [Node Scenarios](docs/node_scenarios.md) | :heavy_check_mark: | :heavy_check_mark: | @@ -69,7 +69,8 @@ Scenario type | Kubernetes | OpenShift [Application_outages](docs/application_outages.md) | :heavy_check_mark: | :heavy_check_mark: | [PVC scenario](docs/pvc_scenario.md) | :heavy_check_mark: | :heavy_check_mark: | [Network_Chaos](docs/network_chaos.md) | :heavy_check_mark: | :heavy_check_mark: | -[ManagedCluster Scenarios](docs/managedcluster_scenarios.md) | :heavy_check_mark: | :question: | +[ManagedCluster Scenarios](docs/managedcluster_scenarios.md) | :heavy_check_mark: | :question: | +[Arcaflow Scenarios](docs/arcaflow_scenarios.md) | :heavy_check_mark: | :heavy_check_mark: | ### Kraken scenario pass/fail criteria and report diff --git a/config/config_arcaflow.yaml b/config/config_arcaflow.yaml index d2cda6b5..d3e1c3b5 100644 --- a/config/config_arcaflow.yaml +++ b/config/config_arcaflow.yaml @@ -12,8 +12,7 @@ kraken: litmus_uninstall_before_run: True # If you want to uninstall litmus before a new run starts chaos_scenarios: # List of policies/chaos scenarios to load - arcaflow_scenarios: - - scenarios/arcaflow/sysbench/input.yaml - - scenarios/arcaflow/kill-pod/input.yaml + - scenarios/arcaflow/sysbench-cpu-hog/input.yaml cerberus: cerberus_enabled: False # Enable it when cerberus is previously installed diff --git a/docs/arcaflow_scenarios.md b/docs/arcaflow_scenarios.md new file mode 100644 index 00000000..c2b431cd --- /dev/null +++ b/docs/arcaflow_scenarios.md @@ -0,0 +1,75 @@ +### Arcaflow Scenarios +Arcaflow is a workflow engine in development which provides the ability to execute workflow steps in sequence, in parallel, repeatedly, etc. The main difference to competitors such as Netflix Conductor is the ability to run ad-hoc workflows without an infrastructure setup required. + +The engine uses containers to execute plugins and runs them either locally in Docker/Podman or remotely on a Kubernetes cluster. The workflow system is strongly typed and allows for generating JSON schema and OpenAPI documents for all data formats involved. +#### Prequisites +Arcaflow supports three deployment technologies: +- Docker +- Podman +- Kubernetes + +##### Docker +In order to run Arcaflow Scenarios with the Docker deployer, be sure that: +- Docker is correctly installed in your Operating System (to find instructions on how to install docker please refer to [Docker Documentation](https://www.docker.com/)) +- The Docker daemon is running + +##### Podman +The podman deployer is built around the podman CLI and doesn't need necessarily to be run along with the podman daemon. +To run Arcaflow Scenarios in your Operating system be sure that: +- podman is correctly installed in your Operating System (to find instructions on how to install podman refer to [Podman Documentation](https://podman.io/)) +- the podman CLI is in your shell PATH + +##### Kubernetes +The kubernetes deployer integrates directly the Kubernetes API Client and needs only a valid kubeconfig file and a reachable Kubernetes/OpenShift Cluster. + +#### Usage + +To enable arcaflow scenarios edit the kraken config file, go to the section `kraken -> chaos_scenarios` of the yaml structure +and add a new element to the list named `arcaflow_scenarios` then add the desired scenario +pointing to the `input.yaml` file. +``` +kraken: + ... + chaos_scenarios: + - arcaflow_scenarios: + - scenarios/arcaflow/sysbench-cpu-hog/input.yaml +``` + +##### input.yaml +The implemented scenarios can be found in *scenarios/arcaflow/* folder. +The entrypoint of each scenario is the *input.yaml* file. +In this file there are all the options to set up the scenario accordingly to the desired target +#### config.yaml +The arcaflow config file. Here you can set the arcaflow deployer and the arcaflow log level. +The supported deployers are: +- Docker +- Podman (podman daemon not needed, suggested option) +- Kubernetes + +The supported log levels are: +- debug +- info +- warning +- error +#### workflow.yaml +This file contains the steps that will be executed to perform the scenario against the target. +Each step is represented by a container that will be executed from the deployer and its options. +Note that we provide the scenarios as a template, but they can be manipulated to define more complex workflows. +To have more details regarding the arcaflow workflows architecture and syntax it is suggested to refer to the [Arcaflow Documentation](https://arcalot.io/arcaflow/). + +#### Scenarios +##### sysbench-cpu-hog +This scenario is based on the arcaflow [sysbench](https://github.com/akopytov/sysbench) plugin. +The purpose of this scenario is to create cpu pressure on a particular node of the Kubernetes/OpenShift cluster for a time span. +To enable this plugin add the pointer to the scenario input file `scenarios/arcaflow/sysbench-cpu-hog/input.yaml` as described in the +Usage section. +This scenarios takes the following input parameters: + +- **kubeconfig :** string representation of the kubeconfig needed by the deployer to deploy the sysbench plugin in the target cluster +**Note:** this parameter will be automatically filled by kraken if the `kubeconfig_path` property is correctly set +- **node_selector :** key-value representation of the node label that will be used as `nodeSelector` by the pod to target a specific cluster node +- **sysbench_cpumaxprime :** integer that defines the highest prime number during the test. Higher this value is, higher will be the time to find all the prime numbers +- **sysbench_events :** integer that limits the maximum number of events that will be performed by sysbench, 0 removes the limit +- **sysbench_runtime :** number of seconds the test will be run +- **sysbench_forced_shutdown_time :** the number of seconds to wait before shutting down the benchmark after the defined run time +- **sysbench_threads :** the number of threads on which the test will run \ No newline at end of file diff --git a/scenarios/arcaflow/sysbench-cpu-hog/config.yaml b/scenarios/arcaflow/sysbench-cpu-hog/config.yaml new file mode 100644 index 00000000..2b6bf74b --- /dev/null +++ b/scenarios/arcaflow/sysbench-cpu-hog/config.yaml @@ -0,0 +1,5 @@ +deployer: + type: podman + # More deployer options +log: + level: debug \ No newline at end of file diff --git a/scenarios/arcaflow/sysbench-cpu-hog/input.yaml b/scenarios/arcaflow/sysbench-cpu-hog/input.yaml new file mode 100644 index 00000000..2125bf33 --- /dev/null +++ b/scenarios/arcaflow/sysbench-cpu-hog/input.yaml @@ -0,0 +1,8 @@ +kubeconfig: {} +node_selector: + label: value #replace with the node label of your choice +sysbench_cpumaxprime: 12000 +sysbench_events: 0 +sysbench_forced_shutdown_time: 10 +sysbench_runtime: 60 +sysbench_threads: 50 diff --git a/scenarios/arcaflow/sysbench-cpu-hog/workflow.yaml b/scenarios/arcaflow/sysbench-cpu-hog/workflow.yaml new file mode 100644 index 00000000..53dd0482 --- /dev/null +++ b/scenarios/arcaflow/sysbench-cpu-hog/workflow.yaml @@ -0,0 +1,83 @@ +input: + root: RootObject + objects: + RootObject: + id: RootObject + properties: + kubeconfig: + display: + description: The complete kubeconfig file as a string + name: Kubeconfig file contents + type: + type_id: string + required: true + node_selector: + display: + description: kubernetes node name where the plugin must be deployed + type: + type_id: map + values: + type_id: string + keys: + type_id: string + required: true + sysbench_threads: + display: + description: The number of threads sysbench will run + name: sysbench threads + type: + type_id: integer + sysbench_events: + display: + description: The number of events sysbench will run + name: sysbench events + type: + type_id: integer + sysbench_runtime: + display: + description: The total runtime in seconds for the sysbench tests + name: sysbench runtime seconds + type: + type_id: integer + sysbench_forced_shutdown_time: + display: + description: Number of seconds to wait after the 'time' limit before forcing shutdown, or exclude parameter to disable forced shutdown + name: sysbench runtime seconds + type: + type_id: integer + sysbench_cpumaxprime: + display: + description: The upper limit of the number of prime numbers generated + name: sysbench cpu max primes + type: + type_id: integer + +steps: + kubeconfig: + plugin: quay.io/arcalot/arcaflow-plugin-kubeconfig:latest + input: + kubeconfig: !expr $.input.kubeconfig + sysbench: + plugin: quay.io/arcalot/arcaflow-plugin-sysbench:latest + step: sysbenchcpu + input: + threads: !expr $.input.sysbench_threads + events: !expr $.input.sysbench_events + time: !expr $.input.sysbench_runtime + forced-shutdown: !expr $.input.sysbench_forced_shutdown_time + cpu-max-prime: !expr $.input.sysbench_cpumaxprime + deploy: + type: kubernetes + connection: !expr $.steps.kubeconfig.outputs.success.connection + pod: + + metadata: + namespace: default + labels: + arcaflow: sysbench + spec: + nodeSelector: !expr $.input.node_selector + pluginContainer: + imagePullPolicy: Always +output: + sysbench: !expr $.steps.sysbench.outputs.success