Skip to content

Commit

Permalink
[containerapp] Revert remove deprecate command `az containerapp env w…
Browse files Browse the repository at this point in the history
…orkload-profile set` (#6977)
  • Loading branch information
Greedygre committed Nov 10, 2023
1 parent 7e3dff7 commit b348d16
Show file tree
Hide file tree
Showing 7 changed files with 3,757 additions and 9,230 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 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
examples:
- name: Create or update an existing workload profile in a Container Apps environment
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=self.deprecate(redirect='containerapp env workload-profile add/update', hide=True))

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):
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

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,16 @@ def test_containerapp_env_workload_profiles_e2e_no_waits(self, resource_group):
JMESPathCheck("properties.template.containers[0].resources.memory", "1Gi")
])

self.cmd("az containerapp env workload-profile set -g {} -n {} --workload-profile-name my-d8-set --workload-profile-type D8 --min-nodes 2 --max-nodes 3".format(
resource_group, env), expect_failure=False)
self.cmd("az containerapp env workload-profile show -g {} -n {} --workload-profile-name my-d8-set ".format(
resource_group, env), checks=[
JMESPathCheck("properties.name", "my-d8-set"),
JMESPathCheck("properties.maximumCount", 3),
JMESPathCheck("properties.minimumCount", 2),
JMESPathCheck("properties.workloadProfileType", "D8"),
])

@AllowLargeResponse(8192)
@ResourceGroupPreparer(location="eastus")
def test_containerapp_env_enable_workload_profiles_infer_env_type(self, resource_group):
Expand Down

0 comments on commit b348d16

Please sign in to comment.