Skip to content
Merged
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 up': support to create or update a containerapp on connected environment as well as any associated resources (extension on connected cluster, custom location) with --custom-location or --connected-cluster-id

0.3.44
++++++
Expand Down
9 changes: 8 additions & 1 deletion src/containerapp/azext_containerapp/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,14 @@ def custom_location_client_factory(cli_ctx, api_version=None, subscription_id=No


def k8s_extension_client_factory(cli_ctx, subscription_id=None):
from azext_containerapp.vendored_sdks.kubernetesconfiguration import SourceControlConfigurationClient
from .vendored_sdks.kubernetesconfiguration import SourceControlConfigurationClient

r = get_mgmt_service_client(cli_ctx, SourceControlConfigurationClient, subscription_id=subscription_id)
return r.extensions


def connected_k8s_client_factory(cli_ctx, subscription_id=None):
from .vendored_sdks.hybridkubernetes import ConnectedKubernetesClient

r = get_mgmt_service_client(cli_ctx, ConnectedKubernetesClient, subscription_id=subscription_id)
return r.connected_cluster
5 changes: 5 additions & 0 deletions src/containerapp/azext_containerapp/_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
MANAGED_ENVIRONMENT_RESOURCE_TYPE = "managedEnvironments"
CONNECTED_ENVIRONMENT_RESOURCE_TYPE = "connectedEnvironments"
CUSTOM_LOCATION_RESOURCE_TYPE = "customLocations"
CONNECTED_CLUSTER_TYPE = "connectedClusters"

MAXIMUM_SECRET_LENGTH = 20
MAXIMUM_CONTAINER_APP_NAME_LENGTH = 32
Expand Down Expand Up @@ -41,6 +42,7 @@
CONTAINER_APPS_RP = "Microsoft.App"
SERVICE_LINKER_RP = "Microsoft.ServiceLinker"
EXTENDED_LOCATION_RP = "Microsoft.ExtendedLocation"
KUBERNETES_CONFIGURATION_RP = "Microsoft.KubernetesConfiguration"
CONTAINER_APP_EXTENSION_TYPE = "microsoft.app.environment"

MANAGED_CERTIFICATE_RT = "managedCertificates"
Expand Down Expand Up @@ -113,3 +115,6 @@
HELLO_WORLD_IMAGE = "mcr.microsoft.com/k8se/quickstart:latest"

LOGS_STRING = '[{"category":"ContainerAppConsoleLogs","categoryGroup":null,"enabled":true,"retentionPolicy":{"days":0,"enabled":false}},{"category":"ContainerAppSystemLogs","categoryGroup":null,"enabled":true,"retentionPolicy":{"days":0,"enabled":false}}]' # pylint: disable=line-too-long

DEFAULT_CONNECTED_CLUSTER_EXTENSION_NAME = "containerapp-ext"
DEFAULT_CONNECTED_CLUSTER_EXTENSION_NAMESPACE = "containerapp-ns"
6 changes: 6 additions & 0 deletions src/containerapp/azext_containerapp/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@
- name: Create a container app from an image in a registry with ingress enabled and a specified environment
text: |
az containerapp up -n MyContainerapp --image myregistry.azurecr.io/myImage:myTag --ingress external --target-port 80 --environment MyEnv
- name: Create a container app from an image in a registry on a Connected cluster
text: |
az containerapp up -n MyContainerapp --image myregistry.azurecr.io/myImage:myTag --connected-cluster-id MyConnectedClusterResourceId
- name: Create a container app from an image in a registry on a connected environment
text: |
az containerapp up -n MyContainerapp --image myregistry.azurecr.io/myImage:myTag --environment MyConnectedEnvironmentId
"""

helps['containerapp show-custom-domain-verification-id'] = """
Expand Down
5 changes: 4 additions & 1 deletion src/containerapp/azext_containerapp/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from .action import AddCustomizedKeys
from ._validators import (validate_env_name_or_id,
validate_custom_location_name_or_id)
validate_custom_location_name_or_id, validate_env_name_or_id_for_up)
from ._constants import MAXIMUM_CONTAINER_APP_NAME_LENGTH, MAXIMUM_APP_RESILIENCY_NAME_LENGTH, MAXIMUM_COMPONENT_RESILIENCY_NAME_LENGTH


Expand Down Expand Up @@ -144,7 +144,10 @@ def load_arguments(self, _):
c.argument('pubsub', help="The pubsub component and dev service to create.")

with self.argument_context('containerapp up') as c:
c.argument('environment', validator=validate_env_name_or_id_for_up, options_list=['--environment'], help="Name or resource ID of the container app's managed environment or connected environment.")
c.argument('artifact', help="Local path to the application artifact for building the container image. See the supported artifacts here: https://aka.ms/SourceToCloudSupportedArtifacts.", is_preview=True)
c.argument('custom_location_id', options_list=['--custom-location'], help="Resource ID of custom location. List using 'az customlocation list'.", is_preview=True)
c.argument('connected_cluster_id', help="Resource ID of connected cluster. List using 'az connectedk8s list'.", configured_default='connected_cluster_id', is_preview=True)

with self.argument_context('containerapp up', arg_group='Github Repo') as c:
c.argument('repo', help='Create an app via Github Actions. In the format: https://github.com/<owner>/<repository-name> or <owner>/<repository-name>')
Expand Down
Loading