-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Update azure Policy key under addonProfiles matching Azure Portal casing #8495
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
Open
nirnaymsft
wants to merge
16
commits into
Azure:main
Choose a base branch
from
nirnaymsft:patch-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
38037d8
Update _consts.py
nirnaymsft aaee9ac
changed setup.py and HISTORY file
nirnaymsft 015c54f
Merge branch 'main' into patch-1
nirnaymsft da1b9fd
changed setup.py and HISTORY file
nirnaymsft 5affaee
Merge branch 'patch-1' of https://github.com/nirnaymsft/azure-cli-ext…
nirnaymsft 92d7a8d
code change for existing clusters
nirnaymsft 9a9b5dc
handle case for existing enabled clusters
nirnaymsft 535fcb2
added testcase
nirnaymsft d35675e
removed camel casing
nirnaymsft 8c25b10
bump version again
nirnaymsft eaa8eab
bump version again
nirnaymsft 66540c0
Merge branch 'main' into patch-1
nirnaymsft e433267
bump version again
nirnaymsft e37e40e
Merge branch 'patch-1' of https://github.com/nirnaymsft/azure-cli-ext…
nirnaymsft a27ae9d
trying self.assertTrue
nirnaymsft 119c68e
Merge branch 'main' into patch-1
nirnaymsft 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2427,6 +2427,87 @@ def test_aks_create_with_safeguards(self, resource_group, resource_group_locatio | |
], | ||
) | ||
|
||
@AllowLargeResponse() | ||
@AKSCustomResourceGroupPreparer( | ||
random_name_length=17, name_prefix="clitest", location="westcentralus" | ||
) | ||
def test_aks_create_with_azurepolicy(self, resource_group, resource_group_location): | ||
aks_name = self.create_random_name("cliakstest", 16) | ||
self.kwargs.update( | ||
{ | ||
"resource_group": resource_group, | ||
"name": aks_name, | ||
"ssh_key_value": self.generate_ssh_keys(), | ||
} | ||
) | ||
|
||
create_cmd = ( | ||
"aks create --resource-group={resource_group} --name={name} --ssh-key-value={ssh_key_value} " | ||
"--enable-addons azure-policy " | ||
) | ||
self.cmd( | ||
create_cmd, | ||
checks=[ | ||
self.check("provisioningState", "Succeeded"), | ||
# Case-insensitive check for azurePolicy and enabled=True | ||
self.assertTrue(any(k.lower() == "azurepolicy" and v.get("enabled") for k, v in result.get("addonProfiles", {}).items())), | ||
], | ||
) | ||
|
||
list_cmd = ( | ||
"aks addon list --resource-group={resource_group} --name={name} -o json" | ||
) | ||
addon_list = self.cmd(list_cmd).get_output_in_json() | ||
|
||
assert len(addon_list) > 0 | ||
|
||
for addon in addon_list: | ||
if addon["name"] == "azure-policy": | ||
assert addon["enabled"] | ||
else: | ||
assert not addon["enabled"] | ||
|
||
disable_cmd = ( | ||
"aks aks --resource-group={resource_group} --name={name} " | ||
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. typo here? |
||
"--disable-addons azure-policy " | ||
) | ||
self.cmd( | ||
disable_cmd, | ||
checks=[ | ||
self.check("provisioningState", "Succeeded"), | ||
# Case-insensitive check for azurePolicy and enabled=True | ||
self.assertTrue(any(k.lower() == "azurepolicy" and v.get("enabled") for k, v in result.get("addonProfiles", {}).items())), | ||
], | ||
) | ||
addon_list = self.cmd(list_cmd).get_output_in_json() | ||
|
||
assert len(addon_list) > 0 | ||
|
||
for addon in addon_list: | ||
assert not addon["enabled"] | ||
|
||
update_cmd = ( | ||
"aks aks --resource-group={resource_group} --name={name} " | ||
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. another typo? |
||
"--enable-addons azure-policy " | ||
) | ||
self.cmd( | ||
update_cmd, | ||
checks=[ | ||
self.check("provisioningState", "Succeeded"), | ||
# Case-insensitive check for azurePolicy and enabled=True | ||
self.assertTrue(any(k.lower() == "azurepolicy" and v.get("enabled") for k, v in result.get("addonProfiles", {}).items())) | ||
], | ||
) | ||
addon_list = self.cmd(list_cmd).get_output_in_json() | ||
|
||
assert len(addon_list) > 0 | ||
|
||
for addon in addon_list: | ||
if addon["name"] == "azure-policy": | ||
assert addon["enabled"] | ||
else: | ||
assert not addon["enabled"] | ||
|
||
@AllowLargeResponse() | ||
@AKSCustomResourceGroupPreparer( | ||
random_name_length=17, name_prefix="clitest", location="westcentralus" | ||
|
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
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.