Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.
How xk6-disruptor works
xk6-disruptor consists of two main components:
- The xk6-disruptor extension provides a Javascript API for injecting faults into a target system using the xk6-disruptor-agent as a backend. This API is built around a collection of disruptors. Each disruptor targets a type of component in the system (for example Pods or cluster Nodes).
- The xk6-disruptor-agent injects faults into the target system where it runs. It is provided as an Docker image that you can pull from the xk6-disruptor repository.
The xk6-disruptor extension installs the agent in the target and sends commands to inject the desired faults. How this happens depends on the type of disruptor, as described in the following sections.
PodDisruptor
The following diagram shows how PodDisruptor works:
- The PodDisruptor selects the target pods based on the selector attributes defined in the constructor
- The PodDisruptor attaches the xk6-disruptor-agent to each of the target pods
- When a fault is injected (e.g. calling the injectHTTTFault) the PodDisruptor sends a command to the agents to inject the fault in their respective pods
ServiceDisruptor
The ServiceDisruptor works as a wrapper around a PodDisruptor, which targets the pods that back the service.
- The ServiceDisruptor uses the definition of the service specified in the constructor to create a pod selector that matches the pods that back the service.
- The ServiceDisruptor creates a PodDisruptor using this pod selector.
- The PodDisruptor installs the agent in the target pods.
From this point, the PodDisruptor works as described before.