Giter Club home page Giter Club logo

chaosd's Introduction

chaosd

Gitpod ready-to-code

chaosd is an easy-to-use Chaos Engineering tool used to inject failures to a physical node.

Document

For details about the introduction and usage of chaosd, refer to the documentation.

Types of fault

You can use Chaosd to simulate the following fault types:

  • Process: Injects faults into the processes. Operations such as killing the process or stopping the process are supported.
  • Network: Injects faults into the network of physical machines. Operations such as increasing network latency, losing packets, and corrupting packets are supported.
  • Stress: Injects stress on the CPU or memory of the physical machines.
  • Disk: Injects faults into disks of the physical machines. Operations such as increasing disk load of reads and writes, and filling disks are supported.
  • Host: Injects faults into the physical machine. Operations such as shutdown the physical machine are supported.

For details about the introduction and usage of each fault type, refer to the related documentation.

Work modes

You can use Chaosd in the following modes:

  • Command-line mode: Run Chaosd directly as a command-line tool to inject and recover faults.

  • Service mode: Run Chaosd as a service in the background, to inject and recover faults by sending HTTP requests.

Prerequisites

Before deploying chaosd, make sure the following items have been installed:

  • tc
  • ipset
  • iptables
  • stress-ng (required when install chaosd by building from source code)
  • byteman(required when install chaosd by building from source code)

Install

You can either build directly from the source or download the binary to finish the installation.

  • Build from source code

    Build chaosd:

    make chaosd

    Build or download tools related to Chaosd:

    make chaos-tools

    Put Chaosd into PATH:

    mv ./bin /usr/local/chaosd
    export PATH=$PATH:/usr/local/chaosd
    
  • Download binary

    Download the latest unstable version by executing the command below:

    curl -fsSL -o chaosd-latest-linux-amd64.tar.gz https://mirrors.chaos-mesh.org/chaosd-latest-linux-amd64.tar.gz

    If you want to download the release version, you can replace the latest in the above command with the version number. For example, download v1.1.1 by executing the command below:

    curl -fsSL -o chaosd-v1.1.1-linux-amd64.tar.gz https://mirrors.chaos-mesh.org/chaosd-v1.1.1-linux-amd64.tar.gz

    Then uncompress the archived file:

    tar zxvf chaosd-latest-linux-amd64.tar.gz

    Put Chaosd into PATH:

    mv ./chaosd-latest-linux-amd64 /usr/local/chaosd
    export PATH=$PATH:/usr/local/chaosd

chaosd's People

Contributors

andrewmatilde avatar asternight avatar clslaid avatar cwen0 avatar dahuige0 avatar fingerleader avatar g1eny0ung avatar hexilee avatar iguoyr avatar jankoehnlein avatar kadern0 avatar luanqi521-s avatar nikitasavchenko555 avatar onesizefitsquorum avatar shivanshs9 avatar sunny-xiao avatar wangxiangustc avatar yangkeao avatar yujinqiu avatar yuriscott avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chaosd's Issues

build docker image

build docker image for chaosd, and the image should contain stress-ng, iptables, ipset and other tools.

disk attack: support inject write/read payload for specified duration

For example, I want to inject a write payload while an experiment, and the experiment need to run for a long time. I need to write a shell script like the below:

#!/bin/bash

for((i=1;i<=100;i++));
do
    ./chaosd attack disk add-payload write -p /chaosd_data -n 2 --size 100G
    rm /home/root/chaosd_data
done

I can't set the size with a large value, because the storage capacity is limited.

Maybe we should add duration config for disk attack, and chaosd will write and delete automatically.

disk fill: num must not be zero

run chaosd with server mode, and execute command below:

curl -X POST 127.0.0.1:31767/api/attack/disk -H "Content-Type:application/json" -d '{"action":"fill","path":"/tmp/test", "fill-by-fallocate":false,"percent":"50"}'

get error:

{"error":true,"message":"error.api.invalid_request: error.core.attack_config_validation_error: attack config validation failed, cause: num must not be zero","code":"error.api.invalid_request","full_text":"error.api.invalid_request: error.core.attack_config_validation_error: attack config validation failed, cause: num must not be zero\n at github.com/chaos-mesh/chaosd/pkg/server/httpserver.(*httpServer).createDiskAttack()\n\t/__w/chaosd/chaosd/pkg/server/httpserver/server.go:216\n at github.com/gin-gonic/gin.(*Context).Next()\n\t/github/home/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161\n at github.com/chaos-mesh/chaosd/pkg/server/utils.MWHandleErrors.func1()\n\t/__w/chaosd/chaosd/pkg/server/utils/error.go:47\n at github.com/gin-gonic/gin.(*Context).Next()\n\t/github/home/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161\n at github.com/gin-gonic/gin.RecoveryWithWriter.func1()\n\t/github/home/go/pkg/mod/github.com/gin-gonic/[email protected]/recovery.go:83\n at github.com/gin-gonic/gin.(*Context).Next()\n\t/github/home/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161\n at github.com/gin-gonic/gin.LoggerWithConfig.func1()\n\t/github/home/go/pkg/mod/github.com/gin-gonic/[email protected]/logger.go:241\n at github.com/gin-gonic/gin.(*Context).Next()\n\t/github/home/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161\n at github.com/gin-gonic/gin.(*Engine).handleHTTPRequest()\n\t/github/home/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:409\n at github.com/gin-gonic/gin.(*Engine).ServeHTTP()\n\t/github/home/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:367\n at net/http.serverHandler.ServeHTTP()\n\t/__t/go/1.16.2/x64/src/net/http/server.go:2887\n at net/http.(*conn).serve()\n\t/__t/go/1.16.2/x64/src/net/http/server.go:1952\n at runtime.goexit()\n\t/__t/go/1.16.2/x64/src/runtime/asm_amd64.s:1371"}

support shutdown

chaosd needs to support shutdown the host machine which the chaosd executed on.

just execute the shutdown command in chaosd is OK.

support DNS type under Network attack

This feature maybe includes:

  • update the address of the DNS server to a wrong value
  • map a host with a wrong address

This can be implement by modify the file /etc/hosts and /etc/resolv.conf

network attack support partition

partition can use loss 100% to implement this function, but loss use tc, it works on the transport layer.

It's better to use iptables to implement the partition function.

[discussion] could we replace stress-ng with other tools written by golang

when users try to inject stress by chaosd, users must install stress-ng, and stress-ng require some dependencies, just like:

warning: stress-ng-0.07.29-2.el7.aarch64.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
error: Failed dependencies:
	ld-linux-aarch64.so.1()(64bit) is needed by stress-ng-0.07.29-2.el7.aarch64
	ld-linux-aarch64.so.1(GLIBC_2.17)(64bit) is needed by stress-ng-0.07.29-2.el7.aarch64
	libaio.so.1()(64bit) is needed by stress-ng-0.07.29-2.el7.aarch64
	libaio.so.1(LIBAIO_0.1)(64bit) is needed by stress-ng-0.07.29-2.el7.aarch64
	libaio.so.1(LIBAIO_0.4)(64bit) is needed by stress-ng-0.07.29-2.el7.aarch64
	libbsd.so.0()(64bit) is needed by stress-ng-0.07.29-2.el7.aarch64
	libbsd.so.0(LIBBSD_0.0)(64bit) is needed by stress-ng-0.07.29-2.el7.aarch64
	libbsd.so.0(LIBBSD_0.3)(64bit) is needed by stress-ng-0.07.29-2.el7.aarch64
	libbsd.so.0(LIBBSD_0.5)(64bit) is needed by stress-ng-0.07.29-2.el7.aarch64
	libcrypt.so.1(GLIBC_2.17)(64bit) is needed by stress-ng-0.07.29-2.el7.aarch64
	libm.so.6(GLIBC_2.17)(64bit) is needed by stress-ng-0.07.29-2.el7.aarch64
	libpthread.so.0(GLIBC_2.17)(64bit) is needed by stress-ng-0.07.29-2.el7.aarch64
	librt.so.1(GLIBC_2.17)(64bit) is needed by stress-ng-0.07.29-2.el7.aarch64
	libsctp.so.1()(64bit) is needed by stress-ng-0.07.29-2.el7.aarch64
	libsctp.so.1(VERS_1)(64bit) is needed by stress-ng-0.07.29-2.el7.aarch64

could we use another tool written by golang?

Chaosd can't build in macos because of disk attack

version: fd4d07f

make chaosd
GO15VENDOREXPERIMENT="1" CGO_ENABLED=1 GOOS="" GOARCH="" go build -ldflags '-s -w -X 'github.com/chaos-mesh/chaosd/pkg/version.buildDate=2021-04-20T03:21:49Z' -X 'github.com/chaos-mesh/chaosd/pkg/version.gitCommit=ab8818565272ba03f0a1bd4f55e3a78fe1a06d30' -X 'github.com/chaos-mesh/chaosd/pkg/version.gitVersion=v0.9.0-10+ab8818565272ba'' -tags "" -o bin/chaosd ./cmd/main.go
# github.com/chaos-mesh/chaosd/pkg/server/chaosd
pkg/server/chaosd/disk.go:136:21: s.Frsize undefined (type syscall.Statfs_t has no field or method Frsize)
make: *** [chaosd] Error 2

Implement store pkg and store experiment record to DB

We use store pkg to store experiment records and use them to recover experiment.

At present, we have defined the struct of store pkg and then we need to store these records to DB.

We can run the following commands to test chaosd:

$ make image-chaosd
$ docker run -it pingcap/chaosd:latest sh
$ chaosd  --help 
A command line client to run chaos experiment

Usage:
  chaos [command]

Available Commands:
  attack      Attack related commands
  help        Help about any command
  recover     Recover a chaos experiment
  server      run Chaosd Server

Flags:
  -h, --help         help for chaos
  -u, --url string   chaosd address (default "http://127.0.0.1:31767")

Use "chaos [command] --help" for more information about a command. 

chaosd attack process stop -p xxx 
xxxx uid: xxxx 

chaosd recover xxxx

return 404 code when delete not exist experiment

now will get an error when delete not exist experiment:

$ curl -X DELETE 127.0.0.1:31767/api/attack/1234
{"error":true,"message":"error.api.internal_server_error: record not found","code":"error.api.internal_server_error","full_text":"error.api.internal_server_error: record not found\n at github.com/chaos-mesh/chaosd/pkg/server/httpserver.handleError()\n\t/home/xiang/chaosd/pkg/server/httpserver/server.go:227\n at github.com/chaos-mesh/chaosd/pkg/server/httpserver.(*httpServer).recoverAttack()\n\t/home/xiang/chaosd/pkg/server/httpserver/server.go:216\n at github.com/gin-gonic/gin.(*Context).Next()\n\t/home/xiang/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161\n at github.com/chaos-mesh/chaosd/pkg/server/utils.MWHandleErrors.func1()\n\t/home/xiang/chaosd/pkg/server/utils/error.go:46\n at github.com/gin-gonic/gin.(*Context).Next()\n\t/home/xiang/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161\n at github.com/gin-gonic/gin.RecoveryWithWriter.func1()\n\t/home/xiang/go/pkg/mod/github.com/gin-gonic/[email protected]/recovery.go:83\n at github.com/gin-gonic/gin.(*Context).Next()\n\t/home/xiang/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161\n at github.com/gin-gonic/gin.LoggerWithConfig.func1()\n\t/home/xiang/go/pkg/mod/github.com/gin-gonic/[email protected]/logger.go:241\n at github.com/gin-gonic/gin.(*Context).Next()\n\t/home/xiang/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161\n at github.com/gin-gonic/gin.(*Engine).handleHTTPRequest()\n\t/home/xiang/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:409\n at github.com/gin-gonic/gin.(*Engine).ServeHTTP()\n\t/home/xiang/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:367\n at net/http.serverHandler.ServeHTTP()\n\t/usr/local/go/src/net/http/server.go:2887\n at net/http.(*conn).serve()\n\t/usr/local/go/src/net/http/server.go:1952\n at runtime.goexit()\n\t/usr/local/go/src/runtime/asm_amd64.s:1371"}

it's better to return 404 status code.

add config validate and adjustment for server mode

Users need to specify all configs when injecting failure with server mode.

For example, below is a command for network attack:

$ curl -X POST "127.0.0.1:31767/api/attack/network" -H "Content-Type: application/json" -d '{"device": "eth0", "ipaddress": "172.16.4.4", "action": "duplicate", "percent": "50", "correlation": "0"}'

The correlation is 0, but we can not ignore it, otherwise, it will get an error:

curl -X POST "127.0.0.1:31767/api/attack/network" -H "Content-Type: application/json" -d '{"device": "eth0", "ipaddress": "172.16.4.4", "action": "duplicate", "percent": "50"}'
{"error":true,"message":"error.api.internal_server_error: strconv.ParseFloat: parsing \"\": invalid syntax","code":"error.api.internal_server_error","full_text":"error.api.internal_server_error: strconv.ParseFloat: parsing \"\": invalid syntax\n at github.com/chaos-mesh/chaosd/pkg/server/httpserver.(*httpServer).createNetworkAttack()\n\t/home/xiang/chaosd/pkg/server/httpserver/server.go:131\n at github.com/gin-gonic/gin.(*Context).Next()\n\t/home/xiang/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161\n at github.com/chaos-mesh/chaosd/pkg/server/utils.MWHandleErrors.func1()\n\t/home/xiang/chaosd/pkg/server/utils/error.go:46\n at github.com/gin-gonic/gin.(*Context).Next()\n\t/home/xiang/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161\n at github.com/gin-gonic/gin.RecoveryWithWriter.func1()\n\t/home/xiang/go/pkg/mod/github.com/gin-gonic/[email protected]/recovery.go:83\n at github.com/gin-gonic/gin.(*Context).Next()\n\t/home/xiang/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161\n at github.com/gin-gonic/gin.LoggerWithConfig.func1()\n\t/home/xiang/go/pkg/mod/github.com/gin-gonic/[email protected]/logger.go:241\n at github.com/gin-gonic/gin.(*Context).Next()\n\t/home/xiang/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161\n at github.com/gin-gonic/gin.(*Engine).handleHTTPRequest()\n\t/home/xiang/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:409\n at github.com/gin-gonic/gin.(*Engine).ServeHTTP()\n\t/home/xiang/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:367\n at net/http.serverHandler.ServeHTTP()\n\t/usr/local/go/src/net/http/server.go:2887\n at net/http.(*conn).serve()\n\t/usr/local/go/src/net/http/server.go:1952\n at runtime.goexit()\n\t/usr/local/go/src/runtime/asm_amd64.s:1371"}

So we should add adjustments for some config, set default values for them when they are not specified, and add validations for them, just like the command mode

func (n *NetworkCommand) Validate() error {
cmd.Flags().StringVarP(&nFlag.Correlation, "correlation", "c", "0", "correlation is percentage (10 is 10%)")

ignore useless log of go.uber.org/fx with command mode

since pr #31 merged, there are many logs of go.uber.org/fx when run with command mode:

./bin/chaosd attack disk fill -p /tmp/temp -s 100
2021/04/14 02:19:58 [Fx] PROVIDE        *config.Config <= github.com/chaos-mesh/chaosd/cmd/chaosd/ctl/command.glob..func1()
2021/04/14 02:19:58 [Fx] PROVIDE        *dbstore.DB <= github.com/chaos-mesh/chaosd/pkg/store/dbstore.NewDBStore()
2021/04/14 02:19:58 [Fx] PROVIDE        core.ExperimentStore <= github.com/chaos-mesh/chaosd/pkg/store/experiment.NewStore()
2021/04/14 02:19:58 [Fx] PROVIDE        core.ExperimentRunStore <= github.com/chaos-mesh/chaosd/pkg/store/experiment.NewRunStore()
2021/04/14 02:19:58 [Fx] PROVIDE        core.IPSetRuleStore <= github.com/chaos-mesh/chaosd/pkg/store/network.NewIPSetRuleStore()
2021/04/14 02:19:58 [Fx] PROVIDE        core.IptablesRuleStore <= github.com/chaos-mesh/chaosd/pkg/store/network.NewIptablesRuleStore()
2021/04/14 02:19:58 [Fx] PROVIDE        core.TCRuleStore <= github.com/chaos-mesh/chaosd/pkg/store/network.NewTCRuleStore()
2021/04/14 02:19:58 [Fx] PROVIDE        *chaosd.Server <= github.com/chaos-mesh/chaosd/pkg/server/chaosd.NewServer()
2021/04/14 02:19:58 [Fx] PROVIDE        *httpserver.httpServer <= github.com/chaos-mesh/chaosd/pkg/server/httpserver.NewServer()
2021/04/14 02:19:58 [Fx] PROVIDE        crclients.ContainerRuntimeInfoClient <= github.com/chaos-mesh/chaosd/pkg/crclient.NewNodeCRClient()
2021/04/14 02:19:58 [Fx] PROVIDE        int <= os.Getpid()
2021/04/14 02:19:58 [Fx] PROVIDE        *chaosdaemon.DaemonServer <= github.com/chaos-mesh/chaos-mesh/pkg/chaosdaemon.NewDaemonServerWithCRClient()
2021/04/14 02:19:58 [Fx] PROVIDE        scheduler.Scheduler <= github.com/chaos-mesh/chaosd/pkg/scheduler.NewScheduler()
2021/04/14 02:19:58 [Fx] PROVIDE        *core.DiskCommand <= github.com/chaos-mesh/chaosd/cmd/chaosd/ctl/command.NewDiskAttackCommand.func1()
2021/04/14 02:19:58 [Fx] PROVIDE        fx.Lifecycle <= go.uber.org/fx.New.func1()
2021/04/14 02:19:58 [Fx] PROVIDE        fx.Shutdowner <= go.uber.org/fx.(*App).shutdowner-fm()
2021/04/14 02:19:58 [Fx] PROVIDE        fx.DotGraph <= go.uber.org/fx.(*App).dotGraph-fm()
2021/04/14 02:19:58 [Fx] INVOKE         github.com/chaos-mesh/chaosd/cmd/chaosd/ctl/command.processDiskAttack()
[2021/04/14 02:19:58.372 +00:00] [INFO] [disk.go:128]
Fill file /tmp/temp successfully, uid: e60f93df-c88c-410b-808d-a8a013f8dbcd

can we shield these logs?

support IO chaos on disk

Note: It is different from the IO chaos in Chaos Mesh

This feature includes the following capabilities:

  • emulation of real read and write on disk
  • fill the disk

Support running duration settings

For example, the network attack may partition all host, so that can't connect to it and can't recover it anymore. So need to add a running duration settings, network attack will recover automatically.

Add time skew support in chaosd.

Feature : There already has a time skew tool called watchmaker in chaos-mesh . I think it is a good idea to merge it into chaosd.
Since watchmaker seems have not completed the function of recovery ,we also need to complete it.

disk read-payload attack will exist after read all the file

For example, file temp's size is 100M, but we expect to read 200M data by running the command below:

./bin/chaosd attack disk add-payload read --path ./temp --size 200

the command will exit when reading at the end of this file, maybe it is better to read this file again so that the Chaosd read 200M data.

Distribute binaries via Homebrew

What

I'm macOS user and I will be happy if I can install and manage the binary via Homebrew.
Many tools release it via Homebrew and it's very friendly because we can easily install or uninstall easily.

Ideas

$ brew tap chaos-mesh/tap
$ brew install chaosctl

support scheduler

Just like the experiments of Chaos Mesh, chaosd also needs to support scheduler. The config of the scheduler in Chaos Mesh looks like this:

duration: '10s'
  scheduler:
    cron: '@every 15s'

The experiment was run every 15 seconds for 10 seconds according to the example config.

support file attack

Includes:

  • create file
  • rename file
  • append data to file
  • modify the file's privileges
  • delete file

stress mem bug

How to reproduce

POC

./bin/chaosd attack stress mem -s 10%

Output

stress memory option: [][2021/09/16 18:27:28.221 +08:00] [INFO] [stress.go:67] ["stressors normalize"] [arguments=" --vm 1 --vm-keep--vm-bytes 10%"]
[2021/09/16 18:27:28.223 +08:00] [INFO] [stress.go:83] ["Start stress-ng process successfully"] [command="/usr/local/sbin/stress-ng --vm 1 --vm-keep--vm-bytes 10%"] [Pid=240670]
Attack stress mem successfully, uid: 72493bd6-5a0d-4e81-9860-50ac1b0cefde

you'll notice that the stress command is wrong

/usr/local/sbin/stress-ng --vm 1 --vm-keep--vm-bytes

should be

/usr/local/sbin/stress-ng --vm 1 --vm-keep --vm-bytes

a SPACE between --vm-keep and --vm-bytes is missing

Root Cause

chaosd depend on github.com/chaos-mesh/chaos-mesh/api/v1alpha1 v0.0.0-20210329070828-9be168b2b489
which has bug and is fixed on this commit

Solution

update dependency github.com/chaos-mesh/chaos-mesh/api/v1alpha1 after the fixed commit.
I have not idea why the dependency version is v0.0.0, so I don't make a PR :-(

Hope that will be help.

jvm chaosd throw exception `AttachNotSupportedException`

Use chaosd attach agent to java process, and get a error:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/tools/attach/AttachNotSupportedException
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
        at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
        at java.lang.Class.getMethod0(Class.java:3018)
        at java.lang.Class.getMethod(Class.java:1784)
        at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:650)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:632)
Caused by: java.lang.ClassNotFoundException: com.sun.tools.attach.AttachNotSupportedException
        at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
        ... 7 more

Java version: v1.8.0

Network Attack: support simulate network reorder

Feature Request

Describe the feature you'd like:

At present, Chaosd supports simulate network delay, network duplicate, network loss, and network corruption.
But simulated network reordering is not supported. Network reordering is a common real-world event and Chaosd should support it.

Note:

to use reordering, a delay option must be specified, which is required by tc.

glibc-2.14 not found when run chaosd on centos 6

when I run chaosd on centos 6, error occurred

chaosd: /lib64/libc.so.6: version GLIBC_2.14' not found (required by ./chaosd)

glibc 2.12 was bounded with centos 6. so I can't update the version of glibc

also, I failed compile chaosd on centos 6

the file's size not match the size set by disk write payload

create PhysicalMachineChaos in Chaos Mesh, the YAML config is below:

kind: PhysicalMachineChaos
apiVersion: chaos-mesh.org/v1alpha1
metadata:
  namespace: default
  name: write-payload
spec:
  action: disk-write-payload
  address:
    - http://172.16.112.130:31767
  uid: c11fa67a-ee03-4fab-9e85-77fdece0b1ff
  disk-write-payload:
    size: 100MB
    path: /tmp/test3
    payload_process_num: 5

the file's size should be 100MB, but in the host, the file's size is 19922944:

 ls -l /tmp/test3
-rw-r--r-- 1 root root 19922944 Oct 27 03:56 /tmp/test3

Inject network chaos failed when iptables version lower than 1.4.20

chaosd attack network delay -d eth0 -i 10.8.198.117 -p tcp -s 7005 -l 3s

