-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add aks-safeguards extension #8919
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
Closed
Closed
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
3373c87
First add of aks-safeguards extension
NickKeller 6f77661
First go at overriding args and doing some param validation
NickKeller e7a930e
Use correct arg type
NickKeller 7dc0659
Override create, show, update, and delete classes to provide custom a…
NickKeller 9e8d524
Update Python version classifiers in setup.py
NickKeller 74f99c6
First add of aks-safeguards extension
NickKeller a079174
First go at overriding args and doing some param validation
NickKeller dcad2f9
Use correct arg type
NickKeller 2c1e165
Override create, show, update, and delete classes to provide custom a…
NickKeller 1bf7338
Update Python version classifiers in setup.py
NickKeller 93a26e0
Correctly configure -g and -n arguments
NickKeller f34b358
pull down changes
NickKeller 51c887c
Remove conflict cruft
NickKeller 70953fd
Remove more conflict cruft
NickKeller 576cce2
Fix args schema
NickKeller fa9b264
Run live tests
NickKeller 8ffffda
Fix style errors and add help text
NickKeller 1bceffd
update help
NickKeller 31fafb0
Fix help format
NickKeller 4aa0219
Merge branch 'main' into nikelle/azakssafeguards
NickKeller 38a56b9
Update help command for excluded namespaces arg to specify format
NickKeller 96d93b9
Add wait command
NickKeller f12afd4
Add helps in README
NickKeller 28f81a7
Regenerate based off examples, generate correct test recording
NickKeller c6ceddc
Update src/aks-safeguards/azext_aks_safeguards/_help.py
NickKeller 9f204a3
Update src/aks-safeguards/azext_aks_safeguards/aaz/latest/aks/safegua…
NickKeller 18e6f79
Update src/aks-safeguards/azext_aks_safeguards/_help.py
NickKeller 4d4f1d6
Modify metadata
NickKeller b79a8e4
Change back
NickKeller 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| .. :changelog: | ||
|
|
||
| Release History | ||
| =============== | ||
|
|
||
| 1.0.0b1 | ||
| ++++++ | ||
| * Initial release. |
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,51 @@ | ||||||
| # Azure CLI AksSafeguards Extension # | ||||||
| This is an extension to Azure CLI to manage AksSafeguards resources. | ||||||
|
|
||||||
| ## Commands ## | ||||||
|
|
||||||
| ### az aks safeguards create | ||||||
|
|
||||||
| Enable Deployment Safeguards for an AKS cluster | ||||||
|
|
||||||
| #### Examples | ||||||
|
|
||||||
| | Example | Description | | ||||||
| |---------|-------------| | ||||||
| | `az aks safeguards create --resource-group MyResourceGroup --name MyAKSCluster --level Warn` | Enable Deployment Safeguards for an AKS cluster at Warn level | | ||||||
| | `az aks safeguards create --resource-group MyResourceGroup --name MyAKSCluster --level Warn --excluded-namespaces [ns1,ns2]` | Enable Deployment Safeguards at Warn level for an AKS cluster with excluded namespaces | | ||||||
| | `az aks safeguards create --managed-cluster "/subscriptions/MySubscriptionID/resourceGroups/MyResourceGroup/providers/Microsoft.ContainerService/managedClusters/MyAKSCluster" --level Warn` | Enable Deployment Safeguards at Warn level for an AKS cluster by its resource ID | | ||||||
|
|
||||||
| ### az aks safeguards update | ||||||
|
|
||||||
| Update Deployment Safeguards for an AKS cluster | ||||||
|
|
||||||
| #### Examples | ||||||
|
|
||||||
| | Example | Description | | ||||||
| |---------|-------------| | ||||||
| | `az aks safeguards update --resource-group MyResourceGroup --name MyAKSCluster --level Enforce` | Update Deployment Safeguards to Enforce level for an AKS cluster with a specific name and resource group | | ||||||
| | `az aks safeguards update --resource-group MyResourceGroup --name MyAKSCluster --excluded-namespaces [ns1,ns2] --level Warn` | Update Deployment Safeguards to Warn level for an AKS cluster with excluded namespaces | | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| | `az aks safeguards update --managed-cluster "/subscriptions/MySubscriptionID/resourceGroups/MyResourceGroup/providers/Microsoft.ContainerService/managedClusters/MyAKSCluster" --level Enforce` | Update Deployment Safeguards to Enforce level for an AKS cluster by its resource ID | | ||||||
|
|
||||||
| ### az aks safeguards show | ||||||
|
|
||||||
| Show Deployment Safeguards configuration for a Managed Cluster | ||||||
|
|
||||||
| #### Examples | ||||||
|
|
||||||
| | Example | Description | | ||||||
| |---------|-------------| | ||||||
| | `az aks safeguards show --resource-group MyResourceGroup --name MyAKSCluster` | Show Deployment Safeguards for an AKS cluster with a specific name and resource group | | ||||||
| | `az aks safeguards show --managed-cluster "/subscriptions/MySubscriptionID/resourceGroups/MyResourceGroup/providers/Microsoft.ContainerService/managedClusters/MyAKSCluster"` | Show Deployment Safeguards for an AKS cluster by its resource ID | | ||||||
|
|
||||||
| ### az aks safeguards delete | ||||||
|
|
||||||
| Delete Deployment Safeguards configuration for a Managed Cluster | ||||||
|
|
||||||
| #### Examples | ||||||
|
|
||||||
| | Example | Description | | ||||||
| |---------|-------------| | ||||||
| | `az aks safeguards delete --resource-group MyResourceGroup --name MyAKSCluster` | Delete Deployment Safeguards for an AKS cluster with a specific name and resource group | | ||||||
| | `az aks safeguards delete --managed-cluster "/subscriptions/MySubscriptionID/resourceGroups/MyResourceGroup/providers/Microsoft.ContainerService/managedClusters/MyAKSCluster"` | Delete Deployment Safeguards for an AKS cluster by its resource ID | | ||||||
|
|
||||||
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,42 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # | ||
| # Code generated by aaz-dev-tools | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| from azure.cli.core import AzCommandsLoader | ||
| from azext_aks_safeguards._help import helps # pylint: disable=unused-import | ||
|
|
||
|
|
||
| class AksSafeguardsCommandsLoader(AzCommandsLoader): | ||
|
|
||
| def __init__(self, cli_ctx=None): | ||
| from azure.cli.core.commands import CliCommandType | ||
| custom_command_type = CliCommandType( | ||
| operations_tmpl='azext_aks_safeguards.custom#{}') | ||
| super().__init__(cli_ctx=cli_ctx, | ||
| custom_command_type=custom_command_type) | ||
|
|
||
| def load_command_table(self, args): | ||
| from azext_aks_safeguards.commands import load_command_table | ||
| from azure.cli.core.aaz import load_aaz_command_table | ||
| try: | ||
| from . import aaz | ||
| except ImportError: | ||
| aaz = None | ||
| if aaz: | ||
| load_aaz_command_table( | ||
| loader=self, | ||
| aaz_pkg_name=aaz.__name__, | ||
| args=args | ||
| ) | ||
| load_command_table(self, args) | ||
| return self.command_table | ||
|
|
||
| def load_arguments(self, command): | ||
| from azext_aks_safeguards._params import load_arguments | ||
| load_arguments(self, command) | ||
|
|
||
|
|
||
| COMMAND_LOADER_CLS = AksSafeguardsCommandsLoader |
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,56 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # | ||
| # Code generated by aaz-dev-tools | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| # pylint: disable=line-too-long | ||
| # pylint: disable=too-many-lines | ||
|
|
||
| from knack.help_files import helps # pylint: disable=unused-import | ||
NickKeller marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| helps['aks safeguards create'] = """ | ||
| type: command | ||
| short-summary: Enable Deployment Safeguards for an AKS cluster | ||
| examples: | ||
| - name: Enable Deployment Safeguards for an AKS cluster at Warn level | ||
| text: az aks safeguards create --resource-group MyResourceGroup --name MyAKSCluster --level Warn | ||
| - name: Enable Deployment Safeguards at Warn level for an AKS cluster with excluded namespaces | ||
| text: az aks safeguards create --resource-group MyResourceGroup --name MyAKSCluster --level Warn --excluded-namespaces ns1 ns2 | ||
| - name: Enable Deployment Safeguards at Warn level for an AKS cluster by its resource ID | ||
| text: az aks safeguards create --managed-cluster "/subscriptions/MySubscriptionID/resourceGroups/MyResourceGroup/providers/Microsoft.ContainerService/managedClusters/MyAKSCluster" --level Warn | ||
| """ | ||
|
|
||
| helps['aks safeguards update'] = """ | ||
| type: command | ||
| short-summary: Update Deployment Safeguards for an AKS cluster | ||
| examples: | ||
| - name: Update Deployment Safeguards to Enforce level for an AKS cluster with a specific name and resource group | ||
| text: az aks safeguards update --resource-group MyResourceGroup --name MyAKSCluster --level Enforce | ||
| - name: Update Deployment Safeguards to Warn level for an AKS cluster with excluded namespaces | ||
| text: az aks safeguards update --resource-group MyResourceGroup --name MyAKSCluster --excluded-namespaces ns1 ns2 --level Warn | ||
| - name: Update Deployment Safeguards to Enforce level for an AKS cluster by its resource ID | ||
| text: az aks safeguards update --managed-cluster "/subscriptions/MySubscriptionID/resourceGroups/MyResourceGroup/providers/Microsoft.ContainerService/managedClusters/MyAKSCluster" --level Enforce | ||
| """ | ||
|
|
||
| helps['aks safeguards show'] = """ | ||
| type: command | ||
| short-summary: Show Deployment Safeguards configuration for a Managed Cluster | ||
| examples: | ||
| - name: Show Deployment Safeguards for an AKS cluster with a specific name and resource group | ||
| text: az aks safeguards show --resource-group MyResourceGroup --name MyAKSCluster | ||
| - name: Show Deployment Safeguards for an AKS cluster by its resource ID | ||
| text: az aks safeguards show --managed-cluster "/subscriptions/MySubscriptionID/resourceGroups/MyResourceGroup/providers/Microsoft.ContainerService/managedClusters/MyAKSCluster" | ||
| """ | ||
|
|
||
| helps['aks safeguards delete'] = """ | ||
| type: command | ||
| short-summary: Delete Deployment Safeguards configuration for a Managed Cluster | ||
| examples: | ||
| - name: Delete Deployment Safeguards for an AKS cluster with a specific name and resource group | ||
| text: az aks safeguards delete --resource-group MyResourceGroup --name MyAKSCluster | ||
| - name: Delete Deployment Safeguards for an AKS cluster by its resource ID | ||
| text: az aks safeguards delete --managed-cluster "/subscriptions/MySubscriptionID/resourceGroups/MyResourceGroup/providers/Microsoft.ContainerService/managedClusters/MyAKSCluster" | ||
| """ | ||
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,13 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # | ||
| # Code generated by aaz-dev-tools | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| # pylint: disable=too-many-lines | ||
| # pylint: disable=too-many-statements | ||
|
|
||
|
|
||
| def load_arguments(self, _): # pylint: disable=unused-argument | ||
| pass |
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,6 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # | ||
| # Code generated by aaz-dev-tools | ||
| # -------------------------------------------------------------------------------------------- |
10 changes: 10 additions & 0 deletions
10
src/aks-safeguards/azext_aks_safeguards/aaz/latest/__init__.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,10 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # | ||
| # Code generated by aaz-dev-tools | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| # pylint: skip-file | ||
| # flake8: noqa | ||
|
|
23 changes: 23 additions & 0 deletions
23
src/aks-safeguards/azext_aks_safeguards/aaz/latest/aks/__cmd_group.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,23 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # | ||
| # Code generated by aaz-dev-tools | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| # pylint: skip-file | ||
| # flake8: noqa | ||
|
|
||
| from azure.cli.core.aaz import * | ||
|
|
||
|
|
||
| @register_command_group( | ||
| "aks", | ||
| ) | ||
| class __CMDGroup(AAZCommandGroup): | ||
| """Azure Kubernetes Service | ||
| """ | ||
| pass | ||
|
|
||
|
|
||
| __all__ = ["__CMDGroup"] |
11 changes: 11 additions & 0 deletions
11
src/aks-safeguards/azext_aks_safeguards/aaz/latest/aks/__init__.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,11 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # | ||
| # Code generated by aaz-dev-tools | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| # pylint: skip-file | ||
| # flake8: noqa | ||
|
|
||
| from .__cmd_group import * |
23 changes: 23 additions & 0 deletions
23
src/aks-safeguards/azext_aks_safeguards/aaz/latest/aks/safeguards/__cmd_group.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,23 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # | ||
| # Code generated by aaz-dev-tools | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| # pylint: skip-file | ||
| # flake8: noqa | ||
|
|
||
| from azure.cli.core.aaz import * | ||
|
|
||
|
|
||
| @register_command_group( | ||
| "aks safeguards", | ||
| ) | ||
| class __CMDGroup(AAZCommandGroup): | ||
| """Manage Deployment Safeguards | ||
| """ | ||
| pass | ||
|
|
||
|
|
||
| __all__ = ["__CMDGroup"] |
17 changes: 17 additions & 0 deletions
17
src/aks-safeguards/azext_aks_safeguards/aaz/latest/aks/safeguards/__init__.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,17 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # | ||
| # Code generated by aaz-dev-tools | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| # pylint: skip-file | ||
| # flake8: noqa | ||
|
|
||
| from .__cmd_group import * | ||
| from ._create import * | ||
| from ._delete import * | ||
| from ._list import * | ||
| from ._show import * | ||
| from ._update import * | ||
| from ._wait import * |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.