praiskup / resalloc

Allocator and manager for (expensive) resources
GNU General Public License v2.0
7 stars 7 forks source link

Resource Allocator

This project aims to help with taking care of (rather expensive) resources, for example several ephemeral virtual machines for the purposes of your CI.

Overview

Server side allows you to:

The client side let's your users:

Such allocation of resource might be time consuming, so to not let your users wait too much -- the server side is able to pre-allocate several instances in advance. For more info, have a look at ./config/pools.yaml configuration example.

What do you mean by resources?

Resalloc's concept of resources is intentionally vague and general. Whatever your allocation scripts spawn and return to resalloc, those are your resources. It can be virtual machines, docker containers, IP addresses, disk volumes, or in an extreme case even people (imagine a ticket system at the post office).

There already are allocation scripts for various kinds of resources:

If you can, please share your own.

Motivation

At the first sight, it may look like resource allocation is a simple task and using something like resalloc is an overkill. But please consider what resalloc can do for you and what you would eventually need to implement on your own when starting from scratch.

Resalloc was created to accommodate the ever growing farm of Copr builders.

Typical client use-cases

  1. Ask for a resource, and wait till it is ready
$ ticket=$(resalloc ticket --tag x86_64 --tag jenkins_vm)
$ output=$(resalloc ticket-wait $ticket)
  1. get the resource, and periodically check till it is available
$ ticket=$(resalloc ticket --tag x86_64 --tag jenkins_vm)
$ while ! resalloc ticket-check $ticket; do true; done
$ output=$(resalloc ticket-check $ticket)

Then, you can work with the resource:

$ ip=$output
$ ssh root@"$ip" -c "do something"
$ resalloc ticket-close "$ticket"

The $output variable will contain important info from the cmd_new command run by resalloc server. If you request VMs, you typically want cmd_new command which outputs an IP of the allocated virtual machine.

Installation

The released versions are installable from Fedora and Fedora EPEL repositories, just do

$ sudo dnf install -y resalloc        # clients
$ sudo dnf install -y resalloc-server # server

Pre-release RPMs are available in testing Copr repositories: https://copr.fedorainfracloud.org/coprs/praiskup/resalloc/