azure-cli-extensions icon indicating copy to clipboard operation
azure-cli-extensions copied to clipboard

`az containerapp update` is not setting minreplicas to 0

Open charris-msft opened this issue 2 years ago • 9 comments

  • If the issue is to do with Azure CLI 2.0 in-particular, create an issue here at Azure/azure-cli

Related command

containerapp update

Extension name (the extension in question)

containerapp

Description of issue (in as much detail as possible)

I originally created a containerapp with a yaml file that specified minReplicas: 0

Now, I want to update minReplicas to 0 so I updated the yaml file like this:

    scale:
      minReplicas: 0
      maxReplicas: 1

and ran

az container app update ... --yaml updated.yaml

However, in the output from the command and in the portal, the minReplicas is still set to 0.

Then, I tried the following:

az containerapp update ... --min-replicas 0

The command completed successfully, but minReplicas did not get updated.

Final try - I updated minReplicas via a Revision in the Portal and that finally worked.


charris-msft avatar Sep 27 '22 12:09 charris-msft

route to CXP team

yonzhan avatar Sep 27 '22 12:09 yonzhan

@charris-msft thanks for reporting, we will investigate further. However, wanted to get a clarification, if this behavior is specific to yaml from CLI command. Does this work with ARM template or updating from portal directly? Thanks. @StrawnSC , @haroonf FYI.

panchagnula avatar Sep 27 '22 16:09 panchagnula

@panchagnula - I saw the issue with yaml from CLI and with the --min-replicas parameter from CLI (no --yaml specified). It behaved as expected when I updated in the portal. I did not try with an ARM template.

charris-msft avatar Sep 27 '22 16:09 charris-msft

@panchagnula - I saw the issue with yaml from CLI and with the --min-replicas parameter from CLI (no --yaml specified). It behaved as expected when I updated in the portal. I did not try with an ARM template.

Gotcha. Could you also provide the CLI version being used (run az --version). CLI updated recently to use the latest api-version, so I am wondering if there is a change here we need to look into. Portal still uses an older api-version. Thanks!

panchagnula avatar Sep 27 '22 17:09 panchagnula

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @calvinsID.

Issue Details
  • If the issue is to do with Azure CLI 2.0 in-particular, create an issue here at Azure/azure-cli

Related command

containerapp update

Extension name (the extension in question)

containerapp

Description of issue (in as much detail as possible)

I originally created a containerapp with a yaml file that specified minReplicas: 0

Now, I want to update minReplicas to 0 so I updated the yaml file like this:

    scale:
      minReplicas: 0
      maxReplicas: 1

and ran

az container app update ... --yaml updated.yaml

However, in the output from the command and in the portal, the minReplicas is still set to 0.

Then, I tried the following:

az containerapp update ... --min-replicas 0

The command completed successfully, but minReplicas did not get updated.

Final try - I updated minReplicas via a Revision in the Portal and that finally worked.


Author: charris-msft
Assignees: -
Labels:

bug, Service Attention, Client, Auto-Assign, ContainerApp

Milestone: -

ghost avatar Sep 27 '22 17:09 ghost

 >  az --version
azure-cli                         2.40.0

core                              2.40.0
telemetry                          1.0.8

Extensions:
connectedk8s                       1.3.3
containerapp                      0.3.11
customlocation                     0.1.3
k8s-extension                      1.3.4
rdbms-connect                      1.0.3

Dependencies:
msal                            1.18.0b1
azure-mgmt-resource             21.1.0b1

Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\chris\.azure\cliextensions'

Python (Windows) 3.10.5 (tags/v3.10.5:f377153, Jun  6 2022, 15:58:59) [MSC v.1929 32 bit (Intel)]

charris-msft avatar Sep 28 '22 00:09 charris-msft

Had same issue but got around it by providing --max-replicas as well

stfnzl avatar Sep 18 '23 20:09 stfnzl

is there an updated for this?

I created a new container app with this in my config.yml file:

scale:
    minReplicas: 1
    maxReplicas: 10

I then updated the config like so:

scale:
  minReplicas: 0
  maxReplicas: 50
  rules: [
    {
      name: 'event-driven',
      custom: {
        type: 'azure-servicebus',
        metadata: {
          queueName: 'my-queue-name',
          messageCount: '1'
        },
        auth: [
          {
            secretRef: 'service-bus-conn',
            triggerParameter: 'connection'
          }
        ]
      }
    }
  ]

ran the deploy and minReplicas is still 1, but the scaling part all worked as expected

Screenshot 2023-11-27 at 11 09 32 AM

also, if I try to use the CLI flags along with the yml config, I get this:

WARNING: Additional flags were passed along with --yaml. These flags will be ignored, and the configuration defined in the yaml will be used instead

EDIT: I can confirm that when using the --yaml flag, the minReplicas value is ignored.

so, since the app was created with default scaling rules (ie: 1 and 10 for min / max), I have to do two update commands to update the image for the new revision AND update the scaling min/max:

# update the app using the values in the yaml config that actually work......
az containerapp update -n my-app-name -g my-app-rg --yaml ${{ variables.configFile }}
# update the replica counts that DO NOT WORK as described by this issue
az containerapp update -n my-app-name -g my-app-rg --min-replicas 0 --max-replicas 20

jason-berk-k1x avatar Nov 27 '23 16:11 jason-berk-k1x

This issue about az containerapp update --min-replicas 0 not work has been fixed and released in version 0.3.46 of containerapp extension. You can update the extension with command, thanks!

az extension add -n containerapp --upgrade

About setting minReplicas to 0 in --yaml not work, the fix be released in azure-cli 2.57.0 in February.

Greedygre avatar Nov 30 '23 11:11 Greedygre