-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* init push Signed-off-by: Sandeep Hans <[email protected]> * remove litmus + updated readme Signed-off-by: Sandeep Hans <[email protected]> * remove redundant files Signed-off-by: Sandeep Hans <[email protected]> * removed generated file+unused reference --------- Signed-off-by: Sandeep Hans <[email protected]> Co-authored-by: Naga Ravi Chaitanya Elluri <[email protected]>
- Loading branch information
1 parent
804d7cb
commit 19ad2d1
Showing
24 changed files
with
1,383 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# aichaos | ||
Enhancing Chaos Engineering with AI-assisted fault injection for better resiliency and non-functional testing. | ||
|
||
## Generate python package wheel file | ||
``` | ||
python3.9 generate_wheel_package.py sdist bdist_wheel | ||
``` | ||
This creates a python package file aichaos-0.0.1-py3-none-any.whl in the dist folder. | ||
|
||
## Build Image | ||
``` | ||
cd docker | ||
podman build -t aichaos:1.0 . | ||
OR | ||
docker build -t aichaos:1.0 . | ||
``` | ||
|
||
## Run Chaos AI | ||
``` | ||
podman run -v aichaos-config.json:/config/aichaos-config.json --privileged=true --name aichaos -p 5001:5001 aichaos:1.0 | ||
OR | ||
docker run -v aichaos-config.json:/config/aichaos-config.json --privileged -v /var/run/docker.sock:/var/run/docker.sock --name aichaos -p 5001:5001 aichaos:1.0 | ||
``` | ||
|
||
The output should look like: | ||
``` | ||
$ podman run -v aichaos-config.json:/config/aichaos-config.json --privileged=true --name aichaos -p 5001:5001 aichaos:1.0 | ||
* Serving Flask app 'swagger_api' (lazy loading) | ||
* Environment: production | ||
WARNING: This is a development server. Do not use it in a production deployment. | ||
Use a production WSGI server instead. | ||
* Debug mode: on | ||
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. | ||
* Running on all addresses (0.0.0.0) | ||
* Running on http://127.0.0.1:5001 | ||
* Running on http://172.17.0.2:5001 | ||
``` | ||
|
||
You can try out the APIs in browser at http://<server-ip>:5001/apidocs (eg. http://127.0.0.1:5001/apidocs). For testing out, you can try “GenerateChaos” api with ‘kubeconfig’ file and application URLs to test. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM bitnami/kubectl:1.20.9 as kubectl | ||
FROM python:3.9 | ||
WORKDIR /app | ||
RUN pip3 install --upgrade pip | ||
COPY config config/ | ||
COPY requirements.txt . | ||
RUN mkdir -p /app/logs | ||
RUN pip3 install -r requirements.txt | ||
|
||
COPY --from=kubectl /opt/bitnami/kubectl/bin/kubectl /usr/local/bin/ | ||
|
||
COPY swagger_api.py . | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
RUN curl -fsSLO https://get.docker.com/builds/Linux/x86_64/docker-17.03.1-ce.tgz && tar --strip-components=1 -xvzf docker-17.03.1-ce.tgz -C /usr/local/bin | ||
|
||
RUN apt-get update && apt-get install -y podman | ||
|
||
COPY aichaos-0.0.1-py3-none-any.whl . | ||
RUN pip3 install aichaos-0.0.1-py3-none-any.whl | ||
CMD ["python3", "swagger_api.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"command": "podman", | ||
"chaosengine": "kraken", | ||
"faults": "pod-delete", | ||
"iterations": 1, | ||
"maxfaults": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
Get Log from the Chaos ID.--- | ||
tags: | ||
- ChaosAI API Results | ||
parameters: | ||
- name: chaosid | ||
in: path | ||
type: string | ||
required: true | ||
description: Chaos-ID | ||
responses: | ||
500: | ||
description: Error! | ||
200: | ||
description: Results for the given Chaos ID. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"apiVersion": "1.0", | ||
"kind": "ChaosEngine", | ||
"metadata": { | ||
"name": "engine-cartns3" | ||
}, | ||
"spec": { | ||
"engineState": "active", | ||
"annotationCheck": "false", | ||
"appinfo": { | ||
"appns": "robot-shop", | ||
"applabel": "service=payment", | ||
"appkind": "deployment" | ||
}, | ||
"chaosServiceAccount": "pod-delete-sa", | ||
"experiments": [ | ||
{ | ||
"name": "pod-delete", | ||
"spec": { | ||
"components": { | ||
"env": [ | ||
{ | ||
"name": "FORCE", | ||
"value": "true" | ||
}, | ||
{ | ||
"name": "TOTAL_CHAOS_DURATION", | ||
"value": "120" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
Generate chaos on an application deployed on a cluster. | ||
--- | ||
tags: | ||
- ChaosAI API | ||
parameters: | ||
- name: file | ||
in: formData | ||
type: file | ||
required: true | ||
description: Kube-config file | ||
- name: namespace | ||
in: formData | ||
type: string | ||
default: robot-shop | ||
required: true | ||
description: Namespace to test | ||
- name: podlabels | ||
in: formData | ||
type: string | ||
default: service=cart,service=payment | ||
required: true | ||
description: Pod labels to test | ||
- name: nodelabels | ||
in: formData | ||
type: string | ||
required: false | ||
description: Node labels to test | ||
- name: urls | ||
in: formData | ||
type: string | ||
default: http://<application-url>:8097/api/cart/health,http://<application-url>:8097/api/payment/health | ||
required: true | ||
description: Application URLs to test | ||
|
||
responses: | ||
500: | ||
description: Error! | ||
200: | ||
description: Chaos ID for the initiated chaos. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
Get Episodes from the Chaos ID.--- | ||
tags: | ||
- ChaosAI API Results | ||
parameters: | ||
- name: chaosid | ||
in: path | ||
type: string | ||
required: true | ||
description: Chaos-ID | ||
responses: | ||
500: | ||
description: Error! | ||
200: | ||
description: Results for the given Chaos ID. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
Get Log from the Chaos ID.--- | ||
tags: | ||
- ChaosAI API Results | ||
parameters: | ||
- name: chaosid | ||
in: path | ||
type: string | ||
required: true | ||
description: Chaos-ID | ||
responses: | ||
500: | ||
description: Error! | ||
200: | ||
description: Results for the given Chaos ID. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
Get QTable from the Chaos ID.--- | ||
tags: | ||
- ChaosAI API Results | ||
parameters: | ||
- name: chaosid | ||
in: path | ||
type: string | ||
required: true | ||
description: Chaos-ID | ||
responses: | ||
500: | ||
description: Error! | ||
200: | ||
description: Results for the given Chaos ID. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
Get status of the Constraints ID.--- | ||
tags: | ||
- ChaosAI API | ||
parameters: | ||
- name: chaosid | ||
in: path | ||
type: string | ||
required: true | ||
description: Chaos-ID | ||
responses: | ||
500: | ||
description: Error! | ||
200: | ||
description: Chaos for the given ID. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
numpy | ||
pandas | ||
requests | ||
Flask==2.1.0 | ||
Werkzeug==2.2.2 | ||
flasgger==0.9.5 |
Oops, something went wrong.