From 2c675712145a0286e1770d62ab2ea8d1c57189f8 Mon Sep 17 00:00:00 2001 From: Tullio Sebastiani Date: Thu, 9 May 2024 18:32:47 +0200 Subject: [PATCH] Readme.md --- README.md | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- app.py | 2 +- 2 files changed, 57 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e97bcdc..9aa5dbc 100644 --- a/README.md +++ b/README.md @@ -1 +1,56 @@ -# krkn-service-hijacking +# Service Hijacking Mock Webservice + +This is the mock webservice used in the [Krkn](https://github.com/krkn-chaos/krkn) Service Hijacking +scenario. +This webservice, based on [Flask](https://flask.palletsprojects.com/en/3.0.x/) dinamycally loads a time-based test plan +with the following syntax: + +```yaml +- resource: /list/index.php + steps: + GET: + - duration: 15 + status: 500 + mime_type: application/json + payload: | + { + "status":"internal server error" + } + - duration: 15 + status: 201 + mime_type: application/json + payload: | + { + "status":"resource created" + } + POST: + - duration: 15 + status: 401 + mime_type: application/json + payload: | + { + "status": "unauthorized" + } + - duration: 15 + status: 404 + mime_type: text/plain + payload: not found +- resource: /patch + steps: + PATCH: + - duration: 15 + status: 201 + mime_type: text/plain + payload: resource patched + - duration: 15 + status: 400 + mime_type: text/plain + payload: bad request + +``` + +the webservice loads two environment variables: +- `TEST_PLAN_PATH`: (mandatory) is the path in the filesystem where the test plan is located. Krkn mounts it to +the pod deployed using a `ConfigMap` +- `STATS_ROUTE`: (optional, default `/krkn-stats`) overrides the default route of resource that prints the chaos run statistics +in case of a conflict with the test plan diff --git a/app.py b/app.py index ea4deb6..528c0d2 100644 --- a/app.py +++ b/app.py @@ -21,7 +21,7 @@ stats_endpoint = ( os.environ.get("STATS_ROUTE") if os.environ.get("STATS_ROUTE") - else "/stats" + else "/krkn-stats" )