Container Apps deployment through GitHub Actions fails due to incorrect cpu and memory specifications

Iván Ariel Weinberg 0 Reputation points
2024-08-08T13:34:53.95+00:00

Hello there people! I hope you are doing great.

I have created a terraform repository to deploy certain infrastructure to Azure, which includes a block based on azurerm_container_app resoure with the correct parameters in its template (currently testing with 0.25 cpu and 0.5 Gi).

On top of that, there's another repo with the app itself + Dockerfile + GitHub Actions Workflow YAML to deploy a container with our app.

Everything was working perfectly until the day before yesterday or so, and now I'm getting the following error (some parts might be redacted): ERROR: (ContainerAppInvalidResourceTotal) The total requested CPU and memory resources for this application (CPU: 2.5, memory: 5) is invalid. Total CPU and memory for all containers defined in a Container App must add up to one of the following CPU - Memory combinations: [cpu: 0.25, memory: 0.5Gi]; [cpu: 0.5, memory: 1.0Gi]; [cpu: 0.75, memory: 1.5Gi]; [cpu: 1.0, memory: 2.0Gi]; [cpu: 1.25, memory: 2.5Gi]; [cpu: 1.5, memory: 3.0Gi]; [cpu: 1.75, memory: 3.5Gi]; [cpu: 2.0, memory: 4.0Gi]

The step that performs the container app deployment inside the action is this single line command: /usr/bin/az containerapp update --name [REDACTED] --resource-group [REDACTED] --image [REDACTED] --revision-suffix [REDACTED] --container-name [REDACTED]

Things to consider:

  • I ruled out Container Apps Build and Deploy action because even though a Dockerfile was specified and an image was built, the app deployed was the default one by Oryx that the documentation states (which shouldn' t have happened as far as I could understand when reading the documentation inside the Marketplace). I've tried debugging it but couldn't find the reason why and decided to take a different approach.
  • As far as I could see and based on what was defined on the code, there should be only one Container App running, so the (ContainerAppInvalidResourceTotal) error type makes little sense to me. Also, the terraform code related to the Container Apps hasn't been modified for about a month and, except for what was explained on item 1, everything was working perfectly up to this point.
  • The only place where I specify the resources used by a container is inside the template block of the terraform's repository mentioned above, which is very close to the example (see below the excerpt from the documentation referenced before).
  template {
    container {
      name   = "examplecontainerapp"
      image  = "mcr.microsoft.com/azuredocs/containerapps-helloworld:latest"
      cpu    = 0.25
      memory = "0.5Gi"
    }
  }
  • Before this happened, our image was being used and containerapp deployment was acting as expected.
  • I've searched far and wide for a while about this but was unable to find fruitful ideas / solutions.

Thank you very much and have a wonderful day!

Azure Container Apps
Azure Container Apps
An Azure service that provides a general-purpose, serverless container platform.
399 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Iván Ariel Weinberg 0 Reputation points
    2024-08-12T13:34:52.97+00:00

    Update: I was able to do a workaround by manually specifying cpu and memory usage on the az containerapp update command I included on my original post. A final and definitive fix would be better though, so I'm still open to suggestions and ideas.

    That being said, now we're back on the first error that states that the port is in use. I've searched far and wide on both repositories but to no avail and the only places where the port is specified is on the Ingress to allow inbound traffic and on the Dockerfile definitions to expose it to the internet.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.