caas-team / py-kube-downscaler

Scale down / "pause" Kubernetes workload (Deployments, StatefulSets, and/or HorizontalPodAutoscalers and CronJobs too !) during non-work hours.
GNU General Public License v3.0
36 stars 14 forks source link

New Argument: Upscale Target Only #81

Closed samuel-esp closed 3 months ago

samuel-esp commented 3 months ago

Motivation

The --upscale-target-only is an advanced argument designed to ensure that only those namespaces currently targeted by the downscaler will be upscaled during "wake up" times.

Consider a scenario where the downscaler is initially configured to manage namespaces A, B, and C. If the configuration is later updated to target only namespaces B and C, this parameter will ensure that namespace A, which is not in the new target, remains downscaled. Without this parameter, namespace A could will be upscaled following the original behavior of the tool

This behavior is useful in cases where precise control over upscaling is required. It will let the user choose the original behavior or the new behavior introduced with pull requests #80

TLDR:

Default Behavior: If the --upscale-target-only parameter is not used, the original behavior remains unchanged, and all previously downscaled namespaces could be upscaled during wake-up times even if they are not in target anymore. With the Parameter: When the --upscale-target-only parameter is enabled, only the namespaces that are currently targeted by the downscaler will be upscaled. Any namespace not in the target will remain downscaled.

Changes

Introduced the new argument --upscale-target-only. Refactored the following classes

refactored tests to include tests introduced with pull request #80 and old tests at the same time.

Tests done

unit tests

TODO