enable using ephemeral disks by default (#461)

This commit is contained in:
bmc-msft
2021-03-30 18:48:44 -04:00
committed by GitHub
parent 3eb7c8643b
commit 3096f99e86
8 changed files with 31 additions and 1 deletions

View File

@ -75,6 +75,7 @@ def scale_up(pool: Pool, scalesets: List[Scaleset], nodes_needed: int) -> None:
region=autoscale_config.region,
size=max_nodes_scaleset,
spot_instances=autoscale_config.spot_instances,
ephemeral_os_disks=autoscale_config.ephemeral_os_disks,
tags={"pool": pool.name},
)
nodes_needed -= max_nodes_scaleset

View File

@ -208,6 +208,7 @@ def create_vmss(
image: str,
network_id: str,
spot_instances: bool,
ephemeral_os_disks: bool,
extensions: List[Any],
password: str,
ssh_public_key: str,
@ -259,7 +260,9 @@ def create_vmss(
},
"virtual_machine_profile": {
"priority": "Regular",
"storage_profile": {"image_reference": image_ref},
"storage_profile": {
"image_reference": image_ref,
},
"os_profile": {
"computer_name_prefix": "node",
"admin_username": "onefuzz",
@ -300,6 +303,13 @@ def create_vmss(
},
}
if ephemeral_os_disks:
params["virtual_machine_profile"]["storage_profile"]["os_disk"] = {
"diffDiskSettings": {"option": "Local"},
"caching": "ReadOnly",
"createOption": "FromImage",
}
if spot_instances:
# Setting max price to -1 means it won't be evicted because of
# price.

View File

@ -82,6 +82,7 @@ class Scaleset(BASE_SCALESET, ORMMixin):
region: Region,
size: int,
spot_instances: bool,
ephemeral_os_disks: bool,
tags: Dict[str, str],
client_id: Optional[UUID] = None,
client_object_id: Optional[UUID] = None,
@ -93,6 +94,7 @@ class Scaleset(BASE_SCALESET, ORMMixin):
region=region,
size=size,
spot_instances=spot_instances,
ephemeral_os_disks=ephemeral_os_disks,
auth=build_auth(),
client_id=client_id,
client_object_id=client_object_id,
@ -237,6 +239,7 @@ class Scaleset(BASE_SCALESET, ORMMixin):
self.image,
network_id,
self.spot_instances,
self.ephemeral_os_disks,
extensions,
self.auth.password,
self.auth.public_key,