https://github.com/petergrace/descaler
cause kubernetes to stop autoscaling
https://github.com/petergrace/descaler
Last synced: about 1 year ago
JSON representation
cause kubernetes to stop autoscaling
- Host: GitHub
- URL: https://github.com/petergrace/descaler
- Owner: PeterGrace
- License: mit
- Created: 2021-03-17T13:23:44.000Z (over 5 years ago)
- Default Branch: trunk
- Last Pushed: 2021-04-02T17:14:59.000Z (about 5 years ago)
- Last Synced: 2025-02-15T02:44:43.508Z (over 1 year ago)
- Language: Rust
- Homepage:
- Size: 557 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# descaler
## What it is
descaler is a Kubernetes controller which, based on a signal that it pulls from a specific location, will signal to cluster-autoscaler, as well as any horizontal pod autoscalers, that downscaling is prohibited.
## How does it work
The descaler container takes an input configuration file, expected to be named `config.yaml`:
```
---
source_url: 'file:///home/pgrace/repos/rust/descaler/scaler.yaml'
check_interval: 10
enumerate_nodes_secs: 30
enumerate_scalers_secs: 30
```
### Config file
- Given a specified `source_url`, descaler will check that url every `check_interval` secs and consider the contents therein:
```
---
scalingEnabled: true
ignore: []
```
**NOTE**: ignore is currently not implemented, but is planned.
### Node Management
- Every `enumerate_nodes_secs` it will evaluate what the current status is of the nodes, based on the info gathered from `source_url`.
- if scalingEnabled is false
- if scaling is already disabled, the node is left alone
- if scaling was not previously disabled, it adds the scaling-disabled annotation as well as a marker that descaler set said annotation.
- if scalingEnabled is true
- if the node has the descaler annotation that says it previously disabled scaling, it will remove the scaling annotation,
- it will also clean up the previous annotation it left.
### Scaler Management
- Additionally, every `enumerate_scalers_secs`, descaler will enumerate all hpa objects on the cluster. Based on the status of scaling, it will:
- if scalingEnabled is false
- if scaler is an hpa object without an ownerRef, it will:
- annotate the hpa object with the "original" minreplicas value,
- set minReplicas to currentReplicas
- patch the HPA object.
- if scaler is an hpa that has a ownerRef of a KEDA ScaledObject, it will instead:
- annotate the ScaledObject with the origiinal minreplicas value,
- query the HPA object for its currentReplica number,
- amend the minReplicaCount for the ScaledObject to match the current replica count.
- if scalingEnabled is true
- it will revert the above settings, if they are found.