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

Commit

Permalink
Add preemptible feature (#21)
Browse files Browse the repository at this point in the history
* Adding preemptible parameter

* Update README.md

Adds preemptible description
  • Loading branch information
nbttmbrg authored Aug 24, 2021
1 parent ca62d94 commit 909795a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ platforms:
- name: ubuntu-instance-created-by-molecule # REQUIRED: this will be your VM name
zone: us-central1-a # Example: us-west1-b. Will default to zone b of region defined in driver (some regions do not have a zone-a)
machine_type: n1-standard-1 # If not specified, will default to n1-standard-1
preemptible: false # If not specified, will default to false. Preemptible instances have no SLA, in case of resource shortage in the zone they might get destroyed (or not be created) without warning, and will always be terminated after 24 hours. But they cost less and will mitigate the financial consequences of a PAYG licenced VM that would be forgotten.
image: 'projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts' # Points to an image, you can get a list of available images with command 'gcloud compute images list'.
# The expected format of this string is projects/<project>/global/images/family/<family-name>
# (see https://googlecloudplatform.github.io/compute-image-tools/daisy-automating-image-creation.html)
Expand Down
1 change: 1 addition & 0 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ driver:
platforms:
- name: instance # REQUIRED is an instance name
machine_type: null # If not specified, will default to n1-standard-1
preemptible: false # Preemptible VMs are cheaper but not guaranteed to live long (or at all), and will terminate after 24hours.
zone: null # example: us-west1-b, will default to zone b of driver.region
disk_size_gb: null # Set only if needed
image: 'projects/debian-cloud/global/images/family/debian-10' # Points to an image, you can get a list of available images with command 'gcloud compute images list'.
Expand Down
2 changes: 2 additions & 0 deletions src/molecule_gce/playbooks/tasks/create_linux_instance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
machine_type: "{{ item.machine_type | default('n1-standard-1') }}"
metadata:
ssh-keys: "{{ lookup('env','USER') }}:{{ keypair.public_key }}}"
scheduling:
preemptible: "{{ item.preemptible | default(false) }}"
disks:
- auto_delete: true
boot: true
Expand Down
2 changes: 2 additions & 0 deletions src/molecule_gce/playbooks/tasks/create_windows_instance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
state: present
name: "{{ item.name }}"
machine_type: "{{ item.machine_type | default('n1-standard-1') }}"
scheduling:
preemptible: "{{ item.preemptible | default(false) }}"
disks:
- auto_delete: true
boot: true
Expand Down

0 comments on commit 909795a

Please sign in to comment.