Skip to content
This repository was archived by the owner on Jan 9, 2023. It is now read-only.

Commit 85f97f9

Browse files
committed
Adds Spot Instance use in docs
1 parent ee18b82 commit 85f97f9

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

docs/user-guide.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,3 +674,35 @@ You add labels and taints in the tarmak yaml like this:
674674
**Note**, these are only applied when the node is first registered. Changes to
675675
these values will not remove taints and labels from nodes that are already
676676
registered.
677+
678+
Spot Instances
679+
~~~~~~~~~~~~~~
680+
Tarmak gives the ability to attempt to request spot instances for use in
681+
instance pools. Spot instances are very cheap, spare AWS instances that can be
682+
revoked by AWS at any time, given a 2 minute notification. `More information
683+
here <https://aws.amazon.com/ec2/spot/>`_.
684+
685+
Spot instances can be requested cluster-wide by giving the ``--spot-pricing``
686+
flag to ``cluster apply``. Tarmak will then attempt a best effort spot price for
687+
each instance pool in the cluster, calculated as the average spot price in the
688+
last 3 days for that instance type in each zone plus 25%.
689+
690+
Manual spot prices can be applied to each instance pool within the
691+
``tarmak.yaml`` which will override the Tarmak best effort for that instance
692+
pool. This is done through the ``spotPrice`` attribute under the instance pool,
693+
given as a number in USD. This can be added like so:
694+
695+
.. code-block:: yaml
696+
697+
- image: centos-puppet-agent
698+
maxCount: 3
699+
metadata:
700+
creationTimestamp: "2018-07-27T09:33:15Z"
701+
name: worker
702+
minCount: 3
703+
size: medium
704+
spotPrice: 0.015
705+
706+
707+
Note that Tarmak will only attempt to create spot instances for instance pools
708+
with the ``spotPrice`` attribute or spot pricing flag during a cluster apply.

pkg/tarmak/instance_pool/instance_pool.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ func (n *InstancePool) SpotPrice() string {
173173
}
174174

175175
func (n *InstancePool) CalculateSpotPrice() error {
176-
if n.spotPrice != "" {
176+
if n.spotPrice == "" {
177177
p, err := n.cluster.Environment().Provider().SpotPrice(n)
178178
if err != nil {
179179
return err

pkg/tarmak/provider/amazon/spot_price.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func (a *Amazon) SpotPrice(instancePool interfaces.InstancePool) (float64, error
6868
total /= float64(len(prices))
6969
}
7070

71-
total *= 1.10
71+
total *= 1.25
7272

7373
return total, result.ErrorOrNil()
7474
}

0 commit comments

Comments
 (0)