jenkinsci / docker-swarm-plugin

Jenkins plugin which allows to add a Docker Swarm as a cloud agent provider
https://plugins.jenkins.io/docker-swarm/
MIT License
55 stars 47 forks source link

Limit number of container instances for each agent template #116

Open davidtlascelles opened 2 years ago

davidtlascelles commented 2 years ago

Feature Request

As requested in #16 , I also would like to limit the number of containers similar to the Docker plugin.

My use case involves needing to limit the number of jobs running based on non-RAM or CPU resource constrains. For example:

There are 4 test platforms total. Two platforms are configured to support "A" labeled jobs, and have a docker image that is compatible with this "A" configuration. One is configured to support "B" labeled jobs, and the last is configured to support "C" labeled jobs, with "B" and "C" compatible images.

With the Docker plugin, I can create three Docker agent templates for each type of job (A, B, and C) with appropriate images, limit the instance capacity for each template according to the number of each resource exists (2 of A, 1 of B, and 1 of C), allowing jobs to be executed as resources become available.

I'm struggling to scale with the Docker plugin, as the number of test platforms and servers involved are growing. It would be much more elegant to have all docker hosting servers pooled into a swarm, and agent template instance capacities would apply to the swarm rather than each server.