Skip to content

Commit

Permalink
[containerapp] az containerapp add-on create: Support add-on commands…
Browse files Browse the repository at this point in the history
…; deprecation of service commands (#6960)
  • Loading branch information
bgashirabake committed Nov 10, 2023
1 parent d0d073d commit fbb8641
Show file tree
Hide file tree
Showing 7 changed files with 35,687 additions and 9,792 deletions.
1 change: 1 addition & 0 deletions src/containerapp/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Release History
===============
upcoming
++++++
* 'az containerapp add-on': support for az containerapp add-on commands; deprecation of az containerapp service commands
* 'az containerapp env create': Support --enable-dedicated-gpu
* 'az containerapp job create': fix problem of parsing parameters minExecutions and maxExecutions from --yaml
* 'az containerapp env dapr-component init': support initializing Dapr components and dev services for an environment
Expand Down
86 changes: 86 additions & 0 deletions src/containerapp/azext_containerapp/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,24 @@
helps['containerapp service'] = """
type: group
short-summary: Commands to manage services available within the environment.
deprecate_info: This command group is deprecated. Use 'az containerapp add-on' instead.
"""

helps['containerapp add-on'] = """
type: group
short-summary: Commands to manage add-ons available within the environment.
"""

helps['containerapp service list'] = """
type: command
short-summary: List all services within the environment.
"""

helps['containerapp add-on list'] = """
type: command
short-summary: List all add-ons within the environment.
"""

helps['containerapp service redis'] = """
type: group
short-summary: Commands to manage the redis service for the Container Apps environment.
Expand Down Expand Up @@ -190,6 +201,81 @@
short-summary: Command to delete the qdrant service.
"""

helps['containerapp add-on redis'] = """
type: group
short-summary: Commands to manage the redis add-on for the Container Apps environment.
"""

helps['containerapp add-on postgres'] = """
type: group
short-summary: Commands to manage the postgres add-on for the Container Apps environment.
"""

helps['containerapp add-on kafka'] = """
type: group
short-summary: Commands to manage the kafka add-on for the Container Apps environment.
"""

helps['containerapp add-on mariadb'] = """
type: group
short-summary: Commands to manage the mariadb add-on for the Container Apps environment.
"""

helps['containerapp add-on qdrant'] = """
type: group
short-summary: Commands to manage the qdrant add-on for the Container Apps environment.
"""

helps['containerapp add-on redis create'] = """
type: command
short-summary: Command to create the redis add-on.
"""

helps['containerapp add-on postgres create'] = """
type: command
short-summary: Command to create the postgres add-on.
"""

helps['containerapp add-on kafka create'] = """
type: command
short-summary: Command to create the kafka add-on.
"""

helps['containerapp add-on mariadb create'] = """
type: command
short-summary: Command to create the mariadb add-on.
"""

helps['containerapp add-on qdrant create'] = """
type: command
short-summary: Command to create the qdrant add-on.
"""

helps['containerapp add-on redis delete'] = """
type: command
short-summary: Command to delete the redis add-on.
"""

helps['containerapp add-on postgres delete'] = """
type: command
short-summary: Command to delete the postgres add-on.
"""

helps['containerapp add-on kafka delete'] = """
type: command
short-summary: Command to delete the kafka add-on.
"""

helps['containerapp add-on mariadb delete'] = """
type: command
short-summary: Command to delete the mariadb add-on.
"""

helps['containerapp add-on qdrant delete'] = """
type: command
short-summary: Command to delete the qdrant add-on.
"""

helps['containerapp env update'] = """
type: command
short-summary: Update a Container Apps environment.
Expand Down
5 changes: 5 additions & 0 deletions src/containerapp/azext_containerapp/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ def load_arguments(self, _):
c.argument('environment_name', options_list=['--environment'], help="The environment name.")
c.argument('resource_group_name', arg_type=resource_group_name_type, id_part=None)

with self.argument_context('containerapp add-on') as c:
c.argument('service_name', options_list=['--name', '-n'], help="The service name.")
c.argument('environment_name', options_list=['--environment'], help="The environment name.")
c.argument('resource_group_name', arg_type=resource_group_name_type, id_part=None)

with self.argument_context('containerapp env create') as c:
c.argument('enable_workload_profiles', arg_type=get_three_state_flag(), options_list=["--enable-workload-profiles", "-w"], help="Boolean indicating if the environment is enabled to have workload profiles")
c.argument('enable_dedicated_gpu', arg_type=get_three_state_flag(), options_list=["--enable-dedicated-gpu"],
Expand Down
35 changes: 29 additions & 6 deletions src/containerapp/azext_containerapp/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,49 @@ def load_command_table(self, _):
with self.command_group('containerapp env dapr-component') as g:
g.custom_command('init', 'init_dapr_components', is_preview=True)

with self.command_group('containerapp service', is_preview=True) as g:
with self.command_group('containerapp service', deprecate_info=self.deprecate(redirect='containerapp add-on', hide=True), is_preview=True) as g:
g.custom_command('list', 'list_all_services')

with self.command_group('containerapp service redis') as g:
with self.command_group('containerapp add-on', is_preview=True) as g:
g.custom_command('list', 'list_all_services')

with self.command_group('containerapp service redis', deprecate_info=self.deprecate(redirect='containerapp add-on redis', hide=True)) as g:
g.custom_command('create', 'create_redis_service', supports_no_wait=True)
g.custom_command('delete', 'delete_redis_service', confirmation=True, supports_no_wait=True)

with self.command_group('containerapp add-on redis') as g:
g.custom_command('create', 'create_redis_service', supports_no_wait=True)
g.custom_command('delete', 'delete_redis_service', confirmation=True, supports_no_wait=True)

with self.command_group('containerapp service postgres') as g:
with self.command_group('containerapp service postgres', deprecate_info=self.deprecate(redirect='containerapp add-on postgres', hide=True)) as g:
g.custom_command('create', 'create_postgres_service', supports_no_wait=True)
g.custom_command('delete', 'delete_postgres_service', confirmation=True, supports_no_wait=True)

with self.command_group('containerapp service kafka') as g:
with self.command_group('containerapp add-on postgres') as g:
g.custom_command('create', 'create_postgres_service', supports_no_wait=True)
g.custom_command('delete', 'delete_postgres_service', confirmation=True, supports_no_wait=True)

with self.command_group('containerapp service kafka', deprecate_info=self.deprecate(redirect='containerapp add-on kafka', hide=True)) as g:
g.custom_command('create', 'create_kafka_service', supports_no_wait=True)
g.custom_command('delete', 'delete_kafka_service', confirmation=True, supports_no_wait=True)

with self.command_group('containerapp service mariadb') as g:
with self.command_group('containerapp add-on kafka') as g:
g.custom_command('create', 'create_kafka_service', supports_no_wait=True)
g.custom_command('delete', 'delete_kafka_service', confirmation=True, supports_no_wait=True)

with self.command_group('containerapp service mariadb', deprecate_info=self.deprecate(redirect='containerapp add-on mariadb', hide=True)) as g:
g.custom_command('create', 'create_mariadb_service', supports_no_wait=True)
g.custom_command('delete', 'delete_mariadb_service', confirmation=True, supports_no_wait=True)

with self.command_group('containerapp add-on mariadb') as g:
g.custom_command('create', 'create_mariadb_service', supports_no_wait=True)
g.custom_command('delete', 'delete_mariadb_service', confirmation=True, supports_no_wait=True)

with self.command_group('containerapp service qdrant') as g:
with self.command_group('containerapp service qdrant', deprecate_info=self.deprecate(redirect='containerapp add-on qdrant', hide=True)) as g:
g.custom_command('create', 'create_qdrant_service', supports_no_wait=True)
g.custom_command('delete', 'delete_qdrant_service', confirmation=True, supports_no_wait=True)

with self.command_group('containerapp add-on qdrant') as g:
g.custom_command('create', 'create_qdrant_service', supports_no_wait=True)
g.custom_command('delete', 'delete_qdrant_service', confirmation=True, supports_no_wait=True)

Expand Down
Loading

0 comments on commit fbb8641

Please sign in to comment.