Adding New Scenarios/Testing Changes
Refer to the 2 docs below to be able to test your own images with any changes and be able to contribute them to the repository
This is the multi-page printable view of this section. Click here to print.
You can use either podman-compose or docker-compose for this step
NOTE: Podman might not work on Mac’s
pip3 install docker-compose
OR
To get latest podman-compose features we need, use this installation command
pip3 install https://github.com/containers/podman-compose/archive/devel.tar.gz
Scenario Types:
Create folder with scenario name
Create generic scenario template with enviornment variables
a. See scenario.yaml for example
b. Almost all parameters should be set using a variable (these will be set in the env.sh file or through the command line environment variables)
Add defaults for any environment variables in an “env.sh” file
a. See env.sh for example
Create script to run.sh chaos scenario a. See run.sh for example
b. edit line 16 with your scenario yaml template
c. edit line 17 and 23 with your yaml config location
Create Dockerfile template
a. See dockerfile for example
b. Lines to edit
i. 15: replace "application-outages" with your folder name
ii. 17: replace "application-outages" with your folder name
iii. 19: replace "application-outages" with your folder name and config file name
Add service/scenario to docker-compose.yaml file following syntax of other services
Point the dockerfile parameter in your docker-compose to the Dockerfile file in your new folder
Update this doc and main README with new scenario type
Add CI test for new scenario
a. See test_application_outages.sh for example
b. Lines to change
i. 14 and 31: Give a new function name
ii. 19: Give it a meaningful container name
iii. Edit line 20 to give scenario type defined in docker-compose file
c. Add test name to all_tests file
NOTE:
Builds all images in docker-compose file
docker-compose build
Builds single image defined by service/scenario name
docker-compose build <scenario_type>
OR
Builds all images in podman-compose file
podman-compose build
Builds single image defined by service/scenario name
podman-compose build <scenario_type>
All Images
docker image push --all-tags quay.io/<username>/kraken-hub
Single image
docker image push quay.io/<username>/kraken-hub:<scenario_type>
OR
Single Image (have to go one by one to push images through podman)
podman image push quay.io/<username>/kraken-hub:<scenario_type>
docker run -d -v <kube_config_path>:/root/.kube/config:Z quay.io/<username>/kraken-hub:<scenario_type>
OR
podman run -d -v <kube_config_path>:/root/.kube/config:Z quay.io/<username>/kraken-hub:<scenario_type>
Once all you’re happy with your changes, follow the contribution guide on how to create your own branch and squash your commits
Contributions are always appreciated.
How to:
In order to submit a change or a PR, please fork the project and follow instructions:
$ git clone http://github.com/<me>/kraken-hub
$ cd kraken-hub
$ git checkout -b <branch_name>
$ <make change>
$ git add <changes>
$ git commit -a
$ <insert good message>
$ git push
If there are mutliple commits, please rebase/squash multiple commits before creating the PR by following:
$ git checkout <my-working-branch>
$ git rebase -i HEAD~<num_of_commits_to_merge>
-OR-
$ git rebase -i <commit_id_of_first_change_commit>
In the interactive rebase screen, set the first commit to pick
and all others to squash
(or whatever else you may need to do).
Push your rebased commits (you may need to force), then issue your PR.
$ git push origin <my-working-branch> --force