-
Notifications
You must be signed in to change notification settings - Fork 470
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support start and stop Azure instances (#316)
* azure external node provider * allow stopping Azure * update token check
- Loading branch information
Showing
18 changed files
with
927 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
include sky/clouds/service_catalog/data/* | ||
include sky/skylet/*.sh | ||
include sky/skylet/providers/azure/* | ||
include sky/skylet/providers/gcp/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# start and stop Azure instances | ||
name: azure-start-stop | ||
|
||
resources: | ||
cloud: azure | ||
|
||
num_nodes: 2 | ||
|
||
# The setup command. Will be run under the working directory. | ||
setup: 'echo "azure-start-stop [setup]"' | ||
|
||
# The command to run. Will be run under the working directory. | ||
run: 'echo "azure-start-stop [run]"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
"""Azure cli adaptor""" | ||
|
||
# pylint: disable=import-outside-toplevel | ||
|
||
|
||
def get_subscription_id() -> str: | ||
"""Get the default subscription id.""" | ||
from azure.common import credentials | ||
return credentials.get_cli_profile().get_subscription_id() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
"""Azure node provider""" | ||
from sky.skylet.providers.azure.node_provider import AzureNodeProvider |
88 changes: 88 additions & 0 deletions
88
prototype/sky/skylet/providers/azure/azure-config-template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", | ||
"contentVersion": "1.0.0.0", | ||
"parameters": { | ||
"subnet": { | ||
"type": "string", | ||
"metadata": { | ||
"description": "The subnet to be used" | ||
} | ||
} | ||
}, | ||
"variables": { | ||
"Contributor": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'b24988ac-6180-42a0-ab88-20f7382dd24c')]", | ||
"location": "[resourceGroup().location]" | ||
}, | ||
"resources": [ | ||
{ | ||
"type": "Microsoft.ManagedIdentity/userAssignedIdentities", | ||
"apiVersion": "2018-11-30", | ||
"location": "[variables('location')]", | ||
"name": "ray-msi-user-identity" | ||
}, | ||
{ | ||
"type": "Microsoft.Authorization/roleAssignments", | ||
"apiVersion": "2020-04-01-preview", | ||
"name": "[guid(resourceGroup().id)]", | ||
"properties": { | ||
"principalId": "[reference('ray-msi-user-identity').principalId]", | ||
"roleDefinitionId": "[variables('Contributor')]", | ||
"scope": "[resourceGroup().id]", | ||
"principalType": "ServicePrincipal" | ||
}, | ||
"dependsOn": [ | ||
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'ray-msi-user-identity')]" | ||
] | ||
}, | ||
{ | ||
"type": "Microsoft.Network/networkSecurityGroups", | ||
"apiVersion": "2019-02-01", | ||
"name": "ray-nsg", | ||
"location": "[variables('location')]", | ||
"properties": { | ||
"securityRules": [ | ||
{ | ||
"name": "SSH", | ||
"properties": { | ||
"priority": 1000, | ||
"protocol": "TCP", | ||
"access": "Allow", | ||
"direction": "Inbound", | ||
"sourceAddressPrefix": "*", | ||
"sourcePortRange": "*", | ||
"destinationAddressPrefix": "*", | ||
"destinationPortRange": "22" | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"type": "Microsoft.Network/virtualNetworks", | ||
"apiVersion": "2019-11-01", | ||
"name": "ray-vnet", | ||
"location": "[variables('location')]", | ||
"properties": { | ||
"addressSpace": { | ||
"addressPrefixes": [ | ||
"[parameters('subnet')]" | ||
] | ||
}, | ||
"subnets": [ | ||
{ | ||
"name": "ray-subnet", | ||
"properties": { | ||
"addressPrefix": "[parameters('subnet')]", | ||
"networkSecurityGroup": { | ||
"id": "[resourceId('Microsoft.Network/networkSecurityGroups','ray-nsg')]" | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"dependsOn": [ | ||
"[resourceId('Microsoft.Network/networkSecurityGroups', 'ray-nsg')]" | ||
] | ||
} | ||
] | ||
} |
Oops, something went wrong.