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

Adds ability to configure frequency for pod termination via annotation #353

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

multimac
Copy link

@multimac multimac commented Jul 1, 2021

Adds ability to configure frequency for pod termination via annotation.

Closes #20

Allows specifying a new command line flag, --termination-frequency-annotation which sets the annotation to look for and use to calculate the approximate frequency at which to terminate a given pod. Follows the examples given in #20, such as...

  • chaos.alpha.kubernetes.io/frequency=2/day for "kill this twice per day"
  • chaos.alpha.kubernetes.io/frequency=10/hour for "kill this ten times per hour"
  • chaos.alpha.kubernetes.io/frequency=1/week for "kill this once a week"
  • chaos.alpha.kubernetes.io/frequency=0.5/day for "kill this pod once every two days"

Pods without the annotation are assumed to always be candidates for termination. The --max-kill flag also still applies and will potentially limit how frequently a pod is terminated if it isn't high enough.

@multimac
Copy link
Author

multimac commented Jul 1, 2021

Just updated with the ability to set a default termination frequency, via the --default-termination-frequency flag.

This applies to pods which lack the annotation and helps avoid them from being terminated too frequently, since it's likely that people will decrease the interval at which Chaoskube runs when using the annotation.

@multimac
Copy link
Author

multimac commented Jul 2, 2021

This PR has ballooned slightly. I've added the ability to configure per-pod (via annotations):

  • minimum-age - Overrides the default minimum age
  • excluded-weekdays, excluded-times-of-day, and excluded-days-of-year - Global configuration still applies, but can exclude pods from being terminated on additional weekdays, etc.

All of these use annotations in the form chaos.alpha.kubernetes.io/[...]. I've also made a slight change, instead of termination-frequency-annotation the "annotation prefix" can be provided via --config-annotation-prefix, as multiple annotations can now be applied to configure different settings.

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.

Decouple individual pod termination frequency from cluster size
1 participant