enable configuring proxy VM sku (#1128)

This commit is contained in:
bmc-msft
2021-08-23 12:04:59 -04:00
committed by GitHub
parent d1f58e6807
commit 2a2844ae7a
3 changed files with 16 additions and 3 deletions

View File

@ -644,7 +644,8 @@ Each event will be submitted via HTTP POST to the user provided URL.
"allow_pool_management": true, "allow_pool_management": true,
"allowed_aad_tenants": [ "allowed_aad_tenants": [
"00000000-0000-0000-0000-000000000000" "00000000-0000-0000-0000-000000000000"
] ],
"proxy_vm_sku": "Standard_B2s"
} }
} }
``` ```
@ -676,6 +677,11 @@ Each event will be submitted via HTTP POST to the user provided URL.
}, },
"title": "Allowed Aad Tenants", "title": "Allowed Aad Tenants",
"type": "array" "type": "array"
},
"proxy_vm_sku": {
"default": "Standard_B2s",
"title": "Proxy Vm Sku",
"type": "string"
} }
}, },
"required": [ "required": [
@ -5621,6 +5627,11 @@ Each event will be submitted via HTTP POST to the user provided URL.
}, },
"title": "Allowed Aad Tenants", "title": "Allowed Aad Tenants",
"type": "array" "type": "array"
},
"proxy_vm_sku": {
"default": "Standard_B2s",
"title": "Proxy Vm Sku",
"type": "string"
} }
}, },
"required": [ "required": [

View File

@ -36,12 +36,12 @@ from .azure.ip import get_public_ip
from .azure.queue import get_queue_sas from .azure.queue import get_queue_sas
from .azure.storage import StorageType from .azure.storage import StorageType
from .azure.vm import VM from .azure.vm import VM
from .config import InstanceConfig
from .events import send_event from .events import send_event
from .extension import proxy_manager_extensions from .extension import proxy_manager_extensions
from .orm import ORMMixin, QueryFilter from .orm import ORMMixin, QueryFilter
from .proxy_forward import ProxyForward from .proxy_forward import ProxyForward
PROXY_SKU = "Standard_B2s"
PROXY_IMAGE = "Canonical:UbuntuServer:18.04-LTS:latest" PROXY_IMAGE = "Canonical:UbuntuServer:18.04-LTS:latest"
PROXY_LOG_PREFIX = "scaleset-proxy: " PROXY_LOG_PREFIX = "scaleset-proxy: "
PROXY_LIFESPAN = datetime.timedelta(days=7) PROXY_LIFESPAN = datetime.timedelta(days=7)
@ -69,10 +69,11 @@ class Proxy(ORMMixin):
return ("region", "proxy_id") return ("region", "proxy_id")
def get_vm(self) -> VM: def get_vm(self) -> VM:
sku = InstanceConfig.fetch().proxy_vm_sku
vm = VM( vm = VM(
name="proxy-%s" % base58.b58encode(self.proxy_id.bytes).decode(), name="proxy-%s" % base58.b58encode(self.proxy_id.bytes).decode(),
region=self.region, region=self.region,
sku=PROXY_SKU, sku=sku,
image=PROXY_IMAGE, image=PROXY_IMAGE,
auth=self.auth, auth=self.auth,
) )

View File

@ -802,6 +802,7 @@ class InstanceConfig(BaseModel):
# if set, only admins can manage pools or scalesets # if set, only admins can manage pools or scalesets
allow_pool_management: bool = Field(default=True) allow_pool_management: bool = Field(default=True)
proxy_vm_sku: str = Field(default="Standard_B2s")
allowed_aad_tenants: List[UUID] allowed_aad_tenants: List[UUID]
def update(self, config: "InstanceConfig") -> None: def update(self, config: "InstanceConfig") -> None: