Skip to content
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
4 changes: 4 additions & 0 deletions src/aks-preview/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ To release a new version, please select a new version number (usually plus 1 to
Pending
+++++++

18.0.0b10
+++++++
* Wrap the ARG call in the managed namespace list command

18.0.0b9
+++++++
* Add `--max-blocked-nodes` to the `az aks nodepool add/update/upgrade` commands.
Expand Down
37 changes: 22 additions & 15 deletions src/aks-preview/azext_aks_preview/_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,28 @@ def aks_namespace_list_table_format(results):


def _aks_namespace_list_table_format(result):
parsed = compile_jmes("""{
name: name,
tags: to_string(tags),
provisioningState: to_string(properties.provisioningState),
labels: to_string(properties.labels),
annotations: to_string(properties.annotations),
cpuRequest: to_string(properties.defaultResourceQuota.cpuRequest),
cpuLimit: to_string(properties.defaultResourceQuota.cpuLimit),
memoryRequest: to_string(properties.defaultResourceQuota.memoryRequest),
memoryLimit: to_string(properties.defaultResourceQuota.memoryLimit),
ingress: to_string(properties.defaultNetworkPolicy.ingress),
egress: to_string(properties.defaultNetworkPolicy.egress),
adoptionPolicy: to_string(properties.adoptionPolicy),
deletePolicy: to_string(properties.deletePolicy)
}""")
if not result.get("properties"):
parsed = compile_jmes("""{
name: name,
resourceGroup: resourceGroup,
location: location
}""")
else:
parsed = compile_jmes("""{
name: name,
tags: to_string(tags),
provisioningState: to_string(properties.provisioningState),
labels: to_string(properties.labels),
annotations: to_string(properties.annotations),
cpuRequest: to_string(properties.defaultResourceQuota.cpuRequest),
cpuLimit: to_string(properties.defaultResourceQuota.cpuLimit),
memoryRequest: to_string(properties.defaultResourceQuota.memoryRequest),
memoryLimit: to_string(properties.defaultResourceQuota.memoryLimit),
ingress: to_string(properties.defaultNetworkPolicy.ingress),
egress: to_string(properties.defaultNetworkPolicy.egress),
adoptionPolicy: to_string(properties.adoptionPolicy),
deletePolicy: to_string(properties.deletePolicy)
}""")
# use ordered dicts so headers are predictable
return parsed.search(result, Options(dict_cls=OrderedDict))

Expand Down
21 changes: 17 additions & 4 deletions src/aks-preview/azext_aks_preview/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@
ValidationError,
)
from azure.cli.core.commands import LongRunningOperation
from azure.cli.core.commands.client_factory import get_subscription_id
from azure.cli.core.commands.client_factory import (
get_subscription_id,
get_mgmt_service_client,
)
from azure.cli.core.profiles import ResourceType
from azure.cli.core.util import (
in_cloud_console,
Expand Down Expand Up @@ -326,10 +329,20 @@ def aks_namespace_show(
def aks_namespace_list(
cmd, # pylint: disable=unused-argument
client,
resource_group_name,
cluster_name
resource_group_name=None,
cluster_name=None,
):
return client.list_by_managed_cluster(resource_group_name, cluster_name)
if resource_group_name and cluster_name:
return client.list_by_managed_cluster(resource_group_name, cluster_name)
rcf = get_mgmt_service_client(cmd.cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES)
full_resource_type = "Microsoft.ContainerService/managedClusters/managedNamespaces"
filters = [f"resourceType eq '{full_resource_type}'"]
if resource_group_name:
filters.append(f"resourceGroup eq '{resource_group_name}'")
odata_filter = " and ".join(filters)
expand = "createdTime,changedTime,provisioningState"
resources = rcf.resources.list(filter=odata_filter, expand=expand)
return list(resources)


def aks_namespace_delete(
Expand Down
Loading
Loading