From 07901ea589b20d7557adcbc60a0814acb6c5c1ba Mon Sep 17 00:00:00 2001 From: Silas Strawn Date: Fri, 3 Jun 2022 12:20:39 -0700 Subject: [PATCH] Fix custom domain removal from `az containerapp up` (#116) * Fix https://github.com/microsoft/azure-container-apps/issues/234 * Added history note. Co-authored-by: Haroon Feisal Co-authored-by: Haroon Feisal <38823870+haroonf@users.noreply.github.com> --- src/containerapp/HISTORY.rst | 2 +- src/containerapp/azext_containerapp/custom.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/containerapp/HISTORY.rst b/src/containerapp/HISTORY.rst index 0cc57231005..b926b479f51 100644 --- a/src/containerapp/HISTORY.rst +++ b/src/containerapp/HISTORY.rst @@ -8,9 +8,9 @@ Release History * Added parameter --environment to 'az containerapp list' * Added 'az containerapp revision label swap' to swap traffic labels * BREAKING CHANGE: 'az containerapp revision list' now shows only active revisions by default, added flag --all to show all revisions +* Fixed but with 'az containerapp up' where custom domains would be removed when updating existing containerapp * Fixed bug with 'az containerapp auth update' when using --unauthenticated-client-action - 0.3.5 ++++++ * Add parameter --zone-redundant to 'az containerapp env create' diff --git a/src/containerapp/azext_containerapp/custom.py b/src/containerapp/azext_containerapp/custom.py index 86aaebba9f5..9f638f3238a 100644 --- a/src/containerapp/azext_containerapp/custom.py +++ b/src/containerapp/azext_containerapp/custom.py @@ -2344,7 +2344,10 @@ def containerapp_up_logic(cmd, resource_group_name, name, managed_env, image, en ingress_def = None if target_port is not None and ingress is not None: - ingress_def = IngressModel + if ca_exists: + ingress_def = containerapp_def["properties"]["configuration"]["ingress"] + else: + ingress_def = IngressModel ingress_def["external"] = external_ingress ingress_def["targetPort"] = target_port containerapp_def["properties"]["configuration"]["ingress"] = ingress_def