-
Notifications
You must be signed in to change notification settings - Fork 518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[azure] support for existing subnet #4417
base: master
Are you sure you want to change the base?
Conversation
4619a42
to
9a5f71c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @tomkukral for contributing this! It would be really helpful. Left some discussions :)
# SkyPilot created new vnet and subnet by default but it will reuse exisiting subnet if specified. | ||
subnet_id: /subscriptions/subscription-id/resourceGroups/resource-group-name/providers/Microsoft.Network/virtualNetworks/vnet-name/subnets/subnet-name | ||
|
||
# Should instances be assigned private IPs only? (optional) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: use declarative?
# When set to true, SkyPilot will only use private subnets to launch nodes and won't expose | ||
# instances on public IP addresses. | ||
# Reference: https://learn.microsoft.com/en-us/azure/virtual-network/virtual-network-manage-subnet?tabs=azure-portal | ||
# Default: false. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe move this right after the (optional)
line?
"existingSubnet": { | ||
"type": "string", | ||
"metadata": { | ||
"description": "Existing subnet id to use." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent?
sky/provision/azure/config.py
Outdated
# choose a random subnet, skipping most common value of 0 | ||
random.seed(cluster_id) | ||
subnet_mask = f'10.{random.randint(1, 254)}.0.0/16' | ||
if subnet_id == '': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we change this from subnet_mask is missing, to subnet_id is missing? what is the relation between these two variables?
sky/provision/azure/config.py
Outdated
@@ -86,6 +86,8 @@ def bootstrap_instances( | |||
'use_external_resource_group field') | |||
use_external_resource_group = provider_config['use_external_resource_group'] | |||
|
|||
subnet_id = provider_config.get('subnet_id', '') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can we use None instead of empty string to indicate not specified? same for the arm template.
This change is adding possibility to configure azure.subnet_id fixes skypilot-org#2910
4bbe358
to
2b44133
Compare
This change is adding possibility to configure
azure.subnet_id
. It will reuse existing subnet if specified.Fixes #2910
Tested (run the relevant ones):
bash format.sh
pytest tests/test_smoke.py
pytest tests/test_smoke.py::test_fill_in_the_name
conda deactivate; bash -i tests/backward_compatibility_tests.sh