Skip to content

Commit b5b9b6f

Browse files
author
audrastump
committed
update
1 parent da6049f commit b5b9b6f

8 files changed

Lines changed: 401 additions & 76 deletions

File tree

src/fleet/azext_fleet/_client_factory.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,14 @@ def cf_fleet_members(cli_ctx, *_):
2525
return get_container_service_client(cli_ctx).fleet_members
2626

2727

28-
def cf_gates(cli_ctx, *_):
29-
return get_container_service_client(cli_ctx).gates
28+
def cf_managed_namespaces(cli_ctx, *_):
29+
return get_container_service_client(cli_ctx).fleet_managed_namespaces
3030

3131

32+
# Gates functionality - will be available when API supports gates
33+
# def cf_gates(cli_ctx, *_):
34+
# return get_container_service_client(cli_ctx).gates
35+
3236
def cf_update_runs(cli_ctx, *_):
3337
return get_container_service_client(cli_ctx).update_runs
3438

src/fleet/azext_fleet/_help.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,3 +432,67 @@
432432
- name: Approves a gate.
433433
text: az fleet gate approve -g MyFleetResourceGroup --fleet-name MyFleetName --gate-name 3fa85f64-5717-4562-b3fc-2c963f66afa6
434434
"""
435+
436+
helps['fleet managednamespace'] = """
437+
type: group
438+
short-summary: Commands to manage managed namespaces.
439+
"""
440+
441+
helps['fleet managednamespace create'] = """
442+
type: command
443+
short-summary: Creates or updates a managed namespace.
444+
parameters:
445+
- name: --namespace-name
446+
type: string
447+
short-summary: The name of the Kubernetes namespace to be created on member clusters.
448+
- name: --labels
449+
type: string
450+
short-summary: Labels to apply to the managed namespace.
451+
- name: --annotations
452+
type: string
453+
short-summary: Annotations to apply to the managed namespace.
454+
examples:
455+
- name: Create a managed namespace.
456+
text: az fleet managednamespace create -g MyFleetResourceGroup -f MyFleetName -n MyManagedNamespace --namespace-name my-namespace
457+
- name: Create a managed namespace with labels and annotations.
458+
text: az fleet managednamespace create -g MyFleetResourceGroup -f MyFleetName -n MyManagedNamespace --namespace-name my-namespace --labels env=production team=devops --annotations description="Production namespace"
459+
"""
460+
461+
helps['fleet managednamespace update'] = """
462+
type: command
463+
short-summary: Update a managed namespace.
464+
parameters:
465+
- name: --labels
466+
type: string
467+
short-summary: Labels to apply to the managed namespace.
468+
- name: --annotations
469+
type: string
470+
short-summary: Annotations to apply to the managed namespace.
471+
examples:
472+
- name: Update a managed namespace's labels.
473+
text: az fleet managednamespace update -g MyFleetResourceGroup -f MyFleetName -n my-namespace --labels env=staging
474+
"""
475+
476+
helps['fleet managednamespace list'] = """
477+
type: command
478+
short-summary: Lists a fleet's managed namespaces.
479+
examples:
480+
- name: List all managed namespaces for a given fleet.
481+
text: az fleet managednamespace list -g MyFleetResourceGroup -f MyFleetName
482+
"""
483+
484+
helps['fleet managednamespace show'] = """
485+
type: command
486+
short-summary: Gets a fleet managed namespace.
487+
examples:
488+
- name: Show the details of a specific managed namespace.
489+
text: az fleet managednamespace show -g MyFleetResourceGroup -f MyFleetName -n my-namespace
490+
"""
491+
492+
helps['fleet managednamespace delete'] = """
493+
type: command
494+
short-summary: Deletes a fleet managed namespace.
495+
examples:
496+
- name: Delete a specific managed namespace.
497+
text: az fleet managednamespace delete -g MyFleetResourceGroup -f MyFleetName -n my-namespace
498+
"""

src/fleet/azext_fleet/_params.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,26 @@ def load_arguments(self, _):
172172
c.argument('resource_group_name', options_list=['--resource-group', '-g'], help='Name of the resource group.')
173173
c.argument('fleet_name', options_list=['--fleet-name', '-f'], help='Name of the fleet.')
174174
c.argument('gate_name', options_list=['--gate-name', '--gate', '-n'], help='Name of the gate.')
175+
176+
# Fleet managed namespace arguments
177+
with self.argument_context('fleet managednamespace') as c:
178+
c.argument('resource_group_name', options_list=['--resource-group', '-g'], help='Name of the resource group.')
179+
c.argument('fleet_name', options_list=['--fleet-name', '-f'], help='Name of the fleet.')
180+
c.argument('managed_namespace_name', options_list=['--name', '-n'], help='Name of the managed namespace.')
181+
182+
with self.argument_context('fleet managednamespace create') as c:
183+
c.argument('labels', labels_type, help='Labels to apply to the managed namespace.')
184+
c.argument('annotations', type=validate_labels, metavar='KEY=VALUE', help='Annotations to apply to the managed namespace: key[=value] [key[=value] ...].')
185+
186+
with self.argument_context('fleet managednamespace update') as c:
187+
c.argument('labels', labels_type, help='Labels to apply to the managed namespace.')
188+
c.argument('annotations', type=validate_labels, metavar='KEY=VALUE', help='Annotations to apply to the managed namespace: key[=value] [key[=value] ...].')
189+
190+
with self.argument_context('fleet managednamespace delete') as c:
191+
pass
192+
193+
with self.argument_context('fleet managednamespace show') as c:
194+
pass
195+
196+
with self.argument_context('fleet managednamespace list') as c:
197+
pass

src/fleet/azext_fleet/commands.py

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
cf_fleet_update_strategies,
1313
cf_auto_upgrade_profiles,
1414
cf_auto_upgrade_profile_operations,
15-
cf_gates
15+
cf_managed_namespaces
16+
#cf_gates
1617
)
1718

1819

@@ -30,6 +31,12 @@ def load_command_table(self, _):
3031
client_factory=cf_fleet_members
3132
)
3233

34+
fleet_namespaces_sdk = CliCommandType(
35+
operations_tmpl="azext_fleet.vendored_sdks.operations._fleet_members_operations#FleetManagedNamespacesOperations.{}",
36+
operation_group="fleet_managed_namespaces",
37+
client_factory=cf_managed_namespaces
38+
)
39+
3340
update_runs_sdk = CliCommandType(
3441
operations_tmpl="azext_fleet.vendored_sdks.operations._update_runs_operations#UpdateRunsOperations.{}",
3542
operation_group="update_runs",
@@ -54,11 +61,11 @@ def load_command_table(self, _):
5461
client_factory=cf_auto_upgrade_profile_operations
5562
)
5663

57-
gates_sdk = CliCommandType(
58-
operations_tmpl="azext_fleet.vendored_sdks.operations._gates_operations#GatesOperations.{}",
59-
operation_group="gates",
60-
client_factory=cf_gates
61-
)
64+
#gates_sdk = CliCommandType(
65+
# operations_tmpl="azext_fleet.vendored_sdks.operations._gates_operations#GatesOperations.{}",
66+
# operation_group="gates",
67+
# client_factory=cf_gates
68+
#)
6269

6370
# fleets command group
6471
with self.command_group("fleet", fleets_sdk, client_factory=cf_fleets) as g:
@@ -81,6 +88,15 @@ def load_command_table(self, _):
8188
g.custom_command("reconcile", "reconcile_fleet_member", supports_no_wait=True)
8289
g.wait_command("wait")
8390

91+
# fleet managed namespaces command group
92+
with self.command_group("fleet managednamespace", managed_namespaces_sdk, client_factory=cf_managed_namespaces) as g:
93+
g.custom_command("create", "create_managed_namespace", supports_no_wait=True)
94+
g.custom_command("update", "update_managed_namespace", supports_no_wait=True)
95+
g.custom_command("delete", "delete_managed_namespace", supports_no_wait=True, confirmation=True)
96+
g.custom_command("list", "list_managed_namespaces")
97+
g.custom_show_command("show", "show_managed_namespace")
98+
g.wait_command("wait")
99+
84100
# fleet update runs command group
85101
with self.command_group("fleet updaterun", update_runs_sdk, client_factory=cf_update_runs) as g:
86102
g.custom_command("create", "create_update_run", supports_no_wait=True)
@@ -113,8 +129,8 @@ def load_command_table(self, _):
113129
g.custom_command("generate-update-run", "generate_update_run", supports_no_wait=True)
114130

115131
# fleet gates command group
116-
with self.command_group("fleet gate", gates_sdk, client_factory=cf_gates) as g:
117-
g.custom_command("list", "list_gates_by_fleet")
118-
g.custom_show_command("show", "show_gate")
119-
g.custom_command("update", "update_gate")
120-
g.custom_command("approve", "approve_gate")
132+
#with self.command_group("fleet gate", gates_sdk, client_factory=cf_gates) as g:
133+
# g.custom_command("list", "list_gates_by_fleet")
134+
# g.custom_show_command("show", "show_gate")
135+
# g.custom_command("update", "update_gate")
136+
# g.custom_command("approve", "approve_gate")

src/fleet/azext_fleet/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
UPGRADE_TYPE_NODEIMAGEONLY = "NodeImageOnly"
99
FLEET_1P_APP_ID = "609d2f62-527f-4451-bfd2-ac2c7850822c"
1010

11-
SUPPORTED_GATE_STATES_FILTERS = ["Pending", "Skipped", "Completed"]
12-
SUPPORTED_GATE_STATES_PATCH = ["Completed"]
11+
#SUPPORTED_GATE_STATES_FILTERS = ["Pending", "Skipped", "Completed"]
12+
#SUPPORTED_GATE_STATES_PATCH = ["Completed"]
1313

1414
UPGRADE_TYPE_ERROR_MESSAGES = {
1515
UPGRADE_TYPE_CONTROLPLANEONLY: f"Please set kubernetes version when upgrade type is '{UPGRADE_TYPE_CONTROLPLANEONLY}'.", # pylint: disable=line-too-long

0 commit comments

Comments
 (0)