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

Implement CPU stressor #374

Merged
merged 9 commits into from
Nov 16, 2023
Merged

Implement CPU stressor #374

merged 9 commits into from
Nov 16, 2023

Conversation

pablochacin
Copy link
Collaborator

@pablochacin pablochacin commented Nov 14, 2023

Description

Implements a CPU stress disruptor

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works.
  • I have run linter locally (make lint) and all checks pass.
  • I have run tests locally (make test) and all tests pass.
  • I have run relevant integration test locally (make integration-xxx for affected packages)
  • I have run relevant e2e test locally (make e2e-xxx for disruptors, or cluster related changes)
  • Any dependent changes have been merged and published in downstream modules

Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
@pablochacin pablochacin changed the title Resource stressor CPU stressor Nov 14, 2023
@pablochacin pablochacin removed the request for review from roobre November 14, 2023 17:10
@pablochacin pablochacin marked this pull request as draft November 14, 2023 17:10
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
@pablochacin pablochacin force-pushed the resource-stressor branch 2 times, most recently from c231177 to 3868609 Compare November 15, 2023 10:35
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
@pablochacin pablochacin marked this pull request as ready for review November 15, 2023 11:12
@pablochacin pablochacin changed the title CPU stressor Implement CPU stressor Nov 15, 2023
cmd/agent/commands/stress.go Outdated Show resolved Hide resolved
cmd/agent/commands/stress.go Outdated Show resolved Hide resolved
cmd/agent/commands/stress.go Outdated Show resolved Hide resolved

ctx := context.TODO()

// start the container with the agent using a fake upstream address because the agent requires it
Copy link
Collaborator

Choose a reason for hiding this comment

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

This might be a copy-paste artifact, right? (At least I don't see any address)

pkg/agent/integration_test.go Outdated Show resolved Hide resolved
pkg/agent/integration_test.go Outdated Show resolved Hide resolved
return err
}

return s.Apply(cmd.Context(), d, duration)
Copy link
Collaborator

Choose a reason for hiding this comment

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

In other commands, we use the agent to apply the disruption rather than calling the disruptor directly. Is there a reason to not it like that for this command?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch. It should follow the same pattern as other commands. I forgot to change this part from the initial PoC implementation.

Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Copy link
Collaborator

@roobre roobre left a comment

Choose a reason for hiding this comment

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

Looking great, awesome work!

@pablochacin pablochacin merged commit 00b8fbe into main Nov 16, 2023
8 checks passed
@pablochacin pablochacin deleted the resource-stressor branch November 16, 2023 12:27
@fslev
Copy link

fslev commented Feb 14, 2024

Hi,
Any documentation or hints on how to apply the CPU stressor for a specific Kubernetes pod / container ?

@pablochacin
Copy link
Collaborator Author

Hi @fslev This experiemntal feature is still not released in the API. We hope to make this available soon.

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.

None yet

3 participants