2021-12-09T15:36:51.507+0800    INFO    chaos-daemon-server     flush ipset     {"request": "ipsets:{name:\"chaos-11ed9986-f0e4-41\"  cidrs:\"10.8.198.117/32\"}"}
2021-12-09T15:36:51.509+0800    INFO    background-process-manager      build command   {"command": "ipset create chaos-11ed9986-f0e4-41old hash:net"}
2021-12-09T15:36:51.519+0800    INFO    chaos-daemon-server     create ipset    {"command": "/usr/sbin/ipset create chaos-11ed9986-f0e4-41old hash:net"}
2021-12-09T15:36:51.878+0800    INFO    background-process-manager      build command   {"command": "ipset add chaos-11ed9986-f0e4-41old 10.8.198.117/32"}
2021-12-09T15:36:51.878+0800    INFO    chaos-daemon-server     add CIDR to ipset       {"command": "/usr/sbin/ipset add chaos-11ed9986-f0e4-41old 10.8.198.117/32"}
2021-12-09T15:36:51.885+0800    INFO    background-process-manager      build command   {"command": "ipset rename chaos-11ed9986-f0e4-41old chaos-11ed9986-f0e4-41"}
2021-12-09T15:36:51.886+0800    INFO    chaos-daemon-server     rename ipset    {"command": "/usr/sbin/ipset rename chaos-11ed9986-f0e4-41old chaos-11ed9986-f0e4-41"}
2021-12-09T15:36:51.897+0800    INFO    chaos-daemon-server     Set iptables chains     {"request": ""}
2021-12-09T15:36:51.898+0800    INFO    background-process-manager      build command   {"command": "iptables -w -N CHAOS-INPUT"}
2021-12-09T15:36:52.062+0800    ERROR   chaos-daemon-server     error while initializing iptables       {"error": "error code: exit status 2, msg: iptables v1.4.7: option `-w' requires an argument\nTry `iptables -h' or 'iptables --help' for more information.\n"}
github.com/go-logr/zapr.(*zapLogger).Error
        /home/vagrant/go/pkg/mod/github.com/go-logr/[email protected]/zapr.go:128
github.com/chaos-mesh/chaos-mesh/pkg/chaosdaemon.(*DaemonServer).SetIptablesChains
        /home/vagrant/go/pkg/mod/github.com/chaos-mesh/[email protected]/pkg/chaosdaemon/iptables_server.go:45
github.com/chaos-mesh/chaosd/pkg/server/chaosd.(*Server).applyIptables
        /home/vagrant/chaosd/pkg/server/chaosd/network.go:129
github.com/chaos-mesh/chaosd/pkg/server/chaosd.networkAttack.Attack
        /home/vagrant/chaosd/pkg/server/chaosd/network.go:78
github.com/chaos-mesh/chaosd/pkg/server/chaosd.(*Server).ExecuteAttack
        /home/vagrant/chaosd/pkg/server/chaosd/attack.go:105
github.com/chaos-mesh/chaosd/cmd/attack.commonNetworkAttackFunc
        /home/vagrant/chaosd/cmd/attack/network.go:248
reflect.Value.call
        /usr/local/go/src/reflect/value.go:476
reflect.Value.Call
        /usr/local/go/src/reflect/value.go:337
go.uber.org/dig.defaultInvoker
        /home/vagrant/go/pkg/mod/go.uber.org/[email protected]/dig.go:284
go.uber.org/dig.(*Container).Invoke
        /home/vagrant/go/pkg/mod/go.uber.org/[email protected]/dig.go:439
go.uber.org/fx.(*App).executeInvokes
        /home/vagrant/go/pkg/mod/go.uber.org/[email protected]/app.go:692
go.uber.org/fx.New
        /home/vagrant/go/pkg/mod/go.uber.org/[email protected]/app.go:471
github.com/chaos-mesh/chaosd/pkg/utils.FxNewAppWithoutLog
        /home/vagrant/chaosd/pkg/utils/utils.go:27
github.com/chaos-mesh/chaosd/cmd/attack.NewNetworkDelayCommand.func1
        /home/vagrant/chaosd/cmd/attack/network.go:65
github.com/spf13/cobra.(*Command).execute
        /home/vagrant/go/pkg/mod/github.com/spf13/[email protected]/command.go:854
