Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Determine the current "on demand" price and use as spot price (maximum) #391

Merged
merged 8 commits into from
Oct 19, 2021

Conversation

kayman-mk
Copy link
Collaborator

@kayman-mk kayman-mk commented Oct 14, 2021

Description

With this PR it is possible to run spot instances without specifying the spot price. If the spot price is set to "on-demand-price", the instance are requested for a price up to the current on demand price. The AWS cloud ensures that not more than the on demand price is billed.

You can still specify the price manually if needed, e. g. "0.06" for $0.06/hour.

module "gitlab_runner" {
  runner_instance_spot_price = "on-demand-price"
  docker_machine_spot_price_bid = "on-demand-price" # which is also the default value now
}

The default behavior for docker_machine_spot_price_bid is changed from $0.06/hour to the current on demand price for the instance type chosen. So if there are no strong reasons to specify a lower price, simply stay with the default and remove the assignment of this variable.

A new value is introduced for runner_instance_spot_price. Select "on-demand-price" to create a spot instance and you will not pay more than the current on demand price for that instance type. You do not have to look up this value and/or change it later in case the price changes.

Closes #222

Migrations required

In case you selected the spot price manually, replace the manual value with "on-demand-price". But if you had a good reason for selecting a lower value, you can simply stay with it.

Verification

Manual verification done in our development environment by deploying the module using different combinations for the spot price. I checked the spot price requests in the AWS Console to show the price entered in the Terraform script. In case "on-demand-price" was selected, AWS automatically selected the current on demand price for the instance type chosen.

I also verified that the instances were able to process jobs.

Documentation

We use pre-commit to update the Terraform inputs and outputs in the documentation via terraform-docs. Ensure you have installed those components.

@kayman-mk kayman-mk marked this pull request as ready for review October 16, 2021 08:05
Copy link
Collaborator

@npalm npalm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kayman-mk thanks!

@npalm npalm merged commit 9ef04b1 into cattle-ops:develop Oct 19, 2021
semantic-releaser bot pushed a commit that referenced this pull request Oct 19, 2021
## [4.35.0](4.34.0...4.35.0) (2021-10-19)

### Features

* run spot instances without specifying the spot price ([#391](#391)) ([9ef04b1](9ef04b1))

### Bug Fixes

* Ensure the existence of overrides["name_iam_objects"] before accessing ([c9c4c44](c9c4c44))
@semantic-releaser
Copy link
Contributor

🎉 This PR is included in version 4.35.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@kayman-mk kayman-mk deleted the kayma/spotprice branch October 20, 2021 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add option to request spot-instance with on-demand price
2 participants