Skip to content

Commit 649304a

Browse files
authored
feat(actions): Update actions and add multiple experiment execution (#5)
Signed-off-by: Udit Gaurav <[email protected]>
1 parent bcde2b6 commit 649304a

File tree

13 files changed

+221
-46
lines changed

13 files changed

+221
-46
lines changed

Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,24 @@ LABEL com.github.actions.color="blue"
1212

1313
ENV GOPATH=/github/home/go
1414
ENV PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
15+
ARG HELM_VERSION=3.2.3
16+
ARG RELEASE_ROOT="https://get.helm.sh"
17+
ARG RELEASE_FILE="helm-v${HELM_VERSION}-linux-amd64.tar.gz"
1518

1619
ARG KUBECTL_VERSION=1.17.0
1720
ADD https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl /usr/local/bin/kubectl
1821
RUN chmod +x /usr/local/bin/kubectl
1922

2023
RUN apt-get update && apt-get install -y git && \
2124
apt-get install -y ssh && \
25+
apt-get install curl -y && \
2226
apt install ssh rsync
2327

28+
RUN apt-get update && \
29+
curl -L ${RELEASE_ROOT}/${RELEASE_FILE} |tar xvz && \
30+
mv linux-amd64/helm /usr/bin/helm && \
31+
chmod +x /usr/bin/helm
32+
2433
COPY README.md /
2534
COPY entrypoint.sh /entrypoint.sh
2635
COPY experiments ./experiments

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,20 @@ Some comman environment variables used for running the `github-chaos-actions` ar
140140
</tr>
141141
<tr>
142142
<td> EXPERIMENT_IMAGE </td>
143-
<td>We can provide cumstom image for running litmus chaos experiment </td>
143+
<td> We can provide custom image for running chaos experiment </td>
144144
<td> Optional </td>
145-
<td> Default value is litmuschaos/ansible-runner:latest </td>
145+
<td> Default value is litmuschaos/ansible-runner </td>
146146
</tr>
147+
<tr>
148+
<td> EXPERIMENT_IMAGE_TAG </td>
149+
<td> We can set the image tag while using custom image for the chaos experiment </td>
150+
<td> Optional </td>
151+
<td> Default value is latest </td>
152+
</tr>
153+
<tr>
154+
<td>IMAGE_PULL_POLICY </td>
155+
<td> We can set the image pull policy while using custom image for running chaos experiment </td>
156+
<td> Optional </td>
157+
<td> Default value is Always </td>
158+
</tr>
147159
</table>

entrypoint.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
set -e
44

5+
TOTAL_CHAOS_DURATION=${TOTAL_CHAOS_DURATION:=60}
6+
TEST_TIMEOUT=$((600 + $TOTAL_CHAOS_DURATION))
7+
PARALLEL_EXECUTION=${PARALLEL_EXECUTION:=1}
8+
59
##Extract the base64 encoded config data and write this to the KUBECONFIG
610
mkdir -p ${HOME}/.kube
711
echo "$KUBE_CONFIG_DATA" | base64 --decode > ${HOME}/.kube/config
@@ -11,9 +15,10 @@ export KUBECONFIG=${HOME}/.kube/config
1115
mkdir -p $HOME/go/src/github.com/mayadata-io
1216
cd ${GOPATH}/src/github.com/mayadata-io/
1317
dir=${GOPATH}/src/github.com/mayadata-io/chaos-ci-lib
18+
1419
if [ ! -d $dir ]
1520
then
16-
git clone https://github.com/mayadata-io/chaos-ci-lib.git
21+
git clone -b v0.1.1 --single-branch https://github.com/mayadata-io/chaos-ci-lib.git
1722
fi
1823
cd chaos-ci-lib
1924

@@ -23,8 +28,16 @@ then
2328
go test tests/install-litmus_test.go -v -count=1
2429
fi
2530

26-
##Running the selected chaos experiment template
27-
go test tests/${EXPERIMENT_NAME}_test.go -v -count=1
31+
if [ "$EXPERIMENT_NAME" == "all" ]; then
32+
## Run all BDDs
33+
cd tests
34+
ginkgo -nodes=${PARALLEL_EXECUTION}
35+
cd ..
36+
37+
else
38+
## Run the selected chaos experiment template
39+
go test tests/${EXPERIMENT_NAME}_test.go -v -count=1 -timeout=${TEST_TIMEOUT}s
40+
fi
2841

2942
##litmus cleanup
3043
if [ "$LITMUS_CLEANUP" = "true" ]

experiments/container-kill/README.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
runs-on: ubuntu-latest
2323

2424
- name: Running container kill chaos experiment
25-
uses: mayadata-io/[email protected].0
25+
uses: mayadata-io/[email protected].1
2626
env:
2727
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
2828
##If litmus is not installed
@@ -33,7 +33,9 @@ jobs:
3333
APP_KIND: deployment
3434
EXPERIMENT_NAME: container-kill
3535
##Custom images can also be used
36-
EXPERIMENT_IMAGE: litmuschaos/ansible-runner:latest
36+
EXPERIMENT_IMAGE: litmuschaos/ansible-runner
37+
EXPERIMENT_IMAGE_TAG: latest
38+
IMAGE_PULL_POLICY: Always
3739
TARGET_CONTAINER: nginx
3840
TOTAL_CHAOS_DURATION: 20
3941
CHAOS_INTERVAL: 10
@@ -109,8 +111,20 @@ The application pod for container-kill will be identified with the app info vari
109111
</tr>
110112
<tr>
111113
<td> EXPERIMENT_IMAGE </td>
112-
<td> We can provide cumstom image for running litmus chaos experiment </td>
114+
<td> We can provide custom image for running chaos experiment </td>
113115
<td> Optional </td>
114-
<td> Default value is litmuschaos/ansible-runner:latest </td>
116+
<td> Default value is litmuschaos/ansible-runner </td>
117+
</tr>
118+
<tr>
119+
<td> EXPERIMENT_IMAGE_TAG </td>
120+
<td> We can set the image tag while using custom image for the chaos experiment </td>
121+
<td> Optional </td>
122+
<td> Default value is latest </td>
123+
</tr>
124+
<tr>
125+
<td>IMAGE_PULL_POLICY </td>
126+
<td> We can set the image pull policy while using custom image for running chaos experiment </td>
127+
<td> Optional </td>
128+
<td> Default value is Always </td>
115129
</tr>
116130
</table>

experiments/disk-fill/README.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
runs-on: ubuntu-latest
2525

2626
- name: Running disk-fill chaos experiment
27-
uses: mayadata-io/[email protected].0
27+
uses: mayadata-io/[email protected].1
2828
env:
2929
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
3030
##If litmus is not installed
@@ -37,7 +37,9 @@ jobs:
3737
FILL_PERCENTAGE: 80
3838
TARGET_CONTAINER: nginx
3939
##Custom images can also be used
40-
EXPERIMENT_IMAGE: litmuschaos/ansible-runner:latest
40+
EXPERIMENT_IMAGE: litmuschaos/ansible-runner
41+
EXPERIMENT_IMAGE_TAG: latest
42+
IMAGE_PULL_POLICY: Always
4143
##Select true if you want to uninstall litmus after chaos
4244
LITMUS_CLEANUP: true
4345
```
@@ -105,8 +107,20 @@ The application pod for disk-fill will be identified with the app info variables
105107
</tr>
106108
<tr>
107109
<td> EXPERIMENT_IMAGE </td>
108-
<td>We can provide cumstom image for running litmus chaos experiment </td>
110+
<td> We can provide custom image for running chaos experiment </td>
109111
<td> Optional </td>
110-
<td> Default value is litmuschaos/ansible-runner:latest </td>
112+
<td> Default value is litmuschaos/ansible-runner </td>
111113
</tr>
114+
<tr>
115+
<td> EXPERIMENT_IMAGE_TAG </td>
116+
<td> We can set the image tag while using custom image for the chaos experiment </td>
117+
<td> Optional </td>
118+
<td> Default value is latest </td>
119+
</tr>
120+
<tr>
121+
<td>IMAGE_PULL_POLICY </td>
122+
<td> We can set the image pull policy while using custom image for running chaos experiment </td>
123+
<td> Optional </td>
124+
<td> Default value is Always </td>
125+
</tr>
112126
</table>

experiments/node-cpu-hog/README.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
runs-on: ubuntu-latest
2222

2323
- name: Running node-cpu-hog chaos experiment
24-
uses: mayadata-io/[email protected].0
24+
uses: mayadata-io/[email protected].1
2525
env:
2626
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
2727
##If litmus is not installed
@@ -32,7 +32,9 @@ jobs:
3232
APP_KIND: deployment
3333
EXPERIMENT_NAME: node-cpu-hog
3434
##Custom images can also be used
35-
EXPERIMENT_IMAGE: litmuschaos/ansible-runner:latest
35+
EXPERIMENT_IMAGE: litmuschaos/ansible-runner
36+
EXPERIMENT_IMAGE_TAG: latest
37+
IMAGE_PULL_POLICY: Always
3638
TOTAL_CHAOS_DURATION: 60
3739
NODE_CPU_CORE: 2
3840
##Select true if you want to uninstall litmus after chaos
@@ -102,8 +104,20 @@ The application pod for node-cpu-hog will be identified with the app info variab
102104
</tr>
103105
<tr>
104106
<td> EXPERIMENT_IMAGE </td>
105-
<td>We can provide cumstom image for running litmus chaos experiment </td>
107+
<td> We can provide custom image for running chaos experiment </td>
106108
<td> Optional </td>
107-
<td> Default value is litmuschaos/ansible-runner:latest </td>
109+
<td> Default value is litmuschaos/ansible-runner </td>
108110
</tr>
111+
<tr>
112+
<td> EXPERIMENT_IMAGE_TAG </td>
113+
<td> We can set the image tag while using custom image for the chaos experiment </td>
114+
<td> Optional </td>
115+
<td> Default value is latest </td>
116+
</tr>
117+
<tr>
118+
<td>IMAGE_PULL_POLICY </td>
119+
<td> We can set the image pull policy while using custom image for running chaos experiment </td>
120+
<td> Optional </td>
121+
<td> Default value is Always </td>
122+
</tr>
109123
</table>

experiments/node-memory-hog/README.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
runs-on: ubuntu-latest
2222

2323
- name: Running node-memory-hog chaos experiment
24-
uses: mayadata-io/[email protected].0
24+
uses: mayadata-io/[email protected].1
2525
env:
2626
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
2727
##if litmus is not installed
@@ -32,7 +32,9 @@ jobs:
3232
APP_KIND: deployment
3333
EXPERIMENT_NAME: node-memory-hog
3434
##Custom images can also be used
35-
EXPERIMENT_IMAGE: litmuschaos/ansible-runner:latest
35+
EXPERIMENT_IMAGE: litmuschaos/ansible-runner
36+
EXPERIMENT_IMAGE_TAG: latest
37+
IMAGE_PULL_POLICY: Always
3638
TOTAL_CHAOS_DURATION: 120
3739
MEMORY_PERCENTAGE: 90
3840
##Select true if you want to uninstall litmus after chaos
@@ -102,8 +104,20 @@ The application pod for node-memory-hog will be identified with the app info var
102104
</tr>
103105
<tr>
104106
<td> EXPERIMENT_IMAGE </td>
105-
<td>We can provide cumstom image for running litmus chaos experiment </td>
107+
<td> We can provide custom image for running chaos experiment </td>
106108
<td> Optional </td>
107-
<td> Default value is litmuschaos/ansible-runner:latest </td>
109+
<td> Default value is litmuschaos/ansible-runner </td>
108110
</tr>
111+
<tr>
112+
<td> EXPERIMENT_IMAGE_TAG </td>
113+
<td> We can set the image tag while using custom image for the chaos experiment </td>
114+
<td> Optional </td>
115+
<td> Default value is latest </td>
116+
</tr>
117+
<tr>
118+
<td>IMAGE_PULL_POLICY </td>
119+
<td> We can set the image pull policy while using custom image for running chaos experiment </td>
120+
<td> Optional </td>
121+
<td> Default value is Always </td>
122+
</tr>
109123
</table>

experiments/pod-cpu-hog/README.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Pod CPU hog Hog Experiment
1+
# Pod CPU Hog Experiment
22

33
This experiment causes CPU resource consumption on specified application containers by starting one or more md5sum calculation process on the special file /dev/zero. It Can test the application's resilience to potential slowness/unavailability of some replicas due to high CPU load. Check <a href="https://docs.litmuschaos.io/docs/pod-cpu-hog/">pod cpu hog docs</a> for more info. To know more and get started with chaos-actions visit <a href="https://github.com/mayadata-io/github-chaos-actions/blob/master/README.md">github-chaos-actions</a>.
44

@@ -21,7 +21,7 @@ jobs:
2121
runs-on: ubuntu-latest
2222

2323
- name: Running pod-cpu-hog chaos experiment
24-
uses: mayadata-io/[email protected].0
24+
uses: mayadata-io/[email protected].1
2525
env:
2626
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
2727
##If litmus is not installed
@@ -32,7 +32,9 @@ jobs:
3232
APP_KIND: deployment
3333
EXPERIMENT_NAME: pod-cpu-hog
3434
##Custom images can also be used
35-
EXPERIMENT_IMAGE: litmuschaos/ansible-runner:latest
35+
EXPERIMENT_IMAGE: litmuschaos/ansible-runner
36+
EXPERIMENT_IMAGE_TAG: latest
37+
IMAGE_PULL_POLICY: Always
3638
TARGET_CONTAINER: nginx
3739
TOTAL_CHAOS_DURATION: 60
3840
CPU_CORES: 1
@@ -109,8 +111,20 @@ The application pod for pod-cpu-hog will be identified with the app info variabl
109111
</tr>
110112
<tr>
111113
<td> EXPERIMENT_IMAGE </td>
112-
<td>We can provide cumstom image for running litmus chaos experiment </td>
114+
<td>We can provide custom image for running litmus chaos experiment </td>
113115
<td> Optional </td>
114-
<td> Default value is litmuschaos/ansible-runner:latest </td>
116+
<td> Default value is litmuschaos/ansible-runner </td>
115117
</tr>
118+
<tr>
119+
<td> EXPERIMENT_IMAGE_TAG </td>
120+
<td> We can set the image tag while using custom image for the chaos experiment </td>
121+
<td> Optional </td>
122+
<td> Default value is latest </td>
123+
</tr>
124+
<tr>
125+
<td>IMAGE_PULL_POLICY </td>
126+
<td> We can set the image pull policy while using custom image for running chaos experiment </td>
127+
<td> Optional </td>
128+
<td> Default value is Always </td>
129+
</tr>
116130
</table>

experiments/pod-delete/README.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
runs-on: ubuntu-latest
2222

2323
- name: Running pod delete chaos experiment
24-
uses: mayadata-io/[email protected].0
24+
uses: mayadata-io/[email protected].1
2525
env:
2626
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
2727
##If litmus is not installed
@@ -32,7 +32,9 @@ jobs:
3232
APP_KIND: deployment
3333
EXPERIMENT_NAME: pod-delete
3434
##Custom images can also be used
35-
EXPERIMENT_IMAGE: litmuschaos/ansible-runner:latest
35+
EXPERIMENT_IMAGE: litmuschaos/ansible-runner
36+
EXPERIMENT_IMAGE_TAG: latest
37+
IMAGE_PULL_POLICY: Always
3638
TOTAL_CHAOS_DURATION: 30
3739
CHAOS_INTERVAL: 10
3840
FORCE: false
@@ -116,8 +118,20 @@ The application pod for pod-delete will be identified with the app info variable
116118
</tr>
117119
<tr>
118120
<td> EXPERIMENT_IMAGE </td>
119-
<td> We can provide cumstom image for running litmus chaos experiment </td>
121+
<td> We can provide custom image for running chaos experiment </td>
120122
<td> Optional </td>
121-
<td> Default value is litmuschaos/ansible-runner:latest </td>
123+
<td> Default value is litmuschaos/ansible-runner </td>
122124
</tr>
125+
<tr>
126+
<td> EXPERIMENT_IMAGE_TAG </td>
127+
<td> We can set the image tag while using custom image for the chaos experiment </td>
128+
<td> Optional </td>
129+
<td> Default value is latest </td>
130+
</tr>
131+
<tr>
132+
<td>IMAGE_PULL_POLICY </td>
133+
<td> We can set the image pull policy while using custom image for running chaos experiment </td>
134+
<td> Optional </td>
135+
<td> Default value is Always </td>
136+
</tr>
123137
</table>

0 commit comments

Comments
 (0)