Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions src/containerapp/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ upcoming
* 'az containerapp compose create': fixed an issue where the environment's resource group was not resolved from --environment when the input value was a resource id.
* 'az containerapp replica count', returns the replica count of a container app
* [Breaking Change] 'az containerapp job create': add default values for container app job properties --replica-completion-count, --replica-retry-limit, --replica-timeout, --parallelism, --min-executions, --max-executions, --polling-interval
* [Breaking Change] 'az containerapp env create': update the default value of --enable-workload-profiles to `True`
* 'az containerapp compose create': fix containerapp invalid memory resource

0.3.41
++++++
Expand Down
2 changes: 1 addition & 1 deletion src/containerapp/azext_containerapp/_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

CURRENT_API_VERSION = "2023-05-01"
PREVIEW_API_VERSION = "2023-05-02-preview"
POLLING_TIMEOUT = 600 # how many seconds before exiting
POLLING_TIMEOUT = 1200 # how many seconds before exiting
POLLING_SECONDS = 2 # how many seconds between requests
POLLING_TIMEOUT_FOR_MANAGED_CERTIFICATE = 1500 # how many seconds before exiting
POLLING_INTERVAL_FOR_MANAGED_CERTIFICATE = 4 # how many seconds between requests
Expand Down
9 changes: 8 additions & 1 deletion src/containerapp/azext_containerapp/_compose_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,14 @@ def valid_resource_settings():
}


def validate_memory_and_cpu_setting(cpu, memory):
def validate_memory_and_cpu_setting(cpu, memory, managed_environment):
# only v1 cluster do the validation
from ._utils import safe_get
if safe_get(managed_environment, "properties", "workloadProfiles"):
if memory:
return cpu, f"{memory}Gi"
return cpu, memory

settings = valid_resource_settings()

if cpu in settings.keys(): # pylint: disable=C0201
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
safe_set,
get_default_workload_profiles,
_azure_monitor_quickstart, safe_get)
from ._client_factory import handle_raw_exception
from ._client_factory import handle_raw_exception, handle_non_404_status_code_exception
from .base_resource import BaseResource
from ._models import (
ManagedEnvironment as ManagedEnvironmentModel,
Expand Down Expand Up @@ -370,6 +370,19 @@ def set_up_infrastructure_resource_group(self):

def set_up_workload_profiles(self):
if self.get_argument_enable_workload_profiles():
# If the environment exists, infer the environment type
existing_environment = None
try:
existing_environment = self.client.show(cmd=self.cmd, resource_group_name=self.get_argument_resource_group_name(), name=self.get_argument_name())
except Exception as e:
handle_non_404_status_code_exception(e)

if existing_environment and safe_get(existing_environment, "properties", "workloadProfiles") is None:
# check if input params include -w/--enable-workload-profiles
if self.cmd.cli_ctx.data.get('safe_params') and ('-w' in self.cmd.cli_ctx.data.get('safe_params') or '--enable-workload-profiles' in self.cmd.cli_ctx.data.get('safe_params')):
raise ValidationError(f"Existing environment {self.get_argument_name()} cannot enable workload profiles. If you want to use Consumption and Dedicated environment, please create a new one.")
return

self.managed_env_def["properties"]["workloadProfiles"] = get_default_workload_profiles(self.cmd, self.get_argument_location())

def get_argument_enable_workload_profiles(self):
Expand Down
5 changes: 3 additions & 2 deletions src/containerapp/azext_containerapp/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ def create_managed_environment(cmd,
hostname=None,
certificate_file=None,
certificate_password=None,
enable_workload_profiles=False,
enable_workload_profiles=True,
mtls_enabled=None,
no_wait=False):
raw_parameters = locals()
Expand Down Expand Up @@ -4786,7 +4786,8 @@ def create_containerapps_from_compose(cmd, # pylint: disable=R0914
startup_command, startup_args = resolve_service_startup_command(service)
cpu, memory = validate_memory_and_cpu_setting(
resolve_cpu_configuration_from_service(service),
resolve_memory_configuration_from_service(service)
resolve_memory_configuration_from_service(service),
managed_environment
)
replicas = resolve_replicas_from_service(service)
environment = resolve_environment_from_service(service)
Expand Down

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.

Loading