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

SDK-416 : Adding managed disk type for azure cluster #330

Merged
merged 5 commits into from
Oct 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions qds_sdk/cloud/azure_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def set_cloud_config(self,
storage_account_name=None,
disk_storage_account_name=None,
disk_storage_account_resource_group_name=None,
managed_disk_account_type=None,
persistent_security_groups=None,
bastion_node_public_dns=None,
vnet_name=None,
Expand Down Expand Up @@ -56,6 +57,8 @@ def set_cloud_config(self,
disk_storage_account_resource_group_name: Disk storage account resource group
namefor azure cluster

managed_disk_account_type: Managed Disk Type for azure cluster

persistent_security_groups: security group to associate with each node of the cluster.
Typically used to provide access to external hosts

Expand Down Expand Up @@ -87,7 +90,8 @@ def set_cloud_config(self,
vnet_resource_group_name, master_static_nic_name, master_static_public_ip_name)
self.set_storage_config(storage_access_key, storage_account_name,
disk_storage_account_name,
disk_storage_account_resource_group_name)
disk_storage_account_resource_group_name,
managed_disk_account_type)
self.resource_group_name = resource_group_name

def set_compute_config(self,
Expand Down Expand Up @@ -128,12 +132,14 @@ def set_storage_config(self,
storage_access_key=None,
storage_account_name=None,
disk_storage_account_name=None,
disk_storage_account_resource_group_name=None):
disk_storage_account_resource_group_name=None,
managed_disk_account_type=None):
self.storage_config['storage_access_key'] = storage_access_key
self.storage_config['storage_account_name'] = storage_account_name
self.storage_config['disk_storage_account_name'] = disk_storage_account_name
self.storage_config['disk_storage_account_resource_group_name'] \
= disk_storage_account_resource_group_name
self.storage_config['managed_disk_account_type'] = managed_disk_account_type

def set_cloud_config_from_arguments(self, arguments):
self.set_cloud_config(compute_client_id=arguments.compute_client_id,
Expand All @@ -146,6 +152,7 @@ def set_cloud_config_from_arguments(self, arguments):
storage_account_name=arguments.storage_account_name,
disk_storage_account_name=arguments.disk_storage_account_name,
disk_storage_account_resource_group_name=arguments.disk_storage_account_resource_group_name,
managed_disk_account_type=arguments.managed_disk_account_type,
vnet_name=arguments.vnet_name,
subnet_name=arguments.subnet_name,
vnet_resource_group_name=arguments.vnet_resource_group_name,
Expand Down Expand Up @@ -312,3 +319,7 @@ def create_parser(self, argparser):
dest="disk_storage_account_resource_group_name",
default=None,
help="disk storage account resource group for azure cluster")
storage_config.add_argument("--managed-disk-account-type",
dest="managed_disk_account_type",
default=None,
help="managed disk type for azure cluster")
20 changes: 20 additions & 0 deletions tests/test_clusterv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,26 @@ def test_azure_storage_config(self):
}
})

def test_azure_managed_disk_config(self):
sys.argv = ['qds.py', '--version', 'v2', '--cloud', 'AZURE', 'cluster', 'create', '--label', 'test_label',
'--storage-access-key', 'testkey', '--storage-account-name', 'test_account_name',
'--managed-disk-account-type', 'test_managed_disk']
Qubole.cloud = None
print_command()
Connection._api_call = Mock(return_value={})
qds.main()
Connection._api_call.assert_called_with('POST', 'clusters',
{'cluster_info':
{'label': ['test_label']},
'cloud_config':
{'storage_config':
{'storage_access_key': 'testkey',
'storage_account_name': 'test_account_name',
'managed_disk_account_type': 'test_managed_disk'
}
}
})

def test_azure_network_config(self):
sys.argv = ['qds.py', '--version', 'v2', '--cloud', 'AZURE', 'cluster', 'create', '--label', 'test_label',
'--vnet-name', 'testvnet', '--subnet-name', 'testsubnet',
Expand Down