From 400c9d4ada003097f2e01206d60b638be93dbdc1 Mon Sep 17 00:00:00 2001 From: chrisurwin Date: Wed, 23 Aug 2017 17:21:15 +0100 Subject: [PATCH] Added autospotting catalog entry (#601) --- templates/autospotting/0/README.md | 11 ++++ templates/autospotting/0/docker-compose.yml | 13 +++++ templates/autospotting/0/rancher-compose.yml | 51 +++++++++++++++++++ .../autospotting/catalogIcon-autospotting.svg | 1 + templates/autospotting/config.yml | 5 ++ 5 files changed, 81 insertions(+) create mode 100644 templates/autospotting/0/README.md create mode 100644 templates/autospotting/0/docker-compose.yml create mode 100644 templates/autospotting/0/rancher-compose.yml create mode 100644 templates/autospotting/catalogIcon-autospotting.svg create mode 100644 templates/autospotting/config.yml diff --git a/templates/autospotting/0/README.md b/templates/autospotting/0/README.md new file mode 100644 index 0000000..1a25458 --- /dev/null +++ b/templates/autospotting/0/README.md @@ -0,0 +1,11 @@ +# Autospotting + +### Info +This service builds upon the open source autospotting at [https://github.com/cristim/autospotting](https://github.com/cristim/autospotting) + +This has been turned into a Rancher catalog entry with a couple of minor tweaks and the removal of the requirement to run it as a lambda function, it now runs as a docker container. + +Autospotting works by taking a tag that you specify and adding it to an AWS Auto-Scaling Group with a value of true. + +The container will then run and check for on-demand instances and replace them with cheap spot instances. This is a gradual process and will only replace one host in an ASG at a time. + diff --git a/templates/autospotting/0/docker-compose.yml b/templates/autospotting/0/docker-compose.yml new file mode 100644 index 0000000..19568f4 --- /dev/null +++ b/templates/autospotting/0/docker-compose.yml @@ -0,0 +1,13 @@ +aws-spot-instance-helper: + image: chrisurwin/autospotting:v0.1.0 + tty: true + labels: + io.rancher.container.pull_image: always + environment: + AWS_ACCESS_KEY_ID: "${AWS_ACCESS_KEY_ID}" + AWS_SECRET_ACCESS_KEY: "${AWS_SECRET_ACCESS_KEY}" + regions: "${regions}" + min_on_demand_number: "${min_on_demand_number}" + min_on_demand_percentage: "${min_on_demand_percentage}" + allowed_instance_types: "${allowed_instance_types}" + tag_name: "${tag_name}" \ No newline at end of file diff --git a/templates/autospotting/0/rancher-compose.yml b/templates/autospotting/0/rancher-compose.yml new file mode 100644 index 0000000..a9a45ea --- /dev/null +++ b/templates/autospotting/0/rancher-compose.yml @@ -0,0 +1,51 @@ +.catalog: + name: "Autospotting" + version: "v0.1.0" + description: "Autospotting" + minimum_rancher_version: v1.0.0 + questions: + - variable: "AWS_ACCESS_KEY_ID" + description: "AWS Access Key" + label: "AWS Access Key" + required: true + type: "string" + - variable: "AWS_SECRET_ACCESS_KEY" + description: "AWS Secret Key" + label: "Access Secret" + required: true + type: "string" + - variable: "regions" + description: "Regions where it should be activated (comma or whitespace separated list, also supports globs), by default it runs on all regions. Example: 'eu-*,us-east-1" + label: "AWS Regions" + required: false + type: "string" + - variable: "min_on_demand_number" + description: "On-demand capacity (as absolute number) ensured to be running in each of your groups" + label: "Minimum on demand number" + required: false + type: "string" + - variable: "min_on_demand_percentage" + description: "On-demand capacity (percentage of the total number of instances in the group) ensured to be running in each of your groups. Defaults to 0" + label: "Minimum on demand percentage" + required: false + type: "string" + - variable: "allowed_instance_types" + description: "If specified, the spot instances will have a specific instance type" + label: "Allowed instance types" + required: false + type: "string" + - variable: "tag_name" + description: "If specified you can tag instances with a specific tag to process, default is spot-enabled" + label: "Tag name" + required: false + type: "string" + +aws-spot-instance-helper: + health_check: + port: 9777 + interval: 2000 + unhealthy_threshold: 3 + strategy: recreate + response_timeout: 2000 + request_line: GET /ping HTTP/1.0 + healthy_threshold: 2 \ No newline at end of file diff --git a/templates/autospotting/catalogIcon-autospotting.svg b/templates/autospotting/catalogIcon-autospotting.svg new file mode 100644 index 0000000..b88cdbb --- /dev/null +++ b/templates/autospotting/catalogIcon-autospotting.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/templates/autospotting/config.yml b/templates/autospotting/config.yml new file mode 100644 index 0000000..ed1ae21 --- /dev/null +++ b/templates/autospotting/config.yml @@ -0,0 +1,5 @@ +name: AutoSpotting +description: | + Replaces AWS On-Demand instances with cheaper Spot-Instances where possible +version: v0.1.0 +category: Infrastructure Services \ No newline at end of file