autospotting

by joaquinito2051

Helm chartv0.2.1App 1.0.0

A chart to install autospotting.

About this chart

Autospotting Helm Chart

Chart Details

This chart will do the following:

  • Implement autospotting, a tool to automatically convert your existing autoscaling groups to cheaper spot instances with minimal config chanages. The source code for autospotting is available at AutoSpotting.

Container

This version of the autospotting container is built and maintained by ReactiveOps in reactiveops/autospotting-ci. The appVersion and the container tag correspond to tags on that repository.

Configuration

ParameterDescriptionDefault
imageuri to pull the image fromquay.io/reactiveops/autospotting:1.0.0
schedulecron schedule the job will run with*/5 * * * *
resources.cpucpu millicores to request30m
resources.memamount of physical mem to request30Mi
environmentMap of environment settings.See the table of default values below.

environment map default values:

ParameterDescriptionDefault
REGIONSComma separated string of regions where it should be activated. Set it to blank to run in all regions.us*
ALLOWED_INSTANCE_TYPESif specified, spot instances will be of these types. If blank, type is autodetected form each ASG based on it's launch configuration. Accepts a string of comma separated instance types e.g. 'c5.*,c4.xlarge'r4.*
DISALLOWED_INSTANCE_TYPESIf specified, the spot instances will never be of these types. Accepts a string of comma separated instance types (supports globs).
ON_DEMAND_PRICE_MULTIPLIERMultiplier for the on-demand price. This is useful for volume discounts or if you want to set your bid price to be higher than the on demand price to reduce the chances that your spot instances will be terminated.1
BIDDING_POLICYPolicy choice for spot bid. If set to 'normal', we bid at the on-demand price. If set to 'aggressive', we bid at a percentage value above the spot price configurable using the spot_price_buffer_percentage.normal
MIN_ON_DEMAND_NUMBEROn-demand capacity (as absolute number) ensured to be running in each of your groups. Can be overridden on a per-group basis using the tag autospotting_min_on_demand_number.0
MIN_ON_DEMAND_PERCENTAGEOn-demand capacity (percentage of the total number of instances in the group) ensured to be running in each of your groups. Can be overridden on a per-group basis using the tag autospotting_min_on_demand_percentage It is ignored if min_on_demand_number is also set.0
ON_DEMAND_PRICE_MULTIPLIERMultiplier for the on-demand price. This is useful for volume discounts or if you want to set your bid price to be higher than the on demand price to reduce the chances that your spot instances will be terminated.1
SPOT_PRICE_BUFFER_PERCENTAGEPercentage Value of the bid above the current spot price. A spot bid would be placed at a value current_spot_price * [1 + (spot_price_buffer_percentage/100.0)]. The main benefit is that it protects the group from running spot instances that got significantly more expensive than when they were initially launched, but still somewhat less than the on-demand price. Can be enforced using the tag: autospotting_spot_price_buffer_percentage. If the bid exceeds the on-demand price, we place a bid at on-demand price itself.10
SPOT_PRODUCT_DESCRIPTIONThe Spot Product or operating system to use when looking up spot price history in the market. Valid choices: Linux/UNIX, SUSE Linux, Windows, Linux/UNIX (Amazon VPC), SUSE Linux (Amazon VPC), Windows (Amazon VPC)Linux/UNIX (Amazon VPC)
TAG_FILTERSList of map tags to filter the ASGs on, formatted as a string.[{spot-enabled true}]
AWS_ACCESS_KEY_IDaws access key id
AWS_SECRET_ACCESS_KEYaws secret key
AWS_SESSION_TOKENaws token

Example Autohelm configuration

charts:
  autospotting:
    repository:
      git: https://github.com/reactiveops/autospotting-ci.git
    chart: chart
    namespace: default
    values:
      image: quay.io/reactiveops/autospotting:0.1.3
      environment:
        REGIONS: "*"
        ALLOWED_INSTANCE_TYPES: "*"

Deploy autospotting with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has autospotting on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartautospotting is pinned at v0.2.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply