Azure / azure-cli

Azure Command-Line Interface
MIT License
3.91k stars 2.88k forks source link

az containerapp update - support for init containers #27538

Open klemmchr opened 9 months ago

klemmchr commented 9 months ago

Related command az containerapp update

Is your feature request related to a problem? Please describe. Currently we can update containers in an app by specifying --container-name. This does not work for init containers, instead it will create a new app container using the specified name.

Describe the solution you'd like Add the possibility to update an init container alongside with updating an app.

Additional context When creating a new deployment it is a common scenario to have a init container doing tasks like migrations. Ideally this init container have versioned labels to ensure consistency in deployment. This means that it is needed to update the image for both, the app and the init container at the same time.

yonzhan commented 9 months ago

Thank you for opening this issue, we will look into it.

brecht-vermeersch commented 8 months ago

any update on this?

arj-196 commented 4 months ago

Any update on this?

Ivaylo-Bachvarov commented 1 month ago

I guess the workaround would be to use one off tasks instead of init containers: https://learn.microsoft.com/en-us/cli/azure/containerapp/job?view=azure-cli-latest#az-containerapp-job-create(containerapp)-examples

klemmchr commented 1 month ago

I guess the workaround would be to use one off tasks instead of init containers: https://learn.microsoft.com/en-us/cli/azure/containerapp/job?view=azure-cli-latest#az-containerapp-job-create(containerapp)-examples

Exactly, this is what I do at the moment. Having a container app job with a manual trigger that is being executed using Azure CLI. Also has the benefit of dedicated identity which init containers are missing.

Tim-Hodge commented 1 week ago

Are there any plans to get this assigned to a milestone? We are making use of init containers for migrations, however our CD pipelines are having to jump through hoops to get them updated.

To work around this we're currently doing:

# fetch existing container app yaml definition
az container app show -o yaml

# update image + init container image(s) with yq, e.g.:
yq eval ...initContainers[0].image = initImage ...

# apply update
az containerapp update --yaml

This feels a lot more error-prone and harder to grok than a single command, and might start to fall down for more complex manipulations. We've also considered using CA jobs for migrations, but that is only suitable for some use cases and also comes with additional steps to monitor / tear down etc.

We're quite heavily invested in container apps at this stage, and this lack of tooling is making it harder for our teams to take real advantage of all the features via CD. If there are other methods/tooling we should be using in tandem with container apps to improve this experience then we're very open to them.