github.com/spf13/cobra.(*Command).ExecuteC
        /home/vagrant/go/pkg/mod/github.com/spf13/[email protected]/command.go:958
github.com/spf13/cobra.(*Command).Execute
        /home/vagrant/go/pkg/mod/github.com/spf13/[email protected]/command.go:895
main.main
        /home/vagrant/chaosd/cmd/main.go:77
runtime.main
        /usr/local/go/src/runtime/proc.go:225
Error: error code: exit status 2, msg: iptables v1.4.7: option `-w' requires an argument
Try `iptables -h' or 'iptables --help' for more information.

support deploy chaosd by TiUP

Now we can only deploy Chaosd manually. If you have a lot of servers, it takes a lot of work to deploy it.
TiUP is a cluster operation and maintenance tool, we can use it to deploy Chaosd.

有完整的arm安装包吗?

测试环境是内网ARM架构,下载源码尝试make,发现需要下载一大堆依赖包

GO15VENDOREXPERIMENT="1" CGO_ENABLED=1 GOOS="" GOARCH="" go build -ldflags '-s -w -X 'github.com/chaos-mesh/chaosd/pkg/version.buildDate=2021-12-07T03:46:43Z'' -tags "" -o bin/chaosd ./cmd/main.go
go: github.com/alecthomas/[email protected]: Get "https://proxy.golang.org/github.com/alecthomas/template/@v/v0.0.0-20190718012654-fb15b899a751.mod": dial tcp: lookup proxy.golang.org on [::1]:53: read udp [::1]:45337->[::1]:53: read: connection refused
go: downloading sigs.k8s.io/controller-runtime v0.4.0
go: downloading github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
go: downloading go.uber.org/zap v1.15.0
go: downloading github.com/spf13/cobra v1.1.1
go: downloading go.uber.org/fx v1.13.1
go: downloading github.com/pingcap/log v0.0.0-20200117041106-d28c14d3b1cd
go: downloading github.com/swaggo/swag v1.6.7
go: downloading github.com/olekukonko/tablewriter v0.0.4
go: downloading github.com/pingcap/errors v0.11.5-0.20190809092503-95897b64e011
go: downloading github.com/chaos-mesh/chaos-mesh v0.9.1-0.20210525104133-41e37dd1ac16
go: downloading github.com/spf13/pflag v1.0.5
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/robfig/cron/v3 v3.0.1
go: downloading github.com/go-logr/zapr v0.1.0
go: downloading gorm.io/gorm v1.20.7
go: downloading github.com/joomcode/errorx v1.0.1
go: downloading github.com/shirou/gopsutil v0.0.0-20180427012116-c95755e4bcd7
go: downloading github.com/hashicorp/go-multierror v1.1.0
go: downloading github.com/gin-gonic/gin v1.6.3
go: downloading github.com/mitchellh/go-ps v0.0.0-20170309133038-4fdf99ab2936
go: downloading github.com/chaos-mesh/chaos-mesh/api/v1alpha1 v0.0.0-20210519061540-67fe258c7dec
go: downloading gorm.io/driver/sqlite v1.1.4
go: downloading github.com/google/uuid v1.1.2
go: downloading k8s.io/apimachinery v0.17.1-beta.0
go: downloading github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf
go: downloading k8s.io/api v0.17.0
go: downloading google.golang.org/grpc v1.33.2
go: github.com/alecthomas/[email protected]: Get "https://proxy.golang.org/github.com/alecthomas/template/@v/v0.0.0-20190718012654-fb15b899a751.mod": dial tcp: lookup proxy.golang.org on [::1]:53: read udp [::1]:45337->[::1]:53: read: connection refused
make: *** [Makefile:62:chaosd] 错误 1

Check again before performing risky operations

some attacks like network(for example, loss all packets from all IP) and shutdown are too dangerous, should add some validation before doing the attack, or let users know the danger and make sure to do it.

support kernel panic

echo c > /proc/sysrq-trigger will cause a kernel panic (dereferencing null pointer), which is really cool 😎 .

(This is only a fun suggestion.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.