From 44ab0c9d31aeab776992888ab62ea1fca6355b79 Mon Sep 17 00:00:00 2001 From: Brian Caswell Date: Tue, 10 Aug 2021 14:25:51 -0400 Subject: [PATCH 1/2] enable setting the VM SKU for the proxy VMs --- src/api-service/__app__/onefuzzlib/proxy.py | 5 +++-- src/pytypes/onefuzztypes/models.py | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/api-service/__app__/onefuzzlib/proxy.py b/src/api-service/__app__/onefuzzlib/proxy.py index 0f822436fa..c7c75bbb22 100644 --- a/src/api-service/__app__/onefuzzlib/proxy.py +++ b/src/api-service/__app__/onefuzzlib/proxy.py @@ -36,12 +36,12 @@ from .azure.queue import get_queue_sas from .azure.storage import StorageType from .azure.vm import VM +from .config import InstanceConfig from .events import send_event from .extension import proxy_manager_extensions from .orm import ORMMixin, QueryFilter from .proxy_forward import ProxyForward -PROXY_SKU = "Standard_B2s" PROXY_IMAGE = "Canonical:UbuntuServer:18.04-LTS:latest" PROXY_LOG_PREFIX = "scaleset-proxy: " PROXY_LIFESPAN = datetime.timedelta(days=7) @@ -69,10 +69,11 @@ def key_fields(cls) -> Tuple[str, Optional[str]]: return ("region", "proxy_id") def get_vm(self) -> VM: + sku = InstanceConfig.fetch().proxy_vm_sku vm = VM( name="proxy-%s" % base58.b58encode(self.proxy_id.bytes).decode(), region=self.region, - sku=PROXY_SKU, + sku=sku, image=PROXY_IMAGE, auth=self.auth, ) diff --git a/src/pytypes/onefuzztypes/models.py b/src/pytypes/onefuzztypes/models.py index cc4691386a..9bba550cdb 100644 --- a/src/pytypes/onefuzztypes/models.py +++ b/src/pytypes/onefuzztypes/models.py @@ -802,6 +802,8 @@ class InstanceConfig(BaseModel): # if set, only admins can manage pools or scalesets allow_pool_management: bool = Field(default=True) + proxy_vm_sku: str = Field(default="Standard_B2s") + def update(self, config: "InstanceConfig") -> None: for field in config.__fields__: # If no admins are set, then ignore setting admins From 7f1d7dbb9efe4fb60f0df11a18802440ca012a8c Mon Sep 17 00:00:00 2001 From: Brian Caswell Date: Tue, 10 Aug 2021 14:31:54 -0400 Subject: [PATCH 2/2] update event docs --- docs/webhook_events.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/webhook_events.md b/docs/webhook_events.md index 9dc79c7599..cf7241ccb4 100644 --- a/docs/webhook_events.md +++ b/docs/webhook_events.md @@ -641,7 +641,8 @@ Each event will be submitted via HTTP POST to the user provided URL. "admins": [ "00000000-0000-0000-0000-000000000000" ], - "allow_pool_management": true + "allow_pool_management": true, + "proxy_vm_sku": "Standard_B2s" } } ``` @@ -665,6 +666,11 @@ Each event will be submitted via HTTP POST to the user provided URL. "default": true, "title": "Allow Pool Management", "type": "boolean" + }, + "proxy_vm_sku": { + "default": "Standard_B2s", + "title": "Proxy Vm Sku", + "type": "string" } }, "title": "InstanceConfig", @@ -5599,6 +5605,11 @@ Each event will be submitted via HTTP POST to the user provided URL. "default": true, "title": "Allow Pool Management", "type": "boolean" + }, + "proxy_vm_sku": { + "default": "Standard_B2s", + "title": "Proxy Vm Sku", + "type": "string" } }, "title": "InstanceConfig",