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: bug fix about not report error when existing cluster is already vnet integrated #5387

Merged
merged 1 commit into from
Sep 27, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -1281,10 +1281,11 @@ def _get_enable_apiserver_vnet_integration(self, enable_validation: bool = False
# validation
if enable_validation:
if self.decorator_mode == DecoratorMode.UPDATE:
if enable_apiserver_vnet_integration:
is_apiserver_vnet_integration_cluster = check_is_apiserver_vnet_integration_cluster(self.mc)
if enable_apiserver_vnet_integration and not is_apiserver_vnet_integration_cluster:
if self._get_apiserver_subnet_id(enable_validation=False) is None:
raise RequiredArgumentMissingError(
"--apiserver-subnet-id is required for update with --apiserver-vnet-integration."
"--apiserver-subnet-id is required for update with --enable-apiserver-vnet-integration."
)

return enable_apiserver_vnet_integration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2163,6 +2163,24 @@ def test_get_enable_apiserver_vnet_integration(self):
with self.assertRaises(RequiredArgumentMissingError):
ctx_5.get_enable_apiserver_vnet_integration()


ctx_6 = AKSPreviewManagedClusterContext(
self.cmd,
AKSManagedClusterParamDict({
"enable_apiserver_vnet_integration": True,
}),
self.models,
decorator_mode=DecoratorMode.UPDATE,
)
api_server_access_profile = self.models.ManagedClusterAPIServerAccessProfile()
api_server_access_profile.enable_vnet_integration = True
mc = self.models.ManagedCluster(
location="test_location",
api_server_access_profile=api_server_access_profile,
)
ctx_6.attach_mc(mc)
self.assertEqual(ctx_6.get_enable_apiserver_vnet_integration(), True)

def test_get_apiserver_subnet_id(self):
ctx_0 = AKSPreviewManagedClusterContext(
self.cmd,
Expand Down