Skip to content

Instantly share code, notes, and snippets.

@b0noI
Last active July 28, 2019 01:10
Show Gist options
  • Save b0noI/211bcb87fd90f7e9e778a1282a2eb903 to your computer and use it in GitHub Desktop.
Save b0noI/211bcb87fd90f7e9e778a1282a2eb903 to your computer and use it in GitHub Desktop.
resources:
- name: {{ env["name"] }}
type: compute.v1.instance
properties:
zone: {{ properties["zone"] }}
machineType: https://www.googleapis.com/compute/v1/projects/{{ env["project"] }}/zones/{{ properties["zone"] }}/machineTypes/{{ properties["machineType"] }}
disks:
- deviceName: boot
type: PERSISTENT
boot: true
autoDelete: true
initializeParams:
sourceImage: https://www.googleapis.com/compute/v1/projects/deeplearning-platform-release/global/images/family/{{ properties["imageFamily"] }}
networkInterfaces:
{% if properties["network"] %}
- network: {{ properties["network"] }}
{% else %}
- network: https://www.googleapis.com/compute/v1/projects/{{ env["project"] }}/global/networks/default
{% endif %}
accessConfigs:
- name: External NAT
type: ONE_TO_ONE_NAT
metadata:
items:
{% if properties["mail"] %}
- key: proxy-user-mail
value: {{ properties["mail"] }}
{% endif %}
- key: proxy-mode
value: {{ properties["proxy-mode"] }}
- key: install-nvidia-driver
value: "True"
{% if properties["gpu-type"] %}
guestAccelerators:
- acceleratorType: {{ properties["gpu-type"] }}
acceleratorCount: {{ properties["gpu-count"] }}
scheduling:
onHostMaintenance: "TERMINATE"
{% endif %}
serviceAccounts:
{% if properties["service-account"] %}
- email: {{ properties["service-account"] }}
scopes:
- https://www.googleapis.com/auth/cloud-platform
- https://www.googleapis.com/auth/userinfo.email
{% else %}
- email: {{ env["project_number"] }}[email protected]
scopes:
- https://www.googleapis.com/auth/cloud-platform
- https://www.googleapis.com/auth/userinfo.email
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment