Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(experiments): Add pod memory hog experiment #31

Merged
merged 1 commit into from
Jul 1, 2020
Merged

feat(experiments): Add pod memory hog experiment #31

merged 1 commit into from
Jul 1, 2020

Conversation

uditgaurav
Copy link
Member

Signed-off-by: Udit Gaurav udit.gaurav@mayadata.io

This PR contains:

  • Adding one more resource chaos experiment in the generic experiment of LitmusChaos. The experiment is pod-memory-hog which is used to give a memory spike on a container inside a pod for a certain chaos duration.
  • The experiment uses dd command to give a chaos spike.
  • After the total chaos duration, the command terminates using kill command inside the container.

Issue:
fixes: litmuschaos/litmus#1559

Special notes for your reviewer:

Signed-off-by: Udit Gaurav <uditgaurav@gmail.com>
@@ -12,25 +12,26 @@ import (
//GetENV fetches all the env variables from the runner pod
func GetENV(experimentDetails *types.ExperimentDetails, expName string) {
experimentDetails.ExperimentName = expName
Copy link
Member

@ksatchit ksatchit Jul 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either segregate by pkg/environment/common.go, pod-cpu-hog.go, pod-memory-hog.go etc., OR within environment.go add comments for: //common, //%Exp% etc.,

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#33

@@ -32,7 +32,8 @@ type ExperimentDetails struct {
ChaosPodName string
Iterations int
LIBImage string
CPUcores int
CPUcores int
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we categorize here too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#33

@uditgaurav
Copy link
Member Author

Tested abort feature of pod-memory-hog

  • The abort feature is working perfectly fine. I ran the experiment for 600 secs and deleted the experiment in between and observed that the dd command in the target container stops automatically.

Tested PODS_AFFECTED_PERC with 3 Nginx replicas:

  • The pod memory hog occurs sequentially with every replica of the application deployment each for certain chaos duration. Sequentially means one ends then other starts. Here is the logs of this part of the experiment:
time="2020-07-01T14:34:16Z" level=info msg="[Chaos]:Pods percentage to affect is 100"
time="2020-07-01T14:34:16Z" level=info msg="The running status of container to stress is as follows" Pod=nginx-7bb7cd8db5-cnfm4 Status=Running container=nginx
time="2020-07-01T14:34:16Z" level=info msg="[Chaos]:Stressing: 500 Megabytes"
time="2020-07-01T14:34:16Z" level=info msg="[Chaos]:Waiting for: 600s"
time="2020-07-01T14:34:16Z" level=info msg="The memory consumption is: 500"
time="2020-07-01T14:44:16Z" level=info msg="[Chaos]: Time is up for experiment: pod-memory-hog"
time="2020-07-01T14:44:16Z" level=info msg="The running status of container to stress is as follows" container=nginx Pod=nginx-7bb7cd8db5-n6p76 Status=Running
time="2020-07-01T14:44:16Z" level=info msg="[Chaos]:Stressing: 500 Megabytes"
time="2020-07-01T14:44:16Z" level=info msg="[Chaos]:Waiting for: 600s"
time="2020-07-01T14:44:16Z" level=info msg="The memory consumption is: 500"
time="2020-07-01T14:54:16Z" level=info msg="[Chaos]: Time is up for experiment: pod-memory-hog"
time="2020-07-01T14:54:16Z" level=info msg="The running status of container to stress is as follows" Pod=nginx-7bb7cd8db5-srwsj Status=Running container=nginx
time="2020-07-01T14:54:16Z" level=info msg="[Chaos]:Stressing: 500 Megabytes"
time="2020-07-01T14:54:16Z" level=info msg="[Chaos]:Waiting for: 600s"
time="2020-07-01T14:54:16Z" level=info msg="The memory consumption is: 500"
time="2020-07-01T15:04:16Z" level=info msg="[Chaos]: Time is up for experiment: pod-memory-hog"

@ksatchit ksatchit merged commit c8271b9 into litmuschaos:master Jul 1, 2020
ksatchit pushed a commit that referenced this pull request Jul 6, 2020
* refactor(experiments): Refactor litmus go experiments (#29)

Signed-off-by: Udit Gaurav <uditgaurav@gmail.com>

* feat(experiments): Add pod memory hog experiment (#31)

Signed-off-by: Udit Gaurav <uditgaurav@gmail.com>

* refactor(go-experiments): separate the types.go file for each experiment (#34)

Signed-off-by: shubhamchaudhary <shubham.chaudhary@mayadata.io>

* update(contribution-guide): updating contribution guide according to new schema changes (#35)

Signed-off-by: shubhamchaudhary <shubham.chaudhary@mayadata.io>

* chore(experiment): Add pod network duplication experiment in generic experiments of LitmusChaos (#27)

* chore(experiment): Add pod network duplication experiment in generic experiments of LitmusChaos

Signed-off-by: Udit Gaurav <uditgaurav@gmail.com>

* bug(fix): Add for summary event and getting target container name (#37)

Signed-off-by: Udit Gaurav <uditgaurav@gmail.com>

* bug(fix): Remove extra index from the list in pod duplication experiment (#38)

Signed-off-by: Udit Gaurav <uditgaurav@gmail.com>

Co-authored-by: Shubham Chaudhary <shubham.chaudhary@mayadata.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create go-based chaoslib for pod-memory-hog experiment
2 participants