Azure / azure-cli

Azure Command-Line Interface
MIT License
4.03k stars 3.01k forks source link

[containerapp] `az containerapp show` does not return scaling rules #28767

Open flannoo opened 7 months ago

flannoo commented 7 months ago

Describe the bug

The command az containerapp show always returns "null" for the scaling rules, even when scaling rules are configured in the container app. I am able to reproduce this in several azure tenants and am on the latest az cli version (2.59.0).

Related command

az containerapp show

Errors

N/A

Issue script & Debug output

Deploy a container app and configure a HTTP scaling rule in the "scale" section. Then run the command:

az containerapp show --name "XXXX" --resource-group "XXXX"

This returns:

{
  "id": "[REDACTED]",
  "identity": {
    "type": "UserAssigned",
    "userAssignedIdentities": {
      "[REDACTED]": {
        "clientId": "[REDACTED]",
        "principalId": "[REDACTED]"
      }
    }
  },
  "location": "West Europe",
  "name": "[REDACTED]",
  "properties": {
    "configuration": {
      "activeRevisionsMode": "Single",
      "dapr": null,
      "ingress": {
        "allowInsecure": false,
        "clientCertificateMode": null,
        "corsPolicy": null,
        "customDomains": null,
        "exposedPort": 0,
        "external": true,
        "fqdn": "[REDACTED]",
        "ipSecurityRestrictions": null,
        "stickySessions": null,
        "targetPort": 80,
        "traffic": [
          {
            "latestRevision": true,
            "weight": 100
          }
        ],
        "transport": "Auto"
      },
      "maxInactiveRevisions": null,
      "registries": null,
      "secrets": null,
      "service": null
    },
    "customDomainVerificationId": "[REDACTED]",
    "delegatedIdentities": [],
    "environmentId": "[REDACTED]",
    "eventStreamEndpoint": "[REDACTED]",
    "latestReadyRevisionName": "[REDACTED]",
    "latestRevisionFqdn": "[REDACTED]",
    "latestRevisionName": "[REDACTED]",
    "managedEnvironmentId": "[REDACTED]",
    "outboundIpAddresses": [REDACTED],
    "provisioningState": "Succeeded",
    "runningStatus": "Running",
    "template": {
      "containers": [
        {
          "env": [
            {
              "name": "test",
              "value": "testvalue"
            }
          ],
          "image": "docker.io/nginx:latest",
          "name": "[REDACTED]",
          "probes": [
            {
              "initialDelaySeconds": 30,
              "periodSeconds": 30,
              "tcpSocket": {
                "port": 80
              },
              "type": "Liveness"
            }
          ],
          "resources": {
            "cpu": 0.5,
            "ephemeralStorage": "2Gi",
            "memory": "1Gi"
          }
        }
      ],
      "initContainers": null,
      "revisionSuffix": "",
      "scale": {
        "maxReplicas": 10,
        "minReplicas": 0,
        "rules": null
      },
      "serviceBinds": null,
      "terminationGracePeriodSeconds": null,
      "volumes": []
    },
    "workloadProfileName": "Consumption"
  },
  "resourceGroup": "containerapps",
  "systemData": {
    "createdAt": "2024-04-16T11:48:26.0719357",
    "createdBy": "[REDACTED]",
    "createdByType": "User",
    "lastModifiedAt": "2024-04-17T07:42:29.5046554",
    "lastModifiedBy": "[REDACTED]",
    "lastModifiedByType": "User"
  },
  "type": "Microsoft.App/containerApps"
}

Expected behavior

I would expect to see rules in the scale object, but it's null:

 "scale": {
        "maxReplicas": 10,
        "minReplicas": 0,
        "rules": null
      },

Environment Summary

az version:

{
  "azure-cli": "2.59.0",
  "azure-cli-core": "2.59.0",
  "azure-cli-telemetry": "1.1.0",
  "extensions": {
    "azure-iot": "0.23.0",
    "datafactory": "1.0.0"
  }
}

Additional context

No response

yonzhan commented 7 months ago

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

microsoft-github-policy-service[bot] commented 7 months ago

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

flannoo commented 7 months ago

Update: it seems my bug report might have been inaccurate.

By default, the azure portal shows/deploys a default scaling rule "http-scaler". But when looking into the scale rule settings, the scale rules are actually empty in the portal as well (so the az cli properly reflects this). When explicitly configuring a custom scale rule in a new revision, the az cli properly returns the custom scale rule.

So I don't think any fixes are needed, the az cli returns custom scaling rules properly. The ARM template doesn't display the default scaling rule either, so it's normal that the az cli also doesn't return this (and only returns custom scaling rules if configured)

So I think this issue can be closed