Skip to content

chaos-mesh/chaos-mesh-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chaos-mesh-action Chaos

chaos-mesh-action is a GitHub action that applies chaos engineering to your development workflow using Chaos Mesh. It automatically deploys the Chaos Mesh environment and injects the specified chaos experiment.

For more details on Chaos Mesh, refer to https://chaos-mesh.org/.

Usage

Step 1. Prepare chaos configuration file

Prepare the configuration file (YAML) of the failures which you expect to inject into the system, for example:

apiVersion: chaos-mesh.org/v1alpha1
kind: NetworkChaos
metadata:
 name: network-delay
 namespace: busybox
spec:
 action: delay # the specific chaos action to inject
 mode: all
 selector:
   pods:
     busybox:
       - busybox-0
 delay:
   latency: "10ms"
 duration: "5s"
 scheduler:
   cron: "@every 10s"
 direction: to
 target:
   selector:
     pods:
       busybox:
         - busybox-1
   mode: all

Step 2. Encode the chaos configuration file with base64 (optional)

Obtain the base64 value of the chaos configuration file using the following command:

CFG_BASE64=`base64 chaos.yaml`

Step 3. Create the workflow

  1. Deploy the Kubernetes cluster

A Kubernetes cluster is required for the workflow. You can use Kind Cluster or Kind Action to deploy.

  1. Use chaos-mesh-action.

To create the workflow in GitHub action, use chaos-mesh/chaos-mesh-action in the yaml configuration file and configure the base64 value of the chaos configuration file, and set the version of Chaos Mesh. The chaos-mesh related configuration is as follows:

    - name: Run chaos mesh action
      uses: chaos-mesh/chaos-mesh-action@master
      env:
        CFG_BASE64: ${CFG_BASE64}
        CHAOS_MESH_VERSION: v1.0.0

If the chaos configuration file is committed to GitHub, you can set CFG_FILE as the path to the file:

    - name: Run chaos mesh action
      uses: chaos-mesh/chaos-mesh-action@master
      env:
        CFG_FILE: https://raw.githubusercontent.com/chaos-mesh/chaos-mesh-action/master/chaos-test.yaml
        CHAOS_MESH_VERSION: v1.0.0

For the complete configuration file, see sample.

Limitation

  • Link to private K8s clusters is not supported for now.
  • Only helm 3.x is supported for now.