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

Feature Request: Add new annotation to allow overriding the downscaling grace period at the deployment level #72

Closed
michohl opened this issue Jul 19, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@michohl
Copy link

michohl commented Jul 19, 2024

Issue

I would like to be able to force a single deployment to have it's own grace period instead of using the command line options.

Problem to solve

I am creating an integration test for a deployment of py-kube-downscaler but when I create a deployment and set it to scale in a small window (to keep test time reasonable) I get the following log messages:

2024-07-19 18:09:30,688 DEBUG: https://192.168.0.1:443 "GET /api/v1/namespaces/addon-test HTTP/11" 200 None
2024-07-19 18:09:30,689 DEBUG: Deployment addon-test/test-downscaler-deployment has 3 replicas (original: None, uptime: ignored)
2024-07-19 18:09:30,689 INFO: Deployment addon-test/test-downscaler-deployment within grace period (900s), not scaling down (yet)

I would prefer my test to take < 5 minutes rather than 15+ minutes to run so I would like to be able to make it so this single test deployment scales down immediately regardless of the grace period.

Further details

Proposal

First add a new annotation called downscaler/grace-period to this list:

ORIGINAL_REPLICAS_ANNOTATION = "downscaler/original-replicas"
FORCE_UPTIME_ANNOTATION = "downscaler/force-uptime"
FORCE_DOWNTIME_ANNOTATION = "downscaler/force-downtime"
UPSCALE_PERIOD_ANNOTATION = "downscaler/upscale-period"
DOWNSCALE_PERIOD_ANNOTATION = "downscaler/downscale-period"
EXCLUDE_ANNOTATION = "downscaler/exclude"
EXCLUDE_UNTIL_ANNOTATION = "downscaler/exclude-until"
UPTIME_ANNOTATION = "downscaler/uptime"
DOWNTIME_ANNOTATION = "downscaler/downtime"
DOWNTIME_REPLICAS_ANNOTATION = "downscaler/downtime-replicas"

Then update the within_grace_period function to check for this new annotation and prefer it over command line argument or ENV variable used to start the controller:

def within_grace_period(

Who can address the issue

Other links/references

@samuel-esp
Copy link
Collaborator

Hi @michohl,

Pull request is ready! #74

@michohl
Copy link
Author

michohl commented Jul 20, 2024

Wow, that's a quick turnaround time! Thanks for taking this on. Much appreciated :)

@samuel-esp
Copy link
Collaborator

you're welcome!

@samuel-esp
Copy link
Collaborator

The pull request was merged, issue can be closed

@Fovty Fovty closed this as completed Jul 22, 2024
@JTaeuber JTaeuber added the enhancement New feature or request label Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants