Add docker-autoscaler.
What does this MR do?
This introduces the docker-autoscaler
executor, which like the instance
executor, is backed by the new taskscaler autoscaler.
Why was this MR needed?
To start our journey of replacing the docker-machine
executor.
What's the best way to test this MR?
This is mostly being added so that we can iterate on its development. It's pre-alpha state.
To test using the AWS plugin though:
-
Download and install the latest
fleeting-plugin-aws
: https://gitlab.com/gitlab-org/fleeting/fleeting-plugin-aws/-/releases ensuring it can be found within$PATH
. -
You'll need an AMI that includes
docker
. Some community AMIs have this, but some are paid for or have other odd restrictions. I found it easier to create one with Packer:amazonlinux2-docker.pkr.hcl
packer { required_plugins { amazon = { version = ">= 1.0.9" source = "github.com/hashicorp/amazon" } } } source "amazon-ebs" "docker" { ami_name = "docker" ami_virtualization_type = "hvm" ssh_username = "ec2-user" ssh_timeout = "2h" region = "us-west-2" ebs_optimized = true instance_type = "t3.xlarge" source_ami_filter { filters = { virtualization-type = "hvm" architecture = "x86_64" name = "*amzn2-ami-hvm-*" root-device-type = "ebs" } most_recent = true owners = ["amazon"] } } build { sources = [ "sources.amazon-ebs.docker" ] provisioner "shell" { inline = [ "sudo amazon-linux-extras install docker", "sudo service docker start", "sudo usermod -a -G docker ec2-user", "sudo chkconfig docker on", ] } }
packer build amazonlinux2-docker.pkr.hcl
-
Create a new ASG, with an image template that uses the newly created AMI.
-
Use something like this Runner
config.toml
:concurrent = 4 [[runners]] name = "docker autoscaler test" url = "https://gitlab.com" token = "<runner token>" executor = "docker-autoscaler" [runners.docker] image = "busybox:latest" [runners.autoscaler] capacity_per_instance = 1 max_use_count = 100 max_instances = 5 plugin = "fleeting-plugin-aws" [runners.autoscaler.plugin_config] name = "<name of the ASG>" [runners.autoscaler.connector_config] username = "ec2-user" timeout = "5m0s" use_external_addr = true [[runners.autoscaler.policy]] idle_count = 4 idle_time = "10m0s"