Adaptive Kubejobs is a plugin for [Asperathos](https://github.com/ufcg-lsd/asperathos) to control cluster scaling based on its current resource utilisation.
## How does it work?
When a job is running, the controller will observe the total cluster utilisation and, if the current utilisation has surpassed the maximum defined by the user, it will decrease job replicas until the utilisation returns to an acceptable value. While the cluster utilisation is lower than the maximum, the controller will use the schedule strategy defined by the job submission.
Also, if a new job is submitted with a different "max_ram" or "max_cpu", the controller will use the minimum between the new value and the one being considered at the time. This way, the thresholds defined for both jobs end up being respected at some level.
## Installing Adaptive Kubejobs
Send a ```POST``` request to `<your_asperathos_url:port>/plugins` with the following JSON as body:
When submitting a new job, set the `control_plugin` parameter in your json submission file to `"adaptive_kubejobs"`. Besides that, you should configure the maximum resource utilization you want your cluster to reach when executing your job. In order to do that, add the `max_cpu` and `max_ram` parameters inside the `control_parameters` block.
Your json submission file should have these entries like the example bellow: