Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tomkukral
Copy link

@tomkukral tomkukral commented Nov 26, 2024

This change is adding possibility to configure azure.subnet_id. It will reuse existing subnet if specified.

Fixes #2910

Tested (run the relevant ones):

  • Code formatting: bash format.sh
  • Any manual or new tests for this PR (please specify below)
  • All smoke tests: pytest tests/test_smoke.py
  • Relevant individual smoke tests: pytest tests/test_smoke.py::test_fill_in_the_name
  • Backward compatibility tests: conda deactivate; bash -i tests/backward_compatibility_tests.sh

@tomkukral tomkukral marked this pull request as draft November 26, 2024 07:24
@tomkukral tomkukral force-pushed the azure_subnet branch 4 times, most recently from 4619a42 to 9a5f71c Compare November 26, 2024 11:57
@tomkukral tomkukral changed the title WIP: Support for azure subnet Support for azure subnet Nov 26, 2024
@tomkukral tomkukral marked this pull request as ready for review November 26, 2024 13:24
@tomkukral tomkukral mentioned this pull request Nov 26, 2024
5 tasks
@tomkukral tomkukral changed the title Support for azure subnet [azure] support for existing subnet Nov 26, 2024
Copy link
Collaborator

@cblmemo cblmemo left a 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 :)

docs/source/reference/config.rst Outdated Show resolved Hide resolved
# 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)
Copy link
Collaborator

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.
Copy link
Collaborator

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."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent?

# 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 == '':
Copy link
Collaborator

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?

@@ -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', '')
Copy link
Collaborator

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot choose Custom V-net and custom images in Azure
2 participants