Skip to content

[Spike] improve azure container app deployments to avoid error-prone and confusing multiple revisions #3116

@vicondoa

Description

@vicondoa

Output from azd version
Run azd version and copy and paste the output here:
azd version 1.5.0 (commit 012ae73)

Describe the bug
Azure Container Apps with Azure Developer CLI currently have a major limitation in how it handles deployments. Deployments of updated revisions occur in two phases: provision where the spec for the container app is changed and deployment where the image is updated. This creates a problem when developers revise their service and bicep configs, as it often has dependencies between its code in its Docker container, environment variables, resources, mounts, health probes, load balancers, and more. If these dependencies are not deployed in the right order, deployments can fail, and this can possibly create an outage because the container app can't start up.

azd deploy will only replace containers[0].image with the new image. This undocumented behavior is a huge limitation in the case where someone would like to run the same image in a sidecar or init container. A developer shouldn't need to have a code change made to azd anytime they come up with a new way an image should be included in a a container app spec.

The current setup is confusing. It's unclear what the special exists behavior is for in the templates. In a team of 10 people, most of us were really surprised to find out that the bicep configs for a container app don't actually determine what image should be used.

We mitigate this issue by adding a post-deploy hook to rollout a third revision to copy the image on containers[0] to all other containers where it's needed. A container app should not need three revisions per deployment. Each revision is an opportunity of incompatibility between bicep spec, revision 1, and revision 2 that is very error prone. We have burnt many hours of engineer time working around this.

To Reproduce

  1. create a container app that has two containers, where you would like it to use the built image on both
  2. run azd up
  3. notice how only the first container has changed in the container app

Expected behavior

azd up should only produce one revision per service. developer should be able to specify container app spec and how the images are used all in one place rather than the undocumented behavior and exists hack in the template. Consider how kubernetes deployments work with kubectl apply.

Environment
Information on your environment:
* Azure container apps
* python

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions