Scaling down long process running containers

Here’s an odd use case which I’m contemplating. We currently have a pool of VMs that do reporting runs that can take form a few seconds to a few hours. Scaling up is done by a script that watches the job queue for buildup. Scaling down is performed by the VM itself which checks with the master server after the completion of each report job to see if it’s still needed. This ensures that a busy VM is never destroyed.

How would we implement that in Rancher? I assume that the Rancher server has no idea as to whether a container is working or idle. Could we add a ‘scaledown hint’ in the api scale endpoint to indicate the preferred container to destroy? That way the container could ask for its own demise. Alternatively get Rancher to check an endpoint in each container to see if it’s busy or not before destruction. This type of functionality already exists in the healthcheck functionality.

This doesn’t exist in Rancher today. Rancher only knows which containers are healthy/unhealthy and wouldn’t be able to prioritize which order a service should be scaled down. Please feel free to create an enhancement request in Github.