Skip to content

Commit b59cb75

Browse files
committed
Update Dockerfile and entrypoint.sh for chaos experiments. Changed base image to 'litmuschaos/chaos-ci-lib:v0.5.0', standardized EXPERIMENT_IMAGE_TAG to '3.18.0', and improved experiment configuration by setting default values and cleanup options. Updated README files across multiple experiments to reflect these changes.
Signed-off-by: Sky Singh <[email protected]>
1 parent 6da76fa commit b59cb75

File tree

16 files changed

+120
-109
lines changed

16 files changed

+120
-109
lines changed

Dockerfile

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:latest
1+
FROM litmuschaos/chaos-ci-lib:v0.5.0
22

33
LABEL name="Kubernetes Chaos"
44
LABEL repository="http://github.com/litmuschaos/github-chaos-actions"
@@ -10,33 +10,6 @@ LABEL com.github.actions.description="Different Chaos Experiment for Kubernetes"
1010
LABEL com.github.actions.icon="terminal"
1111
LABEL com.github.actions.color="blue"
1212

13-
ENV GOPATH=/github/home/go
14-
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"
18-
19-
ARG KUBECTL_VERSION=1.22.0
20-
ADD https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl /usr/local/bin/kubectl
21-
RUN chmod +x /usr/local/bin/kubectl
22-
23-
RUN apt-get update && apt-get install -y git \
24-
curl \
25-
unzip \
26-
python3-pip \
27-
&& apt-get clean
28-
29-
RUN apt-get update && \
30-
curl -L ${RELEASE_ROOT}/${RELEASE_FILE} |tar xvz && \
31-
mv linux-amd64/helm /usr/bin/helm && \
32-
chmod +x /usr/bin/helm
33-
34-
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
35-
unzip awscliv2.zip && \
36-
./aws/install
37-
38-
RUN pip install oci-cli
39-
4013
COPY README.md /
4114
COPY entrypoint.sh /entrypoint.sh
4215
COPY experiments ./experiments

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
env:
8181
EXPERIMENT_NAME: pod-delete
8282
EXPERIMENT_IMAGE: litmuschaos/go-runner
83-
EXPERIMENT_IMAGE_TAG: latest
83+
EXPERIMENT_IMAGE_TAG: 3.18.0
8484
JOB_CLEANUP_POLICY: delete
8585
APP_NS: default
8686
APP_LABEL: run=nginx
@@ -140,7 +140,7 @@ jobs:
140140
env:
141141
EXPERIMENT_NAME: pod-delete
142142
EXPERIMENT_IMAGE: litmuschaos/go-runner
143-
EXPERIMENT_IMAGE_TAG: latest
143+
EXPERIMENT_IMAGE_TAG: 3.18.0
144144
JOB_CLEANUP_POLICY: delete
145145
APP_NS: default
146146
APP_LABEL: run=nginx
@@ -224,7 +224,7 @@ Some comman environment variables used for running the `github-chaos-actions` ar
224224
<td> EXPERIMENT_IMAGE_TAG </td>
225225
<td> We can set the image tag while using custom image for the chaos experiment </td>
226226
<td> Optional </td>
227-
<td> Default value is latest </td>
227+
<td> Default value is 3.18.0 </td>
228228
</tr>
229229
<tr>
230230
<td>IMAGE_PULL_POLICY </td>

entrypoint.sh

Lines changed: 69 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
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-
95
##Extract the base64 encoded config data and write this to the KUBECONFIG
106
if [ ! -z "$KUBE_CONFIG_DATA" ]
117
then
@@ -14,43 +10,85 @@ then
1410
export KUBECONFIG=${HOME}/.kube/config
1511
fi
1612

17-
##Setup
18-
mkdir -p $HOME/go/src/github.com/litmuschaos
19-
cd ${GOPATH}/src/github.com/litmuschaos/
20-
dir=${GOPATH}/src/github.com/litmuschaos/chaos-ci-lib
21-
13+
##Setup AWS credentials if provided
2214
if [[ ! -z $AWS_ACCESS_KEY_ID ]] && [[ ! -z $AWS_SECRET_ACCESS_KEY ]] && [[ ! -z $AWS_DEFAULT_REGION ]]
2315
then
2416
aws configure set default.region ${AWS_DEFAULT_REGION}
2517
aws configure set aws_access_key_id ${AWS_ACCESS_KEY_ID}
2618
aws configure set aws_secret_access_key ${AWS_SECRET_ACCESS_KEY}
2719
fi
2820

