mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-17 04:18:07 +00:00
enable using ephemeral disks by default (#461)
This commit is contained in:
@ -800,6 +800,11 @@ Each event will be submitted via HTTP POST to the user provided URL.
|
|||||||
},
|
},
|
||||||
"AutoScaleConfig": {
|
"AutoScaleConfig": {
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"ephemeral_os_disks": {
|
||||||
|
"default": false,
|
||||||
|
"title": "Ephemeral Os Disks",
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"image": {
|
"image": {
|
||||||
"title": "Image",
|
"title": "Image",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
@ -3764,6 +3769,11 @@ Each event will be submitted via HTTP POST to the user provided URL.
|
|||||||
},
|
},
|
||||||
"AutoScaleConfig": {
|
"AutoScaleConfig": {
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"ephemeral_os_disks": {
|
||||||
|
"default": false,
|
||||||
|
"title": "Ephemeral Os Disks",
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"image": {
|
"image": {
|
||||||
"title": "Image",
|
"title": "Image",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
@ -75,6 +75,7 @@ def scale_up(pool: Pool, scalesets: List[Scaleset], nodes_needed: int) -> None:
|
|||||||
region=autoscale_config.region,
|
region=autoscale_config.region,
|
||||||
size=max_nodes_scaleset,
|
size=max_nodes_scaleset,
|
||||||
spot_instances=autoscale_config.spot_instances,
|
spot_instances=autoscale_config.spot_instances,
|
||||||
|
ephemeral_os_disks=autoscale_config.ephemeral_os_disks,
|
||||||
tags={"pool": pool.name},
|
tags={"pool": pool.name},
|
||||||
)
|
)
|
||||||
nodes_needed -= max_nodes_scaleset
|
nodes_needed -= max_nodes_scaleset
|
||||||
|
@ -208,6 +208,7 @@ def create_vmss(
|
|||||||
image: str,
|
image: str,
|
||||||
network_id: str,
|
network_id: str,
|
||||||
spot_instances: bool,
|
spot_instances: bool,
|
||||||
|
ephemeral_os_disks: bool,
|
||||||
extensions: List[Any],
|
extensions: List[Any],
|
||||||
password: str,
|
password: str,
|
||||||
ssh_public_key: str,
|
ssh_public_key: str,
|
||||||
@ -259,7 +260,9 @@ def create_vmss(
|
|||||||
},
|
},
|
||||||
"virtual_machine_profile": {
|
"virtual_machine_profile": {
|
||||||
"priority": "Regular",
|
"priority": "Regular",
|
||||||
"storage_profile": {"image_reference": image_ref},
|
"storage_profile": {
|
||||||
|
"image_reference": image_ref,
|
||||||
|
},
|
||||||
"os_profile": {
|
"os_profile": {
|
||||||
"computer_name_prefix": "node",
|
"computer_name_prefix": "node",
|
||||||
"admin_username": "onefuzz",
|
"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:
|
if spot_instances:
|
||||||
# Setting max price to -1 means it won't be evicted because of
|
# Setting max price to -1 means it won't be evicted because of
|
||||||
# price.
|
# price.
|
||||||
|
@ -82,6 +82,7 @@ class Scaleset(BASE_SCALESET, ORMMixin):
|
|||||||
region: Region,
|
region: Region,
|
||||||
size: int,
|
size: int,
|
||||||
spot_instances: bool,
|
spot_instances: bool,
|
||||||
|
ephemeral_os_disks: bool,
|
||||||
tags: Dict[str, str],
|
tags: Dict[str, str],
|
||||||
client_id: Optional[UUID] = None,
|
client_id: Optional[UUID] = None,
|
||||||
client_object_id: Optional[UUID] = None,
|
client_object_id: Optional[UUID] = None,
|
||||||
@ -93,6 +94,7 @@ class Scaleset(BASE_SCALESET, ORMMixin):
|
|||||||
region=region,
|
region=region,
|
||||||
size=size,
|
size=size,
|
||||||
spot_instances=spot_instances,
|
spot_instances=spot_instances,
|
||||||
|
ephemeral_os_disks=ephemeral_os_disks,
|
||||||
auth=build_auth(),
|
auth=build_auth(),
|
||||||
client_id=client_id,
|
client_id=client_id,
|
||||||
client_object_id=client_object_id,
|
client_object_id=client_object_id,
|
||||||
@ -237,6 +239,7 @@ class Scaleset(BASE_SCALESET, ORMMixin):
|
|||||||
self.image,
|
self.image,
|
||||||
network_id,
|
network_id,
|
||||||
self.spot_instances,
|
self.spot_instances,
|
||||||
|
self.ephemeral_os_disks,
|
||||||
extensions,
|
extensions,
|
||||||
self.auth.password,
|
self.auth.password,
|
||||||
self.auth.public_key,
|
self.auth.public_key,
|
||||||
|
@ -92,6 +92,7 @@ def post(req: func.HttpRequest) -> func.HttpResponse:
|
|||||||
region=region,
|
region=region,
|
||||||
size=request.size,
|
size=request.size,
|
||||||
spot_instances=request.spot_instances,
|
spot_instances=request.spot_instances,
|
||||||
|
ephemeral_os_disks=request.ephemeral_os_disks,
|
||||||
tags=request.tags,
|
tags=request.tags,
|
||||||
)
|
)
|
||||||
# don't return auths during create, only 'get' with include_auth
|
# don't return auths during create, only 'get' with include_auth
|
||||||
|
@ -1279,6 +1279,7 @@ class Scaleset(Endpoint):
|
|||||||
vm_sku: Optional[str] = "Standard_D2s_v3",
|
vm_sku: Optional[str] = "Standard_D2s_v3",
|
||||||
region: Optional[primitives.Region] = None,
|
region: Optional[primitives.Region] = None,
|
||||||
spot_instances: bool = False,
|
spot_instances: bool = False,
|
||||||
|
ephemeral_os_disks: bool = True,
|
||||||
tags: Optional[Dict[str, str]] = None,
|
tags: Optional[Dict[str, str]] = None,
|
||||||
) -> models.Scaleset:
|
) -> models.Scaleset:
|
||||||
self.logger.debug("create scaleset")
|
self.logger.debug("create scaleset")
|
||||||
@ -1305,6 +1306,7 @@ class Scaleset(Endpoint):
|
|||||||
region=region,
|
region=region,
|
||||||
size=size,
|
size=size,
|
||||||
spot_instances=spot_instances,
|
spot_instances=spot_instances,
|
||||||
|
ephemeral_os_disks=ephemeral_os_disks,
|
||||||
tags=tags,
|
tags=tags,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -586,6 +586,7 @@ class AutoScaleConfig(BaseModel):
|
|||||||
region: Optional[Region]
|
region: Optional[Region]
|
||||||
scaleset_size: int # Individual scaleset size
|
scaleset_size: int # Individual scaleset size
|
||||||
spot_instances: bool = Field(default=False)
|
spot_instances: bool = Field(default=False)
|
||||||
|
ephemeral_os_disks: bool = Field(default=False)
|
||||||
vm_sku: str
|
vm_sku: str
|
||||||
|
|
||||||
@validator("scaleset_size", allow_reuse=True)
|
@validator("scaleset_size", allow_reuse=True)
|
||||||
@ -654,6 +655,7 @@ class Scaleset(BaseModel):
|
|||||||
region: Region
|
region: Region
|
||||||
size: int
|
size: int
|
||||||
spot_instances: bool
|
spot_instances: bool
|
||||||
|
ephemeral_os_disks: bool = Field(default=False)
|
||||||
needs_config_update: bool = Field(default=False)
|
needs_config_update: bool = Field(default=False)
|
||||||
error: Optional[Error]
|
error: Optional[Error]
|
||||||
nodes: Optional[List[ScalesetNodeState]]
|
nodes: Optional[List[ScalesetNodeState]]
|
||||||
|
@ -176,6 +176,7 @@ class ScalesetCreate(BaseRequest):
|
|||||||
region: Optional[Region]
|
region: Optional[Region]
|
||||||
size: int
|
size: int
|
||||||
spot_instances: bool
|
spot_instances: bool
|
||||||
|
ephemeral_os_disks: bool
|
||||||
tags: Dict[str, str]
|
tags: Dict[str, str]
|
||||||
|
|
||||||
@validator("size", allow_reuse=True)
|
@validator("size", allow_reuse=True)
|
||||||
|
Reference in New Issue
Block a user