Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
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 env workload-profile set': deprecate command
* '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
Expand Down
9 changes: 9 additions & 0 deletions src/containerapp/azext_containerapp/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,15 @@
az containerapp auth update -g myResourceGroup --name MyContainerapp --proxy-convention Standard
"""

helps['containerapp env workload-profile set'] = """
type: command
short-summary: Create or update an existing workload profile in a Container Apps environment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should you add deprecation_info here?

@Greedygre Greedygre Nov 10, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add in the deprecate info for command setting:
image

examples:
- name: Create or update an existing workload profile in a Container Apps environment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have to be existing?

@Greedygre Greedygre Nov 10, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update an existing workload profile, create a new one is ok too.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean existing is not required in description

text: |
az containerapp env workload-profile set -g MyResourceGroup -n MyEnvironment --workload-profile-name my-wlp --workload-profile-type D4 --min-nodes 1 --max-nodes 2
"""

# Compose commands
helps['containerapp compose'] = """
type: group
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 @@ -101,6 +101,11 @@ def load_arguments(self, _):
c.argument('sas_url_secret', help='The blob storage SAS URL to be used for token store.', is_preview=True)
c.argument('sas_url_secret_name', help='The secret name that contains blob storage SAS URL to be used for token store.', is_preview=True)

with self.argument_context('containerapp env workload-profile set') as c:
c.argument('workload_profile_type', help="The type of workload profile to add or update. Run 'az containerapp env workload-profile list-supported -l <region>' to check the options for your region.")
c.argument('min_nodes', help="The minimum node count for the workload profile")
c.argument('max_nodes', help="The maximum node count for the workload profile")

# Patch
with self.argument_context('containerapp patch') as c:
c.argument('resource_group_name', arg_type=resource_group_name_type)
Expand Down
3 changes: 3 additions & 0 deletions src/containerapp/azext_containerapp/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ def load_command_table(self, _):
with self.command_group('containerapp compose') as g:
g.custom_command('create', 'create_containerapps_from_compose')

with self.command_group('containerapp env workload-profile') as g:
g.custom_command('set', 'set_workload_profile', deprecate_info=g.deprecate(hide=True))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you add redirect

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can not add redirect, because set = update + add:
command set support to create a new workload profile or update an existing one.
But command add only support add a new one, if the added name has been used, throw validate error;
command update only support update an existing one, if not existing, throw error.


with self.command_group('containerapp patch', is_preview=True) as g:
g.custom_command('list', 'patch_list')
g.custom_command('apply', 'patch_apply')
Expand Down
4 changes: 4 additions & 0 deletions src/containerapp/azext_containerapp/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,10 @@ def create_containerapps_from_compose(cmd, # pylint: disable=R0914
return containerapps_from_compose


def set_workload_profile(cmd, resource_group_name, env_name, workload_profile_name, workload_profile_type=None, min_nodes=None, max_nodes=None):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have test for the command?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add test in test_containerapp_env_workload_profiles_e2e_no_waits

return update_managed_environment(cmd, env_name, resource_group_name, workload_profile_type=workload_profile_type, workload_profile_name=workload_profile_name, min_nodes=min_nodes, max_nodes=max_nodes)


def patch_list(cmd, resource_group_name=None, managed_env=None, show_all=False):
# Ensure that Docker is running locally before attempting to use the pack CLI
if is_docker_running() is False:
Expand Down