Skip to content

Commit ab5ba6e

Browse files
p2004aravwojdyla
authored andcommitted
Delete VM when preempted
Adds `--instance-termination-action=DELETE` to delete instance when preempted. Without this, when preemptible VM is interrupted it leaves the instance in shutdown state with disk still incurring cost. To use that flag I also had to switch to spot VM provisioning, which costs the same, have the same base behavior and a few more features. Spot VMs unlike preemptible ones do not have a maximum runtime length, so I've picked 3d max runtime as that's already used in the script as "max workflow runtime".
1 parent 1a818ac commit ab5ba6e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

action.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ function start_vm {
192192
image_family_flag=$([[ -z "${image_family}" ]] || echo "--image-family=${image_family}")
193193
disk_size_flag=$([[ -z "${disk_size}" ]] || echo "--boot-disk-size=${disk_size}")
194194
boot_disk_type_flag=$([[ -z "${boot_disk_type}" ]] || echo "--boot-disk-type=${boot_disk_type}")
195-
preemptible_flag=$([[ "${preemptible}" == "true" ]] && echo "--preemptible" || echo "")
195+
preemptible_flag=$([[ "${preemptible}" == "true" ]] && echo "--provisioning-model=SPOT --instance-termination-action=DELETE --max-run-duration=3d" || echo "")
196196
ephemeral_flag=$([[ "${ephemeral}" == "true" ]] && echo "--ephemeral" || echo "")
197197
no_external_address_flag=$([[ "${no_external_address}" == "true" ]] && echo "--no-address" || echo "")
198198
network_flag=$([[ ! -z "${network}" ]] && echo "--network=${network}" || echo "")

0 commit comments

Comments
 (0)