29-
if [ ! -d $dir ]
30-
then
31-
git clone https://github.com/litmuschaos/chaos-ci-lib.git
32-
fi
33-
cd chaos-ci-lib
21+
# Set default values for experiment configuration
22+
EXPERIMENT_IMAGE=${EXPERIMENT_IMAGE:-"litmuschaos/go-runner"}
23+
EXPERIMENT_IMAGE_TAG=${EXPERIMENT_IMAGE_TAG:-"3.18.0"}
24+
TOTAL_CHAOS_DURATION=${TOTAL_CHAOS_DURATION:-60}
3425

35-
##Install litmus if it is not already installed
36-
if [ "$INSTALL_LITMUS" == "true" ]
37-
then
38-
go test litmus/install-litmus_test.go -v -count=1
26+
# Handle Litmus installation if requested
27+
if [ "$INSTALL_LITMUS" = "true" ]; then
28+
echo "Installing Litmus..."
29+
/app/install-litmus
3930
fi
4031

41-
if [ "$EXPERIMENT_NAME" == "all" ]; then
42-
## Run all BDDs
43-
cd experiments
44-
ginkgo -nodes=${PARALLEL_EXECUTION}
45-
cd ..
46-
47-
elif [ ! -z "$EXPERIMENT_NAME" ]; then
48-
## Run the selected chaos experiment
49-
go test experiments/${EXPERIMENT_NAME}_test.go -v -count=1 -timeout=${TEST_TIMEOUT}s
32+
# Handle Litmus cleanup if requested and no experiment is specified
33+
if [ "$LITMUS_CLEANUP" = "true" ] && [ -z "$EXPERIMENT_NAME" ]; then
34+
echo "Cleaning up Litmus..."
35+
/app/uninstall-litmus
36+
exit 0
5037
fi
5138

52-
##litmus cleanup
53-
if [ "$LITMUS_CLEANUP" == "true" ]
54-
then
55-
go test litmus/uninstall-litmus_test.go -v -count=1
39+
# Map experiment names to their corresponding scripts in chaos-ci-lib
40+
case "$EXPERIMENT_NAME" in
41+
"pod-delete")
42+
/app/pod-delete
43+
;;
44+
"container-kill")
45+
/app/container-kill
46+
;;
47+
"pod-cpu-hog")
48+
/app/pod-cpu-hog
49+
;;
50+
"pod-memory-hog")
51+
/app/pod-memory-hog
52+
;;
53+
"node-cpu-hog")
54+
/app/node-cpu-hog
55+
;;
56+
"node-memory-hog")
57+
/app/node-memory-hog
58+
;;
59+
"node-io-stress")
60+
/app/node-io-stress
61+
;;
62+
"disk-fill")
63+
/app/disk-fill
64+
;;
65+
"pod-network-latency")
66+
/app/pod-network-latency
67+
;;
68+
"pod-network-loss")
69+
/app/pod-network-loss
70+
;;
71+
"pod-network-corruption")
72+
/app/pod-network-corruption
73+
;;
74+
"pod-network-duplication")
75+
/app/pod-network-duplication
76+
;;
77+
"pod-autoscaler")
78+
/app/pod-autoscaler
79+
;;
80+
"all")
81+
/app/all-experiments
82+
;;
83+
*)
84+
echo "Unknown experiment: $EXPERIMENT_NAME"
85+
echo "Available experiments: pod-delete, container-kill, pod-cpu-hog, pod-memory-hog, node-cpu-hog, node-memory-hog, node-io-stress, disk-fill, pod-network-latency, pod-network-loss, pod-network-corruption, pod-network-duplication, pod-autoscaler, all"
86+
exit 1
87+
;;
88+
esac
89+
90+
# Handle Litmus cleanup after experiment if requested
91+
if [ "$LITMUS_CLEANUP" = "true" ] && [ ! -z "$EXPERIMENT_NAME" ]; then
92+
echo "Cleaning up Litmus after experiment..."
93+
/app/uninstall-litmus
5694
fi

experiments/container-kill/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
# Experiment Configuration
4545
EXPERIMENT_NAME: container-kill
4646
EXPERIMENT_IMAGE: litmuschaos/go-runner
47-
EXPERIMENT_IMAGE_TAG: 1.13.8
47+
EXPERIMENT_IMAGE_TAG: 3.18.0
4848

4949

5050
# Container Kill Specific Configuration
@@ -55,14 +55,14 @@ jobs:
5555
SOCKET_PATH: /run/containerd/containerd.sock
5656
SIGNAL: SIGKILL
5757
SEQUENCE: parallel
58-
PODS_AFFECTED_PERC: 100
58+
PODS_AFFECTED_PERC: 0
5959
DEFAULT_HEALTH_CHECK: false
6060

6161
# Optional Probe Setup
6262
LITMUS_CREATE_PROBE: "true"
6363
LITMUS_PROBE_NAME: "http-status-check"
6464
LITMUS_PROBE_TYPE: "httpProbe"
65-
LITMUS_PROBE_MODE: "Continuous"
65+
LITMUS_PROBE_MODE: "SOT"
6666
LITMUS_PROBE_URL: "http://nginx-svc:80/"
6767
LITMUS_PROBE_RESPONSE_CODE: "200"
6868

@@ -311,7 +311,7 @@ The following environment variables are used to configure the container-kill exp
311311
<td> EXPERIMENT_IMAGE_TAG </td>
312312
<td> We can set the image tag while using custom image for the chaos experiment </td>
313313
<td> Optional </td>
314-
<td> 1.13.8 </td>
314+
<td> 3.18.0 </td>
315315
</tr>
316316
<tr>
317317
<td> IMAGE_PULL_POLICY </td>

experiments/disk-fill/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
# Experiment Configuration
4747
EXPERIMENT_NAME: disk-fill
4848
EXPERIMENT_IMAGE: litmuschaos/go-runner
49-
EXPERIMENT_IMAGE_TAG: 1.13.8
49+
EXPERIMENT_IMAGE_TAG: 3.18.0
5050

5151

5252
# Disk Fill Specific Configuration
@@ -60,7 +60,7 @@ jobs:
6060
LITMUS_CREATE_PROBE: "true"
6161
LITMUS_PROBE_NAME: "http-status-check"
6262
LITMUS_PROBE_TYPE: "httpProbe"
63-
LITMUS_PROBE_MODE: "Continuous"
63+
LITMUS_PROBE_MODE: "SOT"
6464
LITMUS_PROBE_URL: "http://nginx-svc:80/"
6565
LITMUS_PROBE_RESPONSE_CODE: "200"
6666

@@ -309,7 +309,7 @@ The following environment variables are used to configure the disk-fill experime
309309
<td> EXPERIMENT_IMAGE_TAG </td>
310310
<td> We can set the image tag while using custom image for the chaos experiment </td>
311311
<td> Optional </td>
312-
<td> 1.13.8 </td>
312+
<td> 3.18.0 </td>
313313
</tr>
314314
<tr>
315315
<td> IMAGE_PULL_POLICY </td>

experiments/node-cpu-hog/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
# Experiment Configuration
4545
EXPERIMENT_NAME: node-cpu-hog
4646
EXPERIMENT_IMAGE: litmuschaos/go-runner
47-
EXPERIMENT_IMAGE_TAG: 1.13.8
47+
EXPERIMENT_IMAGE_TAG: 3.18.0
4848

4949

5050
# Node CPU Hog Specific Configuration
@@ -57,7 +57,7 @@ jobs:
5757
LITMUS_CREATE_PROBE: "true"
5858
LITMUS_PROBE_NAME: "http-status-check"
5959
LITMUS_PROBE_TYPE: "httpProbe"
60-
LITMUS_PROBE_MODE: "Continuous"
60+
LITMUS_PROBE_MODE: "SOT"
6161
LITMUS_PROBE_URL: "http://nginx-svc:80/"
6262
LITMUS_PROBE_RESPONSE_CODE: "200"
6363

@@ -300,7 +300,7 @@ The following environment variables are used to configure the node-cpu-hog exper
300300
<td> EXPERIMENT_IMAGE_TAG </td>
301301
<td> We can set the image tag while using custom image for the chaos experiment </td>
302302
<td> Optional </td>
303-
<td> 1.13.8 </td>
303+
<td> 3.18.0 </td>
304304
</tr>
305305
<tr>
306306
<td> IMAGE_PULL_POLICY </td>

experiments/node-io-stress/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
# Experiment Configuration
4444
EXPERIMENT_NAME: node-io-stress
4545
EXPERIMENT_IMAGE: litmuschaos/go-runner
46-
EXPERIMENT_IMAGE_TAG: 1.13.8
46+
EXPERIMENT_IMAGE_TAG: 3.18.0
4747

4848

4949
# Node IO Stress Specific Configuration
@@ -56,7 +56,7 @@ jobs:
5656
LITMUS_CREATE_PROBE: "true"
5757
LITMUS_PROBE_NAME: "http-status-check"
5858
LITMUS_PROBE_TYPE: "httpProbe"
59-
LITMUS_PROBE_MODE: "Continuous"
59+
LITMUS_PROBE_MODE: "SOT"
6060
LITMUS_PROBE_URL: "http://nginx-svc:80/"
6161
LITMUS_PROBE_RESPONSE_CODE: "200"
6262

@@ -299,7 +299,7 @@ The following environment variables are used to configure the node-io-stress exp
299299
<td> EXPERIMENT_IMAGE_TAG </td>
300300
<td> We can set the image tag while using custom image for the chaos experiment </td>
301301
<td> Optional </td>
302-
<td> 1.13.8 </td>
302+
<td> 3.18.0 </td>
303303
</tr>
304304
<tr>
305305
<td> IMAGE_PULL_POLICY </td>

