Skip to content

Commit 0497b99

Browse files
author
Yitong Feng
committed
[AKS] Remove TrustedAccess commands in aks-preview
1 parent be61a0f commit 0497b99

File tree

10 files changed

+1
-2077
lines changed

10 files changed

+1
-2077
lines changed

src/aks-preview/HISTORY.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Pending
1818
* Update the `disable-egress-gateway` subcommand to fix `--help` output for the `az aks mesh` command.
1919
* Vendor new SDK and bump API version to 2025-01-02-preview.
2020
* Modify behavior for `--nodepool-initialization-taints` to ignore taints with hard effects on node pools with system mode when creating or updating a cluster.
21+
* Remove TrustedAccess commands from aks-preview extension as it is GA and exists in azure-cli for long time.
2122

2223
14.0.0b1
2324
+++++++

src/aks-preview/azext_aks_preview/_client_factory.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,6 @@ def get_mc_snapshots_client(cli_ctx, subscription_id=None):
6363
return get_container_service_client(cli_ctx, subscription_id=subscription_id).managed_cluster_snapshots
6464

6565

66-
def cf_trustedaccess_role(cli_ctx, *_):
67-
return get_container_service_client(cli_ctx).trusted_access_roles
68-
69-
70-
def cf_trustedaccess_role_binding(cli_ctx, *_):
71-
return get_container_service_client(cli_ctx).trusted_access_role_bindings
72-
73-
7466
def get_compute_client(cli_ctx, *_):
7567
return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_COMPUTE)
7668

src/aks-preview/azext_aks_preview/_help.py

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -2748,80 +2748,6 @@
27482748
short-summary: Delete a nodepool snapshot.
27492749
"""
27502750

2751-
helps['aks trustedaccess'] = """
2752-
type: group
2753-
short-summary: Commands to manage trusted access security features.
2754-
"""
2755-
2756-
helps['aks trustedaccess role'] = """
2757-
type: group
2758-
short-summary: Commands to manage trusted access roles.
2759-
"""
2760-
2761-
helps['aks trustedaccess role list'] = """
2762-
type: command
2763-
short-summary: List trusted access roles.
2764-
"""
2765-
2766-
helps['aks trustedaccess rolebinding'] = """
2767-
type: group
2768-
short-summary: Commands to manage trusted access role bindings.
2769-
"""
2770-
2771-
helps['aks trustedaccess rolebinding list'] = """
2772-
type: command
2773-
short-summary: List all the trusted access role bindings.
2774-
"""
2775-
2776-
helps['aks trustedaccess rolebinding show'] = """
2777-
type: command
2778-
short-summary: Get the specific trusted access role binding according to binding name.
2779-
parameters:
2780-
- name: --name -n
2781-
type: string
2782-
short-summary: Specify the role binding name.
2783-
"""
2784-
2785-
helps['aks trustedaccess rolebinding create'] = """
2786-
type: command
2787-
short-summary: Create a new trusted access role binding.
2788-
parameters:
2789-
- name: --name -n
2790-
type: string
2791-
short-summary: Specify the role binding name.
2792-
- name: --roles
2793-
type: string
2794-
short-summary: Specify the space-separated roles.
2795-
- name: --source-resource-id
2796-
type: string
2797-
short-summary: Specify the source resource id of the binding.
2798-
2799-
examples:
2800-
- name: Create a new trusted access role binding
2801-
text: az aks trustedaccess rolebinding create -g myResourceGroup --cluster-name myCluster -n bindingName --source-resource-id /subscriptions/0000/resourceGroups/myResourceGroup/providers/Microsoft.Demo/samples --roles Microsoft.Demo/samples/reader,Microsoft.Demo/samples/writer
2802-
"""
2803-
2804-
helps['aks trustedaccess rolebinding update'] = """
2805-
type: command
2806-
short-summary: Update a trusted access role binding.
2807-
parameters:
2808-
- name: --name -n
2809-
type: string
2810-
short-summary: Specify the role binding name.
2811-
- name: --roles
2812-
type: string
2813-
short-summary: Specify the space-separated roles.
2814-
"""
2815-
2816-
helps['aks trustedaccess rolebinding delete'] = """
2817-
type: command
2818-
short-summary: Delete a trusted access role binding according to name.
2819-
parameters:
2820-
- name: --name -n
2821-
type: string
2822-
short-summary: Specify the role binding name.
2823-
"""
2824-
28252751
helps['aks draft'] = """
28262752
type: group
28272753
short-summary: Commands to build deployment files in a project directory and deploy to an AKS cluster.

