X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/3aaefcb3c76ff470b475d950398d01255e87712a..fb553cae8d2132a17bc31d06d7b5f95aeebff78a:/lib/cloud/azure/azure.go?ds=sidebyside diff --git a/lib/cloud/azure/azure.go b/lib/cloud/azure/azure.go index 7f949d9bdb..1ff0798ea6 100644 --- a/lib/cloud/azure/azure.go +++ b/lib/cloud/azure/azure.go @@ -528,6 +528,17 @@ func (az *azureInstanceSet) Create( }, } + if instanceType.Preemptible { + // Setting maxPrice to -1 is the equivalent of paying spot price, up to the + // normal price. This means the node will not be pre-empted for price + // reasons. It may still be pre-empted for capacity reasons though. And + // Azure offers *no* SLA on spot instances. + var maxPrice float64 = -1 + vmParameters.VirtualMachineProperties.Priority = compute.Spot + vmParameters.VirtualMachineProperties.EvictionPolicy = compute.Delete + vmParameters.VirtualMachineProperties.BillingProfile = &compute.BillingProfile{MaxPrice: &maxPrice} + } + vm, err := az.vmClient.createOrUpdate(az.ctx, az.azconfig.ResourceGroup, name, vmParameters) if err != nil { // Do some cleanup. Otherwise, an unbounded number of new unused nics and