experiments/node-memory-hog/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
# Experiment Configuration
4545
EXPERIMENT_NAME: node-memory-hog
4646
EXPERIMENT_IMAGE: litmuschaos/go-runner
47-
EXPERIMENT_IMAGE_TAG: 1.13.8
47+
EXPERIMENT_IMAGE_TAG: 3.18.0
4848

4949

5050
# Node Memory Hog Specific Configuration
@@ -57,7 +57,7 @@ jobs:
5757
LITMUS_CREATE_PROBE: "true"
5858
LITMUS_PROBE_NAME: "http-status-check"
5959
LITMUS_PROBE_TYPE: "httpProbe"
60-
LITMUS_PROBE_MODE: "Continuous"
60+
LITMUS_PROBE_MODE: "SOT"
6161
LITMUS_PROBE_URL: "http://nginx-svc:80/"
6262
LITMUS_PROBE_RESPONSE_CODE: "200"
6363

@@ -300,7 +300,7 @@ The following environment variables are used to configure the node-memory-hog ex
300300
<td> EXPERIMENT_IMAGE_TAG </td>
301301
<td> We can set the image tag while using custom image for the chaos experiment </td>
302302
<td> Optional </td>
303-
<td> 1.13.8 </td>
303+
<td> 3.18.0 </td>
304304
</tr>
305305
<tr>
306306
<td> IMAGE_PULL_POLICY </td>

experiments/pod-autoscaler/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
# Experiment Configuration
4343
EXPERIMENT_NAME: pod-autoscaler
4444
EXPERIMENT_IMAGE: litmuschaos/go-runner
45-
EXPERIMENT_IMAGE_TAG: 1.13.8
45+
EXPERIMENT_IMAGE_TAG: 3.18.0
4646

4747

4848
# Pod Autoscaler Specific Configuration
@@ -56,7 +56,7 @@ jobs:
5656
LITMUS_CREATE_PROBE: "true"
5757
LITMUS_PROBE_NAME: "http-status-check"
5858
LITMUS_PROBE_TYPE: "httpProbe"
59-
LITMUS_PROBE_MODE: "Continuous"
59+
LITMUS_PROBE_MODE: "SOT"
6060
LITMUS_PROBE_URL: "http://nginx-svc:80/"
6161
LITMUS_PROBE_RESPONSE_CODE: "200"
6262

@@ -305,7 +305,7 @@ The following environment variables are used to configure the pod-autoscaler exp
305305
<td> EXPERIMENT_IMAGE_TAG </td>
306306
<td> We can set the image tag while using custom image for the chaos experiment </td>
307307
<td> Optional </td>
308-
<td> 1.13.8 </td>
308+
<td> 3.18.0 </td>
309309
</tr>
310310
<tr>
311311
<td> IMAGE_PULL_POLICY </td>

experiments/pod-cpu-hog/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,20 @@ jobs:
4444
# Experiment Configuration
4545
EXPERIMENT_NAME: pod-cpu-hog
4646
EXPERIMENT_IMAGE: litmuschaos/go-runner
47-
EXPERIMENT_IMAGE_TAG: 1.13.8
47+
EXPERIMENT_IMAGE_TAG: 3.18.0
4848

4949

5050
# Pod CPU Hog Specific Configuration
5151
TARGET_CONTAINER: nginx
5252
TOTAL_CHAOS_DURATION: 60
5353
CPU_CORES: 1
54-
PODS_AFFECTED_PERC: 100
54+
PODS_AFFECTED_PERC: 0
5555

5656
# Optional Probe Setup
5757
LITMUS_CREATE_PROBE: "true"
5858
LITMUS_PROBE_NAME: "http-status-check"
5959
LITMUS_PROBE_TYPE: "httpProbe"
60-
LITMUS_PROBE_MODE: "Continuous"
60+
LITMUS_PROBE_MODE: "SOT"
6161
LITMUS_PROBE_URL: "http://nginx-svc:80/"
6262
LITMUS_PROBE_RESPONSE_CODE: "200"
6363

@@ -294,7 +294,7 @@ The following environment variables are used to configure the pod-cpu-hog experi
294294
<td> EXPERIMENT_IMAGE_TAG </td>
295295
<td> We can set the image tag while using custom image for the chaos experiment </td>
296296
<td> Optional </td>
297-
<td> 1.13.8 </td>
297+
<td> 3.18.0 </td>
298298
</tr>
299299
<tr>
300300
<td> IMAGE_PULL_POLICY </td>

0 commit comments

Comments
 (0)