src/aks-preview/azext_aks_preview/_params.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2183,39 +2183,6 @@ def load_arguments(self, _):
21832183
action="store_true",
21842184
)
21852185

2186-
with self.argument_context("aks trustedaccess rolebinding") as c:
2187-
c.argument("cluster_name", help="The cluster name.")
2188-
2189-
for scope in [
2190-
"aks trustedaccess rolebinding show",
2191-
"aks trustedaccess rolebinding create",
2192-
"aks trustedaccess rolebinding update",
2193-
"aks trustedaccess rolebinding delete",
2194-
]:
2195-
with self.argument_context(scope) as c:
2196-
c.argument(
2197-
"role_binding_name",
2198-
options_list=["--name", "-n"],
2199-
required=True,
2200-
help="The role binding name.",
2201-
)
2202-
2203-
with self.argument_context("aks trustedaccess rolebinding create") as c:
2204-
c.argument(
2205-
"roles",
2206-
help="comma-separated roles: Microsoft.Demo/samples/reader,Microsoft.Demo/samples/writer,...",
2207-
)
2208-
c.argument(
2209-
"source_resource_id",
2210-
help="The source resource id of the binding",
2211-
)
2212-
2213-
with self.argument_context("aks trustedaccess rolebinding update") as c:
2214-
c.argument(
2215-
"roles",
2216-
help="comma-separated roles: Microsoft.Demo/samples/reader,Microsoft.Demo/samples/writer,...",
2217-
)
2218-
22192186
with self.argument_context("aks mesh enable-ingress-gateway") as c:
22202187
c.argument(
22212188
"ingress_gateway_type", arg_type=get_enum_type(ingress_gateway_types)

src/aks-preview/azext_aks_preview/commands.py

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
cf_managed_clusters,
1212
cf_mc_snapshots,
1313
cf_nodepool_snapshots,
14-
cf_trustedaccess_role,
15-
cf_trustedaccess_role_binding,
1614
cf_machines,
1715
cf_operations,
1816
)
@@ -125,18 +123,6 @@ def load_command_table(self, _):
125123
client_factory=cf_mc_snapshots,
126124
)
127125

128-
trustedaccess_role_sdk = CliCommandType(
129-
operations_tmpl="azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks."
130-
"operations._trusted_access_roles_operations#TrustedAccessRolesOperations.{}",
131-
client_factory=cf_trustedaccess_role,
132-
)
133-
134-
trustedaccess_role_binding_sdk = CliCommandType(
135-
operations_tmpl="azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks."
136-
"operations._trusted_access_role_bindings_operations#TrustedAccessRoleBindingsOperations.{}",
137-
client_factory=cf_trustedaccess_role_binding,
138-
)
139-
140126
# AKS managed cluster commands
141127
with self.command_group(
142128
"aks",
@@ -356,28 +342,6 @@ def load_command_table(self, _):
356342
g.custom_command("create", "aks_snapshot_create", supports_no_wait=True)
357343
g.custom_command("delete", "aks_snapshot_delete", supports_no_wait=True)
358344

359-
# AKS trusted access role commands
360-
with self.command_group(
361-
"aks trustedaccess role",
362-
trustedaccess_role_sdk,
363-
client_factory=cf_trustedaccess_role,
364-
) as g:
365-
g.custom_command("list", "aks_trustedaccess_role_list")
366-
367-
# AKS trusted access rolebinding commands
368-
with self.command_group(
369-
"aks trustedaccess rolebinding",
370-
trustedaccess_role_binding_sdk,
371-
client_factory=cf_trustedaccess_role_binding,
372-
) as g:
373-
g.custom_command("list", "aks_trustedaccess_role_binding_list")
374-
g.custom_show_command("show", "aks_trustedaccess_role_binding_get")
375-
g.custom_command("create", "aks_trustedaccess_role_binding_create")
376-
g.custom_command("update", "aks_trustedaccess_role_binding_update")
377-
g.custom_command(
378-
"delete", "aks_trustedaccess_role_binding_delete", confirmation=True
379-
)
380-
381345
# AKS mesh commands
382346
with self.command_group(
383347
"aks mesh", managed_clusters_sdk, client_factory=cf_managed_clusters

src/aks-preview/azext_aks_preview/custom.py

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2961,60 +2961,6 @@ def aks_nodepool_snapshot_list(cmd, client, resource_group_name=None): # pylint
29612961
return client.list_by_resource_group(resource_group_name)
29622962

29632963

2964-
def aks_trustedaccess_role_list(cmd, client, location): # pylint: disable=unused-argument
2965-
return client.list(location)
2966-
2967-
2968-
def aks_trustedaccess_role_binding_list(cmd, client, resource_group_name, cluster_name): # pylint: disable=unused-argument
2969-
return client.list(resource_group_name, cluster_name)
2970-
2971-
2972-
def aks_trustedaccess_role_binding_get(cmd, client, resource_group_name, cluster_name, role_binding_name):
2973-
return client.get(resource_group_name, cluster_name, role_binding_name)
2974-
2975-
2976-
def aks_trustedaccess_role_binding_create(cmd, client, resource_group_name, cluster_name, role_binding_name,
2977-
source_resource_id, roles):
2978-
TrustedAccessRoleBinding = cmd.get_models(
2979-
"TrustedAccessRoleBinding",
2980-
resource_type=CUSTOM_MGMT_AKS_PREVIEW,
2981-
operation_group="trusted_access_role_bindings",
2982-
)
2983-
existedBinding = None
2984-
try:
2985-
existedBinding = client.get(resource_group_name, cluster_name, role_binding_name)
2986-
except ResourceNotFoundError:
2987-
pass
2988-
2989-
if existedBinding:
2990-
raise Exception( # pylint: disable=broad-exception-raised
2991-
"TrustedAccess RoleBinding " +
2992-
role_binding_name +
2993-
" already existed, please use 'az aks trustedaccess rolebinding update' command to update!"
2994-
)
2995-
2996-
roleList = roles.split(',')
2997-
roleBinding = TrustedAccessRoleBinding(source_resource_id=source_resource_id, roles=roleList)
2998-
return client.begin_create_or_update(resource_group_name, cluster_name, role_binding_name, roleBinding)
2999-
3000-
3001-
def aks_trustedaccess_role_binding_update(cmd, client, resource_group_name, cluster_name, role_binding_name, roles):
3002-
TrustedAccessRoleBinding = cmd.get_models(
3003-
"TrustedAccessRoleBinding",
3004-
resource_type=CUSTOM_MGMT_AKS_PREVIEW,
3005-
operation_group="trusted_access_role_bindings",
3006-
)
3007-
existedBinding = client.get(resource_group_name, cluster_name, role_binding_name)
3008-
3009-
roleList = roles.split(',')
3010-
roleBinding = TrustedAccessRoleBinding(source_resource_id=existedBinding.source_resource_id, roles=roleList)
3011-
return client.begin_create_or_update(resource_group_name, cluster_name, role_binding_name, roleBinding)
3012-
3013-
3014-
def aks_trustedaccess_role_binding_delete(cmd, client, resource_group_name, cluster_name, role_binding_name):
3015-
return client.begin_delete(resource_group_name, cluster_name, role_binding_name)
3016-
3017-
30182964
def aks_mesh_enable(
30192965
cmd,
30202966
client,

0 commit comments

Comments
 (0)