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

AKS: Update the VM SKU regex check to handle all vm skus possible for Azure Container Storage #7888

Merged
merged 6 commits into from
Aug 27, 2024
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
4 changes: 4 additions & 0 deletions src/aks-preview/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ If there is no rush to release a new version, please just add a description of t

To release a new version, please select a new version number (usually plus 1 to last patch version, X.Y.Z -> Major.Minor.Patch, more details in `\doc <https://semver.org/>`_), and then add a new section named as the new version number in this file, the content should include the new modifications and everything from the *Pending* section. Finally, update the `VERSION` variable in `setup.py` with this new version number.

7.0.0b8
+++++++
* Update validations to enable Azure Container Storage to install on a larger set of nodepool skus.

7.0.0b7
+++++++
* [AKS] `az aks create/update`: Support UserAssigned Managed Identity for grafana linking in managed prometheus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,12 +414,15 @@ def get_desired_resource_value_args(
# Returns -1 if there is a problem with parsing the vm_size.
def get_cores_from_sku(vm_size):
cpu_value = -1
pattern = r'standard_([a-z]+)(\d+)([a-z]*)_v(\d+)'
pattern = r'([a-z])+(\d+)[a-z]*(?=_v(\d+)[^_]*$|$)'
match = re.search(pattern, vm_size.lower())
if match:
series_prefix = match.group(1)
size_val = int(match.group(2))
version = int(match.group(4))
version_val = match.group(3)
version = -1
if version_val is not None:
version = int(version_val)

cpu_value = size_val
# https://learn.microsoft.com/en-us/azure/virtual-machines/dv2-dsv2-series
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,91 @@ def test_enable_with_premiumv2_sku_and_azure_disk(self):
)
self.assertEqual(str(cm.exception), err)

def test_enable_with_insufficient_cores_1(self):
storage_pool_name = "valid-name"
storage_pool_sku = acstor_consts.CONST_STORAGE_POOL_SKU_PREMIUM_LRS
storage_pool_type = acstor_consts.CONST_STORAGE_POOL_TYPE_AZURE_DISK
nodepool_list = "pool1"
agentpools = [{"name": "pool1", "vm_size": "Standard_D2s_v2", "count": 3, "zoned": False}]
err = (
"Cannot operate Azure Container Storage on a node pool consisting of "
"nodes with cores less than 4. Node pool: pool1 with node size: Standard_D2s_v2 "
"which is assigned for Azure Container Storage has nodes with 2 cores."
)
with self.assertRaises(InvalidArgumentValueError) as cm:
acstor_validator.validate_enable_azure_container_storage_params(
storage_pool_type, storage_pool_name, storage_pool_sku, None, None, nodepool_list, agentpools, False, False, False, False, False, None, None, acstor_consts.CONST_DISK_TYPE_EPHEMERAL_VOLUME_ONLY, acstor_consts.CONST_EPHEMERAL_NVME_PERF_TIER_STANDARD
)
self.assertEqual(str(cm.exception), err)

def test_enable_with_insufficient_cores_2(self):
storage_pool_name = "valid-name"
storage_pool_sku = acstor_consts.CONST_STORAGE_POOL_SKU_PREMIUM_LRS
storage_pool_type = acstor_consts.CONST_STORAGE_POOL_TYPE_AZURE_DISK
nodepool_list = "pool1"
agentpools = [{"name": "pool1", "vm_size": "Standard_H100-D2s_v2", "count": 3, "zoned": False}]
err = (
"Cannot operate Azure Container Storage on a node pool consisting of "
"nodes with cores less than 4. Node pool: pool1 with node size: Standard_H100-D2s_v2 "
"which is assigned for Azure Container Storage has nodes with 2 cores."
)
with self.assertRaises(InvalidArgumentValueError) as cm:
acstor_validator.validate_enable_azure_container_storage_params(
storage_pool_type, storage_pool_name, storage_pool_sku, None, None, nodepool_list, agentpools, False, False, False, False, False, None, None, acstor_consts.CONST_DISK_TYPE_EPHEMERAL_VOLUME_ONLY, acstor_consts.CONST_EPHEMERAL_NVME_PERF_TIER_STANDARD
)
self.assertEqual(str(cm.exception), err)

def test_enable_with_insufficient_cores_3(self):
storage_pool_name = "valid-name"
storage_pool_sku = acstor_consts.CONST_STORAGE_POOL_SKU_PREMIUM_LRS
storage_pool_type = acstor_consts.CONST_STORAGE_POOL_TYPE_AZURE_DISK
nodepool_list = "pool1"
agentpools = [{"name": "pool1", "vm_size": "Standard_H100-D2s", "count": 3, "zoned": False}]
err = (
"Cannot operate Azure Container Storage on a node pool consisting of "
"nodes with cores less than 4. Node pool: pool1 with node size: Standard_H100-D2s "
"which is assigned for Azure Container Storage has nodes with 2 cores."
)
with self.assertRaises(InvalidArgumentValueError) as cm:
acstor_validator.validate_enable_azure_container_storage_params(
storage_pool_type, storage_pool_name, storage_pool_sku, None, None, nodepool_list, agentpools, False, False, False, False, False, None, None, acstor_consts.CONST_DISK_TYPE_EPHEMERAL_VOLUME_ONLY, acstor_consts.CONST_EPHEMERAL_NVME_PERF_TIER_STANDARD
)
self.assertEqual(str(cm.exception), err)

def test_enable_with_insufficient_cores_4(self):
storage_pool_name = "valid-name"
storage_pool_sku = acstor_consts.CONST_STORAGE_POOL_SKU_PREMIUM_LRS
storage_pool_type = acstor_consts.CONST_STORAGE_POOL_TYPE_AZURE_DISK
nodepool_list = "pool1"
agentpools = [{"name": "pool1", "vm_size": "Standard_H2", "count": 3, "zoned": False}]
err = (
"Cannot operate Azure Container Storage on a node pool consisting of "
"nodes with cores less than 4. Node pool: pool1 with node size: Standard_H2 "
"which is assigned for Azure Container Storage has nodes with 2 cores."
)
with self.assertRaises(InvalidArgumentValueError) as cm:
acstor_validator.validate_enable_azure_container_storage_params(
storage_pool_type, storage_pool_name, storage_pool_sku, None, None, nodepool_list, agentpools, False, False, False, False, False, None, None, acstor_consts.CONST_DISK_TYPE_EPHEMERAL_VOLUME_ONLY, acstor_consts.CONST_EPHEMERAL_NVME_PERF_TIER_STANDARD
)
self.assertEqual(str(cm.exception), err)

def test_enable_with_insufficient_cores_5(self):
storage_pool_name = "valid-name"
storage_pool_sku = acstor_consts.CONST_STORAGE_POOL_SKU_PREMIUM_LRS
storage_pool_type = acstor_consts.CONST_STORAGE_POOL_TYPE_AZURE_DISK
nodepool_list = "pool1"
agentpools = [{"name": "pool1", "vm_size": "Standard_D2s", "count": 3, "zoned": False}]
err = (
"Cannot operate Azure Container Storage on a node pool consisting of "
"nodes with cores less than 4. Node pool: pool1 with node size: Standard_D2s "
"which is assigned for Azure Container Storage has nodes with 2 cores."
)
with self.assertRaises(InvalidArgumentValueError) as cm:
acstor_validator.validate_enable_azure_container_storage_params(
storage_pool_type, storage_pool_name, storage_pool_sku, None, None, nodepool_list, agentpools, False, False, False, False, False, None, None, acstor_consts.CONST_DISK_TYPE_EPHEMERAL_VOLUME_ONLY, acstor_consts.CONST_EPHEMERAL_NVME_PERF_TIER_STANDARD
)
self.assertEqual(str(cm.exception), err)

def test_enable_with_option_and_non_ephemeral_disk_pool(self):
storage_pool_name = "valid-name"
storage_pool_option = acstor_consts.CONST_STORAGE_POOL_OPTION_NVME
Expand Down
2 changes: 1 addition & 1 deletion src/aks-preview/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from setuptools import setup, find_packages

VERSION = "7.0.0b7"
VERSION = "7.0.0b8"

CLASSIFIERS = [
"Development Status :: 4 - Beta",
Expand Down
Loading