Skip to content
Open
Show file tree
Hide file tree
Changes from 63 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
d418cda
Added namespace command in update aks
KarthikK123 Apr 27, 2022
4d19877
Added tests for namespace changes
KarthikK123 Apr 28, 2022
4d5cd56
Updated tests
KarthikK123 Apr 28, 2022
7ce1820
Updated tests
KarthikK123 Apr 28, 2022
61b22df
Updated tests
KarthikK123 Apr 29, 2022
40e4651
Added namespace resource in aks create and get-credentials
KarthikK123 Apr 25, 2022
5982c4a
Merge branch 'main' into kkanukollu/aks-namespaces
KarthikK123 May 4, 2022
29c8905
Added namespace sdk
KarthikK123 May 5, 2022
d27f8d7
Merge branch 'main' into kkanukollu/aks-namespaces
KarthikK123 May 5, 2022
0192946
Merge branch 'kkanukollu/aks-namespaces' of https://github.com/Karthi…
KarthikK123 May 5, 2022
965bff5
Removed accidental changes
KarthikK123 May 5, 2022
fd1ec44
Removed whitespace
KarthikK123 May 5, 2022
5793c61
Removed unnecessary changed
KarthikK123 May 5, 2022
bdabfcd
Removed whitespace diff
KarthikK123 May 5, 2022
89b0b0f
Added test recordings
May 9, 2022
814badc
Fixed linter issues
KarthikK123 May 9, 2022
7871739
Merge branch 'kkanukollu/aks-namespaces' of https://github.com/Karthi…
May 9, 2022
65878ff
Merge branch 'main' into kkanukollu/aks-namespaces
KarthikK123 May 9, 2022
0baf16a
Fixed static analysis errors
KarthikK123 May 9, 2022
1237f81
Merge branch 'kkanukollu/aks-namespaces' of https://github.com/Karthi…
KarthikK123 May 9, 2022
91a3aaa
Removed unnecessary import
KarthikK123 May 9, 2022
0500fba
Removed unnecessary options list
KarthikK123 May 9, 2022
225eff8
Added test for get-credentials at namespace scope
KarthikK123 May 11, 2022
e476791
adding test recording
KarthikK123 May 11, 2022
60592e6
Merge branch 'main' into kkanukollu/aks-namespaces
KarthikK123 May 12, 2022
084a702
updated test recordings
KarthikK123 May 12, 2022
db99792
trigger pipelines
KarthikK123 May 16, 2022
4d67bbf
Merge branch 'kkanukollu/aks-namespaces' of https://github.com/Karthi…
KarthikK123 May 16, 2022
0b491b5
Merge branch 'main' into kkanukollu/aks-namespaces
KarthikK123 May 16, 2022
48f6548
Updated test recordings
KarthikK123 May 16, 2022
436e88e
trigger tests
KarthikK123 May 17, 2022
b029f40
Merge branch 'Azure:main' into kkanukollu/aks-namespaces
KarthikK123 May 17, 2022
668d845
Merge branch 'main' into kkanukollu/aks-namespaces
KarthikK123 May 17, 2022
4474c95
Merge branch 'kkanukollu/aks-namespaces' of https://github.com/Karthi…
KarthikK123 May 17, 2022
21cde94
Removed breaking changes
KarthikK123 May 17, 2022
e97c914
trigger pipeline
KarthikK123 May 17, 2022
58ef7f3
Updated help message for param
KarthikK123 May 18, 2022
17c8a72
Merge branch 'main' into kkanukollu/aks-namespaces
KarthikK123 May 18, 2022
d5fef40
Added tests to exclude because of feature flag registration
KarthikK123 May 18, 2022
d9003e9
Merge branch 'kkanukollu/aks-namespaces' of https://github.com/Karthi…
KarthikK123 May 18, 2022
b9f3f14
updated test recordings
KarthikK123 May 18, 2022
13433ec
Merge branch 'main' into kkanukollu/aks-namespaces
KarthikK123 May 18, 2022
c7cb557
Updated test recordings
KarthikK123 May 19, 2022
e57e811
Updated tests
KarthikK123 May 19, 2022
597fe38
Merge branch 'kkanukollu/aks-namespaces' of https://github.com/Karthi…
KarthikK123 May 19, 2022
4d17d8d
Updated test recording
KarthikK123 May 19, 2022
903aec0
Updated tests
KarthikK123 May 19, 2022
8c66662
Updated test recordings
KarthikK123 May 19, 2022
a1b0671
Merge branch 'main' into kkanukollu/aks-namespaces
KarthikK123 May 20, 2022
e628697
Updated test recordings
KarthikK123 May 20, 2022
f719b8f
Merge branch 'main' into kkanukollu/aks-namespaces
KarthikK123 May 20, 2022
fc3482b
Updated test recordings
KarthikK123 May 20, 2022
152bb95
Merge branch 'main' into kkanukollu/aks-namespaces
KarthikK123 Jun 6, 2022
b2ac00a
Added option to disable namespace resource
KarthikK123 Jun 6, 2022
b45b6ba
Merge branch 'kkanukollu/aks-namespaces' of https://github.com/Karthi…
KarthikK123 Jun 6, 2022
764ccbd
Fixed linter issue
KarthikK123 Jun 6, 2022
3e681b9
Removed accidental changes
KarthikK123 Jun 6, 2022
c62d51e
updated test recordings
KarthikK123 Jun 7, 2022
d0bc4b1
Updated test to cover disable-namespace command
KarthikK123 Jun 7, 2022
417c873
Merge branch 'kkanukollu/aks-namespaces' of https://github.com/Karthi…
KarthikK123 Jun 7, 2022
ead3b59
Updated test recordings
KarthikK123 Jun 7, 2022
f5ce8b1
Updated help messages
KarthikK123 Jun 8, 2022
6bddded
Merge branch 'kkanukollu/aks-namespaces' of https://github.com/Karthi…
KarthikK123 Jun 8, 2022
d038834
Updated help message
KarthikK123 Jun 8, 2022
5949011
Merge branch 'main' into kkanukollu/aks-namespaces
KarthikK123 Jun 15, 2022
63733c5
Addressed review comments
KarthikK123 Jul 7, 2022
be32baa
Merge branch 'main' into kkanukollu/aks-namespaces
KarthikK123 Jul 7, 2022
bbdb72f
Updated test recordings
KarthikK123 Jul 7, 2022
cbf966a
Updated test to allow mocking of sleep
KarthikK123 Jul 8, 2022
2224f0e
Added validation for mutually exclusive parameters
KarthikK123 Jul 11, 2022
c2815de
Updated tests
KarthikK123 Jul 11, 2022
eeb650b
Updated test recordings
KarthikK123 Jul 11, 2022
282ca45
Moved validation to validators.py
KarthikK123 Jul 12, 2022
8746571
Fixed static analysis error
KarthikK123 Jul 12, 2022
8da5bca
Fixed static analysis error
KarthikK123 Jul 12, 2022
ea89244
Fixed static analysis error
KarthikK123 Jul 12, 2022
9bd067b
Merge branch 'main' into kkanukollu/aks-namespaces
KarthikK123 Oct 26, 2022
de088df
Merge branch 'main' into kkanukollu/aks-namespaces
KarthikK123 Jan 24, 2023
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 @@ -29,7 +29,10 @@
"test_list_trustedaccess_roles",
"test_aks_custom_ca_trust_flow",
"test_aks_create_with_csi_driver_v2",
"test_aks_create_and_update_csi_driver_to_v2"
"test_aks_create_and_update_csi_driver_to_v2",
"test_aks_create_with_namespace_enabled",
"test_aks_update_enable_namespace",
"test_aks_get_credentials_at_namespace_scope"
],
"fixed, waiting for rp rollout": [
"test_aks_create_with_azurekeyvaultkms",
Expand Down
4 changes: 4 additions & 0 deletions src/aks-preview/azext_aks_preview/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ def load_arguments(self, _):
c.argument('message_of_the_day')
c.argument('gpu_instance_profile', arg_type=get_enum_type(gpu_instance_profiles))
c.argument('workload_runtime', arg_type=get_enum_type(workload_runtimes), default=CONST_WORKLOAD_RUNTIME_OCI_CONTAINER)
c.argument('enable_namespace_resources', help='Enables sync of namespaces as Azure Resource Manager resources')
c.argument('enable_apiserver_vnet_integration', action='store_true', is_preview=True)
c.argument('apiserver_subnet_id', validator=validate_apiserver_subnet_id, is_preview=True)
c.argument('dns-zone-resource-id')
Expand Down Expand Up @@ -379,6 +380,8 @@ def load_arguments(self, _):
c.argument('enable_oidc_issuer', action='store_true', is_preview=True)
c.argument('enable_azure_keyvault_kms', action='store_true', is_preview=True)
c.argument('azure_keyvault_kms_key_id', validator=validate_azure_keyvault_kms_key_id, is_preview=True)
c.argument('enable_namespace_resources', help='Enables sync of namespaces as Azure Resource Manager resources')
c.argument('disable_namespace_resources', help='Disables sync of namespaces as Azure Resource Manager resources')
c.argument('enable_apiserver_vnet_integration', action='store_true', is_preview=True)
c.argument('apiserver_subnet_id', validator=validate_apiserver_subnet_id, is_preview=True)
c.argument('enable_keda', action='store_true', is_preview=True)
Expand Down Expand Up @@ -596,6 +599,7 @@ def load_arguments(self, _):
default=os.path.join(os.path.expanduser('~'), '.kube', 'config'))
c.argument('public_fqdn', default=False, action='store_true')
c.argument('credential_format', options_list=['--format'], arg_type=get_enum_type(credential_formats))
c.argument('namespace_name', options_list=['--namespace'], help='If specified, the credentials are returned at the namespace scope, assuming the user has access to the ARM resource for that namespace.')

with self.argument_context('aks pod-identity') as c:
c.argument('cluster_name', help='The cluster name.')
Expand Down
20 changes: 17 additions & 3 deletions src/aks-preview/azext_aks_preview/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,8 @@ def aks_create(cmd,
dns_zone_resource_id=None,
enable_custom_ca_trust=False,
enable_keda=False,
yes=False):
yes=False,
enable_namespace_resources=False):
# DO NOT MOVE: get all the original parameters and save them as a dictionary
raw_parameters = locals()

Expand Down Expand Up @@ -914,6 +915,8 @@ def aks_update(cmd, # pylint: disable=too-many-statements,too-many-branches,
apiserver_subnet_id=None,
enable_keda=False,
disable_keda=False,
enable_namespace_resources=False,
disable_namespace_resources=False
):
# DO NOT MOVE: get all the original parameters and save them as a dictionary
raw_parameters = locals()
Expand Down Expand Up @@ -975,6 +978,7 @@ def aks_get_credentials(cmd, # pylint: disable=unused-argument
client,
resource_group_name,
name,
namespace_name=None,
admin=False,
user='clusterUser',
path=os.path.join(os.path.expanduser(
Expand All @@ -992,12 +996,22 @@ def aks_get_credentials(cmd, # pylint: disable=unused-argument
if admin:
raise InvalidArgumentValueError("--format can only be specified when requesting clusterUser credential.")
if admin:
if namespace_name is not None:
raise InvalidArgumentValueError("--namespace is not valid for admin credentials")
credentialResults = client.list_cluster_admin_credentials(
resource_group_name, name, serverType)
else:
if user.lower() == 'clusteruser':
credentialResults = client.list_cluster_user_credentials(
resource_group_name, name, serverType, credential_format)
if namespace_name is not None:
from azext_aks_preview.vendored_sdks.namespace_client import NamespaceClient
from azure.cli.core.commands.client_factory import get_mgmt_service_client

client = get_mgmt_service_client(cmd.cli_ctx, NamespaceClient)
credentialResults = client.list_user_credential(resource_group_name, "Microsoft.ContainerService", "managedClusters", name, namespace_name)

else:
credentialResults = client.list_cluster_user_credentials(
resource_group_name, name, serverType, credential_format)
elif user.lower() == 'clustermonitoringuser':
credentialResults = client.list_cluster_monitoring_user_credentials(
resource_group_name, name, serverType)
Expand Down
24 changes: 22 additions & 2 deletions src/aks-preview/azext_aks_preview/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2627,6 +2627,15 @@ def set_up_azure_keyvault_kms(self, mc: ManagedCluster) -> ManagedCluster:

return mc

def set_up_enable_namespace_resource(self, mc: ManagedCluster) -> ManagedCluster:
"""Sets the property to enable namespace as an ARM resource

:return: the ManagedCluster object
"""
if self.context.raw_param.get("enable_namespace_resources"):
mc.enable_namespace_resources = True
return mc

def set_up_api_server_access_profile(self, mc: ManagedCluster) -> ManagedCluster:
"""Set up apiserverAccessProfile enableVnetIntegration and subnetId for the ManagedCluster object.

Expand Down Expand Up @@ -2684,7 +2693,7 @@ def construct_mc_preview_profile(self) -> ManagedCluster:

mc = self.set_up_azure_keyvault_kms(mc)
mc = self.set_up_creationdata_of_cluster_snapshot(mc)

mc = self.set_up_enable_namespace_resource(mc)
mc = self.set_up_storage_profile(mc)

mc = self.set_up_workload_auto_scaler_profile(mc)
Expand Down Expand Up @@ -3032,6 +3041,17 @@ def update_azure_keyvault_kms(self, mc: ManagedCluster) -> ManagedCluster:

return mc

def update_enable_namespace_resources(self, mc: ManagedCluster) -> ManagedCluster:
"""Sets the property to enable namespace as an ARM resource

:return: the ManagedCluster object
"""
if self.context.raw_param.get("enable_namespace_resources"):
mc.enable_namespace_resources = True
elif self.context.raw_param.get("disable_namespace_resources"):
mc.enable_namespace_resources = False
return mc

def update_storage_profile(self, mc: ManagedCluster) -> ManagedCluster:
"""Update storage profile for the ManagedCluster object.

Expand Down Expand Up @@ -3142,9 +3162,9 @@ def update_mc_preview_profile(self) -> ManagedCluster:

mc = self.update_http_proxy_config(mc)
mc = self.update_azure_keyvault_kms(mc)
mc = self.update_enable_namespace_resources(mc)
# update identity profile
mc = self.update_identity_profile(mc)

mc = self.update_storage_profile(mc)

mc = self.update_workload_auto_scaler_profile(mc)
Expand Down
Loading