-
Notifications
You must be signed in to change notification settings - Fork 1.6k
AKS: Implement support to perform Azure container storage operations #6837
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
Merged
Merged
Changes from 11 commits
Commits
Show all changes
59 commits
Select commit
Hold shift + click to select a range
c7f9c66
Adding azure container storage support to az aks preview extension
mukhoakash 2b42cb4
Fixes and restructuring
mukhoakash 2b3a10d
Design change to call the azure container storage installation from M…
mukhoakash 93be0fb
Missed out a couple of changes
mukhoakash fdf93ec
Merge branch 'main' of github.com:Azure/azure-cli-extensions into acs…
mukhoakash f5b860a
More fixes to the cli logic
mukhoakash fb95dc5
Merge branch 'main' of github.com:Azure/azure-cli-extensions into acs…
mukhoakash 3194da7
Adding history and bumping the version
mukhoakash 8daa9b6
Lint fixes and some more changes
mukhoakash a9923f9
Lint error fixes
mukhoakash c0daa32
Adding help text for the azure container storage params
mukhoakash 32e9eb6
Lint fixes and some final logic changes
mukhoakash c3978af
Test cases for enable and disable azure container storage for aks cre…
mukhoakash 5717138
Merge branch 'main' of github.com:Azure/azure-cli-extensions into acs…
mukhoakash f8fd49d
Fixing a bug
mukhoakash 3263793
Adding help for --storage-pool-name
mukhoakash a262a6d
Reverting some testing changes
mukhoakash 3b71064
Review comments and unittest cases added
mukhoakash f910bc9
Lint fixes
mukhoakash 86a4ce2
Moving the helper functions to a new file
mukhoakash c2f057a
Test case compilation fixes
mukhoakash ed79001
Lint and test fixes
mukhoakash 9c51248
Adding try catch to the delete operation and fixing a test case
mukhoakash 296039d
Small bug fix in the test code
mukhoakash bad5c9e
Test fix
mukhoakash 102598c
Small fixes and indentation fixes
mukhoakash 8cb95b0
Some compilation fix
mukhoakash fa1068f
Removing extension add to validate if tests run
mukhoakash 7e6fc88
Fixing the error message
mukhoakash 29a2a8b
Introducing extension add in test run
mukhoakash f3b9343
Removing unwanted dependent resource providers since ManagedClusters …
mukhoakash 2b94a54
Marking azurecontainerstorage test for bypass
mukhoakash a6f40ca
Fix lint issue
mukhoakash fa7cc4e
Merge branch 'main' of github.com:Azure/azure-cli-extensions into acs…
mukhoakash 8bae3ca
Adding the size of the Large response from index url. Also, removing …
mukhoakash f9c91fd
Add recording for test_aks_create_with_azurecontainerstorage and comm…
mukhoakash 8a86fe9
Introducing the test once again
mukhoakash 6949be3
Revert "Introducing the test once again"
mukhoakash f742701
Merge branch 'main' of github.com:Azure/azure-cli-extensions into acs…
mukhoakash 8bda8f7
Review comments
mukhoakash 52272d9
Adding a validator to ensure elastic san storagepools are atleast 1 Ti
mukhoakash a19da97
Fix compile issue
mukhoakash 8655c6f
Fix error statement
mukhoakash 6d031c4
Improving install time delay for role assignment and adding relevant …
mukhoakash 58cda5f
Remove --storage-pool-type and use --enable-azure-container-storage i…
mukhoakash d07bf68
Fixing the empty space after log lines. Fix a compile issue
mukhoakash 25281eb
Merge branch 'main' of github.com:Azure/azure-cli-extensions into acs…
mukhoakash c5cb1ee
Moving prompt to start of disable. Fix a test
mukhoakash 9914bc5
Small fix
mukhoakash 52aa0dc
Fix a constant typo
mukhoakash 60d60b6
Fixing some lint issues
mukhoakash 4d8d9a5
Fixing an indentation issue
mukhoakash ac95736
Formatting fix
mukhoakash d451aec
Updating the param in live test
mukhoakash 4e0e320
Changing exception to logger.error
mukhoakash f5789c2
Adding the temp local disk value
mukhoakash 29f77dd
Removing unused param
mukhoakash 711ee46
Changing exceptions to logger in install call
mukhoakash a8c5201
Review comment addressed
mukhoakash File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
Empty file.
27 changes: 27 additions & 0 deletions
27
src/aks-preview/azext_aks_preview/azurecontainerstorage/_consts.py
This file contains hidden or 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,27 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| CONST_STORAGE_POOL_TYPE_AZURE_DISK = "azureDisk" | ||
| CONST_STORAGE_POOL_TYPE_EPHEMERAL_DISK = "ephemeralDisk" | ||
| CONST_STORAGE_POOL_TYPE_ELASTIC_SAN = "elasticSan" | ||
| CONST_STORAGE_POOL_SKU_PREMIUM_LRS = "Premium_LRS" | ||
| CONST_STORAGE_POOL_SKU_STANDARD_LRS = "Standard_LRS" | ||
| CONST_STORAGE_POOL_SKU_STANDARDSSD_LRS = "StandardSSD_LRS" | ||
| CONST_STORAGE_POOL_SKU_ULTRASSD_LRS = "UltraSSD_LRS" | ||
| CONST_STORAGE_POOL_SKU_PREMIUM_ZRS = "Premium_ZRS" | ||
| CONST_STORAGE_POOL_SKU_PREMIUMV2_ZRS = "PremiumV2_LRS" | ||
| CONST_STORAGE_POOL_SKU_STANDARDSSD_ZRS = "StandardSSD_ZRS" | ||
| CONST_STORAGE_POOL_OPTION_NVME = "LsV2" | ||
| CONST_STORAGE_POOL_OPTION_TEMP = "temp" | ||
| CONST_STORAGE_POOL_NAME_PREFIX = "mypool-" | ||
| CONST_STORAGE_POOL_DEFAULT_SIZE = "512Gi" | ||
| CONST_EXT_INSTALLATION_NAME = "azurecontainerstorage" | ||
| CONST_ACSTOR_K8S_EXTENSION_NAME = "microsoft.azstor" | ||
|
|
||
| CONST_K8S_EXTENSION_NAME = "k8s-extension" | ||
| CONST_K8S_EXTENSION_CLIENT_FACTORY_MOD_NAME = "azext_k8s_extension._client_factory" | ||
| CONST_K8S_EXTENSION_CUSTOM_MOD_NAME = "azext_k8s_extension.custom" | ||
|
|
||
| CONST_STORAGE_POOL_RANDOM_LENGTH = 7 |
123 changes: 123 additions & 0 deletions
123
src/aks-preview/azext_aks_preview/azurecontainerstorage/_validators.py
This file contains hidden or 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,123 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| from azext_aks_preview.azurecontainerstorage._consts import ( | ||
| CONST_STORAGE_POOL_TYPE_AZURE_DISK, | ||
| CONST_STORAGE_POOL_TYPE_EPHEMERAL_DISK, | ||
| ) | ||
|
|
||
| from azure.cli.core.azclierror import ( | ||
| ArgumentUsageError, | ||
| InvalidArgumentValueError, | ||
| MutuallyExclusiveArgumentError, | ||
| ) | ||
|
|
||
| import re | ||
|
|
||
|
|
||
| def validate_azure_container_storage_params( | ||
|
mukhoakash marked this conversation as resolved.
|
||
| enable_azure_container_storage, | ||
| disable_azure_container_storage, | ||
| storage_pool_name, | ||
| storage_pool_type, | ||
| storage_pool_sku, | ||
| storage_pool_option, | ||
| storage_pool_size, | ||
| ): | ||
| if enable_azure_container_storage and disable_azure_container_storage: | ||
| raise MutuallyExclusiveArgumentError( | ||
| 'Conflicting flags. Cannot set --enable-azure-container-storage ' | ||
| 'and --disable-azure-container-storage together.' | ||
| ) | ||
|
|
||
| if disable_azure_container_storage: | ||
| _validate_disable_azure_container_storage_params( | ||
| storage_pool_name, | ||
| storage_pool_type, | ||
| storage_pool_sku, | ||
| storage_pool_option, | ||
| storage_pool_size, | ||
| ) | ||
|
|
||
| elif enable_azure_container_storage: | ||
| _validate_enable_azure_container_storage_params( | ||
| storage_pool_name, | ||
| storage_pool_type, | ||
| storage_pool_sku, | ||
| storage_pool_option, | ||
| storage_pool_size, | ||
| ) | ||
|
|
||
|
|
||
| def _validate_disable_azure_container_storage_params( | ||
| storage_pool_name, | ||
| storage_pool_type, | ||
| storage_pool_sku, | ||
| storage_pool_option, | ||
| storage_pool_size, | ||
| ): | ||
| if storage_pool_name is not None: | ||
| raise MutuallyExclusiveArgumentError( | ||
| 'Conflicting flags. Cannot define --storage-pool-name value ' | ||
| 'when --disable-azure-container-storage is set.' | ||
| ) | ||
|
|
||
| if storage_pool_type is not None: | ||
| raise MutuallyExclusiveArgumentError( | ||
| 'Conflicting flags. Cannot define --storage-pool-type value ' | ||
| 'when --disable-azure-container-storage is set.' | ||
| ) | ||
|
|
||
| if storage_pool_sku is not None: | ||
| raise MutuallyExclusiveArgumentError( | ||
| 'Conflicting flags. Cannot define --storage-pool-sku value ' | ||
| 'when --disable-azure-container-storage is set.' | ||
| ) | ||
|
|
||
| if storage_pool_size is not None: | ||
| raise MutuallyExclusiveArgumentError( | ||
| 'Conflicting flags. Cannot define --storage-pool-size value ' | ||
| 'when --disable-azure-container-storage is set.' | ||
| ) | ||
|
|
||
| if storage_pool_option is not None: | ||
| raise MutuallyExclusiveArgumentError( | ||
| 'Conflicting flags. Cannot define --storage-pool-option value ' | ||
| 'when --disable-azure-container-storage is set.' | ||
| ) | ||
|
|
||
|
|
||
| def _validate_enable_azure_container_storage_params( | ||
| storage_pool_name, | ||
| storage_pool_type, | ||
| storage_pool_sku, | ||
| storage_pool_option, | ||
| storage_pool_size, | ||
| ): | ||
| if storage_pool_name is not None: | ||
| pattern = r'[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*' | ||
| is_pool_name_valid = re.fullmatch(pattern, storage_pool_name) | ||
| if not is_pool_name_valid: | ||
| raise InvalidArgumentValueError( | ||
| "Invalid --storage-pool-name values. " | ||
| "Accepted values are lowercase alphanumeric characters, " | ||
| "'-' or '.', and must start and end with an alphanumeric character.") | ||
|
|
||
| if storage_pool_type != CONST_STORAGE_POOL_TYPE_AZURE_DISK and \ | ||
| storage_pool_sku is not None: | ||
| raise ArgumentUsageError('Cannot set --storage-pool-sku when --storage-pool-type is not azureDisk') | ||
|
|
||
| if storage_pool_type != CONST_STORAGE_POOL_TYPE_EPHEMERAL_DISK and \ | ||
| storage_pool_option is not None: | ||
| raise ArgumentUsageError('Cannot set --storage-pool-option when --storage-pool-type is not ephemeralDisk') | ||
|
|
||
| if storage_pool_size is not None: | ||
| pattern = r'^\d+(?:Gi|Ti)$' | ||
| match = re.match(pattern, storage_pool_size) | ||
| if match is None: | ||
| raise ArgumentUsageError( | ||
| 'Value for --storage-pool-size should be defined ' | ||
| 'with size followed by Gi or Ti. e.g. 512Gi or 2Ti' | ||
| ) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.