Skip to content

v1.3.0 version feature introduction

xcaspar edited this page Aug 5, 2021 · 3 revisions

Basic resource scenarios

Added systemd stop scenario

$ blade c systemd stop --service docker
{"code":200,"success":true,"result":"a6da606fbcdea2cb"}

$ docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Optimize memory experiment scenario

Added the --avoid-being-killed parameter to control whether the process occupying the memory is killed. This is achieved by adjusting the process priority. It is suitable for scenarios where the memory is 100%.

Java experiment scenarios

Support javaHome configuration when creating experiment

You can specify the JAVA_HOME path through the --javaHome parameter, which is used to load the java agent.

blade c jvm cpufullload --javaHome /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home --process tomcat

Reload the java agent when creating an experiment

Starting from the v1.2.0 version, there is no need to perform the prepare jvm load agent operation first. Directly executing the create operation will first determine whether the agent is loaded. If there is no load, the agent will be reloaded. The v1.3.0 version adds the -refresh parameter, adding this parameter will reload the agent every time, suitable for use when the agent is updated.

blade c jvm cpufullload --process tomcat --refresh 

Add jvm fullgc scenario

Need special attention --interval parameter is required.

blade c jvm full-gc --process spring --effect-count 5 --interval 1000
{"code":200,"success":true,"result":"2ee474df48fe5f85"}

image

Support spring cloud gateway scenario

Support specified request delay or throw exception.

blade create gateway delay --requestPath /consumer/hello --time 20000
blade create gateway throwCustomException --exception java.lang.Exception --requestPath /consumer/hello

image

Add logback experiment scenario

Support logback log record delay or throw exception.

blade create log delay --logback --time 1000 --effect-count 100

blade create log throwCustomException --logback --exception java.lang.NullPointException

Support http plugin timeout scenario

When using http request delay, if the configured delay time is greater than the timeout period of the system service, the request timeout exception will be triggered.

servlet plugin supports regular expressions

Match requests via regular expressions.

./blade create servlet modifyCode --code 500 --requestpath-regex-pattern /greeting/2*
./blade create servlet modifyCode --code 500 --querystring-regex-pattern name=1*

Support Dubbo/HTTP call point match

Use --call-point flag to specify the upstream url. Use | connection class and method.

blade create http delay --time 500 --uri http://api.bservice.xxx.com/api/user/list --call-point com.xxx.service.AService|a1Method

Fix Dubbo consumer generalization invoke methodname bug.

dubbo matchers: {"matchers":{"appname":"test_provider","service":"com.test.provider.api.DubboTestService","version":"1.0.0","group":"test","methodname":"testDubbo","timeout":"3000"}}

Kubernetes experiment scenarios

Enhance the configuration parameters during installation daemonset.enable

daemonset.enable is to control whether to deploy the chaosblade-tool daemonset. This daemonset is currently working under the docker container and has the following functions:

  • Solve the problem that there is no tc command in the target container of the exercise
  • Support node drills

If there is no above requirement, you can set it to false, that is, configure daemonset.enable=false when using helm to install This version has enhanced this parameter. Before version 1.3.0, the deployment of chaosblade-tool was controlled by the chaosblade operator. The current version is a separate yaml file for deployment, which is convenient for modifying the deployment parameters and supports the deployment of designated nodes. ​

Add chaosblade-deploy-mode flag when drill Pod and Container targets

The chaosblade-deploy-mode parameter controls the deployment mode of the drill tool. The values are download and copy, and the default is copy. copy is similar to the kubectl cp command, but if there are a large number of machines at the same time, it will cause a certain load pressure on the apiserver, which is suitable for small-scale exercises. download is a download tool that executes the curl command in the container. It requires a configuration file download address, even if it has a limited impact on the apiserver under a large-scale exercise.

  • copy: Copy the required tools from the chaosblade-operator container to the target container.
  • download: Download the required tool from the specified url to the target container. Need to configure the chaosblade-download-url parameter or specify the blade.downloadUrl configuration when deploying chaosblade-operator. It should be noted that the file directory and file name should be as follows, and the following directory should be maintained:
.
├── bin
├── blade
├── lib.tar.gz
└── yaml.tar.gz
- bin: store basic resource experiment tools
- blade: chaosblade cli tool
- lib.tar.gz: lib file compression package
- yaml.tar.gz: yaml file compression package

Deployment rules:

  • First judge whether the --chaosblade-override parameter is true, if so, even if the file already exists, the required file will be redeployed;
  • According to the --chaosblade-path parameter (default is /opt), determine whether the chaosblade directory exists, and if it does not exist, create it;
  • Determine whether the chaosblade/blade file exists, copy or download if it does not exist;
  • Determine whether the chaosblade/yaml directory exists. If it does not exist, copy or download yaml.tar.gz and decompress it;
  • Determine whether the chaosblade/bin/chaos_os file exists, copy or download if it does not exist;
  • Download other files needed according to the experimental scenario:
    • If it is Java, judge whether the chaosblade/lib directory exists, if it does not exist, copy or download lib.tar.gz and decompress it
    • If it is a network experiment, judge whether the chaosblade/bin/chaos_tcnetwork file exists, and if it does not exist, copy or download it.
    • And so on.

Use the default mode

blade c k8s pod-cpu fullload --names logtail-ds-gzd72 --namespace kube-system -d --kubeconfig ~/.kube/config                     
{"code":200,"success":true,"result":"5bf33579c3f768ee"}

Use download mode

blade c k8s pod-cpu fullload --chaosblade-deploy-mode download --chaosblade-download-url https://chaosblade.oss-xxx.aliyuncs.com/agent/github/1.3.0 --names logtail-ds-gzd72 --namespace kube-system -d --kubeconfig ~/.kube/config                     
{"code":200,"success":true,"result":"dcdf0a13814fcacc"}

Specify the download address when deploying the operator

helm install chaosblade-operator chaosblade-operator-1.3.0-v3.tgz --namespace chaosblade --set blade.downloadUrl=https://chaosblade.oss-xxxxx.aliyuncs.com/agent/github/1.3.0  

Support redeploying the chaosblade tool to the container

Adding the --chaosblade-override parameter when creating an experiment will redeploy the tool to the target container, which is suitable for use when the tool is updated.

The above new scenes are also supported by kubernetes

Solve the problem of Pod, Container network scenario recovery failure

V1.2.0 and earlier versions use containerId to find the rehearsal container. If the network is not accessible, the container will be rebuilt, and the containerId will change, causing the recovery to fail. The v1.3.0 version uses container name to find it internally.

Disk IO walkthrough supports alpine container

Other

Experimental query supports action and flag parameters

blade s --type c --action stop
{
	"code": 200,
	"success": true,
	"result": [
		{
			"Uid": "a6da606fbcdea2cb",
			"Command": "systemd",
			"SubCommand": "stop",
			"Flag": " --service=docker",
			"Status": "Success",
			"Error": "",
			"CreateTime": "2021-08-05T11:07:05.373964934+08:00",
			"UpdateTime": "2021-08-05T11:07:06.615654415+08:00"
		}
	]
}
blade s --type c --flag-filter service
{
	"code": 200,
	"success": true,
	"result": [
		{
			"Uid": "a6da606fbcdea2cb",
			"Command": "systemd",
			"SubCommand": "stop",
			"Flag": " --service=docker",
			"Status": "Success",
			"Error": "",
			"CreateTime": "2021-08-05T11:07:05.373964934+08:00",
			"UpdateTime": "2021-08-05T11:07:06.615654415+08:00"
		}
	]
}