Skip to content

Commit

Permalink
[App Service] az functionapp create, `az functionapp list-flexconsu…
Browse files Browse the repository at this point in the history
…mption-runtimes`: Add support of Stacks API for Flex SKUs (#28795)
  • Loading branch information
kamperiadis committed Apr 23, 2024
1 parent 1bc60d7 commit 9f769d0
Show file tree
Hide file tree
Showing 18 changed files with 10,136 additions and 7,464 deletions.
39 changes: 0 additions & 39 deletions src/azure-cli/azure/cli/command_modules/appservice/_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,47 +137,8 @@ def __init__(self):
"node|16": "https://azure.microsoft.com/en-us/updates/node16support/"
}

FLEX_RUNTIMES = [
{
'runtime': 'dotnet-isolated',
'version': '8.0'
},
{
'runtime': 'java',
'version': '17'
},
{
'runtime': 'java',
'version': '11'
},
{
'runtime': 'node',
'version': '20'
},
{
'runtime': 'node',
'version': '18'
},
{
'runtime': 'python',
'version': '3.11'
},
{
'runtime': 'python',
'version': '3.10'
},
{
'runtime': 'powershell',
'version': '7.2'
}
]

FLEX_SUBNET_DELEGATION = "Microsoft.App/environments"

DEFAULT_INSTANCE_SIZE = 2048

DEFAULT_MAXIMUM_INSTANCE_COUNT = 100

DEPLOYMENT_STORAGE_AUTH_TYPES = ['SystemAssignedIdentity', 'UserAssignedIdentity', 'StorageAccountConnectionString']

STORAGE_BLOB_DATA_CONTRIBUTOR_ROLE_ID = 'ba92f5b4-2d11-453d-a403-e96b0029c9fe'
4 changes: 4 additions & 0 deletions src/azure-cli/azure/cli/command_modules/appservice/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ def load_arguments(self, _):
with self.argument_context('functionapp list-runtimes') as c:
c.argument('os_type', options_list=["--os", "--os-type"], help="limit the output to just windows or linux runtimes", arg_type=get_enum_type([LINUX_OS_NAME, WINDOWS_OS_NAME]))

with self.argument_context('functionapp list-flexconsumption-runtimes') as c:
c.argument('location', arg_type=get_location_type(self.cli_ctx), help="limit the output to just the runtimes available in the specified location")
c.argument('runtime', help="limit the output to just the specified runtime")

with self.argument_context('webapp deleted list') as c:
c.argument('name', arg_type=webapp_name_arg_type, id_part=None)
c.argument('slot', options_list=['--slot', '-s'], help='Name of the deleted web app slot.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def load_command_table(self, _):
g.custom_command('create', 'create_functionapp', exception_handler=ex_handler_factory(),
validator=validate_functionapp)
g.custom_command('list-runtimes', 'list_function_app_runtimes')
g.custom_command('list-flexconsumption-runtimes', 'list_flexconsumption_runtimes')
g.custom_command('list-flexconsumption-runtimes', 'list_flex_function_app_runtimes')
g.custom_command('list', 'list_function_app', table_transformer=transform_web_list_output)
g.custom_show_command('show', 'show_functionapp', table_transformer=transform_web_output)
g.custom_command('delete', 'delete_function_app')
Expand Down
284 changes: 225 additions & 59 deletions src/azure-cli/azure/cli/command_modules/appservice/custom.py

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -457,11 +457,10 @@ def test_functionapp_consumption_ragrs_storage_e2e(self, resource_group, storage

class FunctionWorkloadProfile(ScenarioTest):
@AllowLargeResponse(8192)
@ResourceGroupPreparer(location="westus")
@ResourceGroupPreparer(location='northeurope')
@StorageAccountPreparer()
def test_functionapp_workloadprofiles(self, resource_group, storage_account):

location = "NorthCentralUS(Stage)"
functionapp_name = self.create_random_name(
'functionapp', 32)
managed_environment_name = self.create_random_name(
Expand All @@ -475,24 +474,32 @@ def test_functionapp_workloadprofiles(self, resource_group, storage_account):
'wlp', 15
)

self.cmd('containerapp env create --name {} --resource-group {} --location {} --enable-workload-profiles --logs-destination none'.format(
self.cmd('containerapp env create --name {} --resource-group {} --location northeurope --enable-workload-profiles --logs-destination none'.format(
managed_environment_name,
resource_group,
location,
))


if self.is_live:
time.sleep(260)

self.cmd('containerapp env workload-profile add --name {} --resource-group {} --workload-profile-type D4 -w {} --min-nodes 3 --max-nodes 6'.format(
managed_environment_name,
resource_group,
workload_profile_name
))


if self.is_live:
time.sleep(260)

self.cmd('containerapp env workload-profile add --name {} --resource-group {} --workload-profile-type D4 -w {} --min-nodes 3 --max-nodes 6'.format(
managed_environment_name,
resource_group,
workload_profile_name_2
))

if self.is_live:
time.sleep(260)

self.cmd('functionapp create -g {} -n {} -s {} --functions-version 4 --runtime dotnet-isolated --environment {} --workload-profile-name {} --cpu 1.0 --memory 1.0Gi'.format(
resource_group,
functionapp_name,
Expand All @@ -517,6 +524,9 @@ def test_functionapp_workloadprofiles(self, resource_group, storage_account):
workload_profile_name_2
))

if self.is_live:
time.sleep(1200)

self.cmd('functionapp show -g {} -n {}'.format(resource_group, functionapp_name)).assert_with_checks([
JMESPathCheck('resourceConfig.cpu', 0.75),
JMESPathCheck('resourceConfig.memory', '2Gi'),
Expand Down Expand Up @@ -2907,6 +2917,8 @@ def test_functionapp_powershell_version(self, resource_group, storage_account):
self.cmd('functionapp config show -g {} -n {}'.format(resource_group, functionapp_name)).assert_with_checks([
JMESPathCheck('powerShellVersion', '7.2')
])

time.sleep(60)
self.cmd('functionapp config set -g {} -n {} --powershell-version 7.0'
.format(resource_group, functionapp_name)).assert_with_checks([
JMESPathCheck('powerShellVersion', '7.0')])
Expand Down

0 comments on commit 9f769d0

Please sign in to comment.