Skip to content

Commit

Permalink
[AKS] Remove warning message when using "BYO vnet + system MSI" (#23080)
Browse files Browse the repository at this point in the history
  • Loading branch information
norshtein authored Jul 12, 2022
1 parent 63f9c99 commit 0782ea6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4127,21 +4127,6 @@ def process_add_role_assignment_for_vnet_subnet(self, mc: ManagedCluster) -> Non
service_principal_profile = mc.service_principal_profile
assign_identity = self.context.get_assign_identity()
if service_principal_profile is None and not assign_identity:
msg = (
"It is highly recommended to use USER assigned identity "
"(option --assign-identity) when you want to bring your own"
"subnet, which will have no latency for the role assignment to "
"take effect. When using SYSTEM assigned identity, "
"azure-cli will grant Network Contributor role to the "
"system assigned identity after the cluster is created, and "
"the role assignment will take some time to take effect, see "
"https://docs.microsoft.com/azure/aks/use-managed-identity, "
"proceed to create cluster with system assigned identity?"
)
if not self.context.get_yes() and not prompt_y_n(
msg, default="n"
):
raise DecoratorEarlyExitException()
need_post_creation_vnet_permission_granting = True
else:
scope = vnet_subnet_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4356,16 +4356,11 @@ def test_process_add_role_assignment_for_vnet_subnet(self):
with patch(
"azure.cli.command_modules.acs.managed_cluster_decorator.subnet_role_assignment_exists",
return_value=False,
), patch(
"azure.cli.command_modules.acs.managed_cluster_decorator.prompt_y_n",
return_value=False,
):
# fail on user does not confirm
with self.assertRaises(DecoratorEarlyExitException):
dec_3.process_add_role_assignment_for_vnet_subnet(mc_3)
dec_3.process_add_role_assignment_for_vnet_subnet(mc_3)
self.assertEqual(
dec_3.context.get_intermediate("need_post_creation_vnet_permission_granting"),
None,
True,
)

# custom value
Expand Down

0 comments on commit 0782ea6

Please sign in to comment.