Skip to content

Kubernetes Container Recipe fails if connection block does not exist #91

@Reshrahim

Description

@Reshrahim

Steps to reproduce

  1. Add the container resource type from the resource type contrib repo
      rad resource-type create -f ./Compute/containers/containers.yaml
    
  2. Publish the bicep extension
     rad bicep publish-extension -f ./Compute/containers/containers.yaml --target radiusContainer.tgz
    
  3. Publish and register the Bicep Recipe for containers
     rad bicep publish --file ./Compute/containers/recipes/kubernetes/bicep/kubernetes-containers.bicep --target br:ghcr.io/reshrahim/recipes/containersrr:latest
    
     rad recipe register default --environment my-env \   --resource-type Radius.Compute/containers \
    --template-kind bicep \
    --template-path ghcr.io/reshrahim/recipes/containersrr:latest
    
  4. Deploy the below app.bicep
     extension radius
     extension radiusCompute
     param environment string
    
     resource todoapp 'Applications.Core/applications@2023-10-01-preview' = {
       name: 'todoapp'
       properties: {
         environment: environment
       }
     }
    
     resource mycontainer 'Radius.Compute/containers@2025-08-01-preview' = {
       name: 'mycontainer'
       properties: {
         environment: environment
         application: todoapp.id
         containers: {
           demo: {
             image: 'ghcr.io/radius-project/samples/demo:latest'
             ports: {
               web: {
                 containerPort: 3000
               }
             }
           }  
         }
       }
     }
    

Observed behavior

The deployment fails with the following error

Deploying template 'app.bicep' into environment '/planes/radius/local/resourcegroups/my-group/providers/Applications.Core/environments/my-env' from workspace 'my-workspace'...

Deployment In Progress...

Completed            todoapp         Applications.Core/applications
.                    mycontainer     Radius.Compute/containers
Error: {
  "code": "DeploymentFailed",
  "message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.",
  "target": "/planes/radius/local/resourceGroups/my-group/providers/Microsoft.Resources/deployments/rad-deploy-767b736c-486d-4f2a-9bd7-1d21f95f7ec9",
  "details": [
    {
      "code": "OK",
      "message": "",
      "target": "/planes/radius/local/resourceGroups/my-group/providers/Applications.Core/applications/todoapp"
    },
    {
      "code": "ResourceDeploymentFailure",
      "message": "Failed",
      "target": "/planes/radius/local/resourceGroups/my-group/providers/Radius.Compute/containers/mycontainer",
      "details": [
        {
          "code": "RecipeDeploymentFailed",
          "message": "failed to deploy recipe default of type Radius.Compute/containers",
          "details": [
            {
              "code": "InvalidTemplate",
              "message": "Deployment template validation failed: 'The template variable 'connectionDefinitions' is not valid: The language expression property 'connections' doesn't exist, available properties are 'application, containers, environment, status'.. Please see https://aka.ms/arm-functions for usage details.'.",
              "additionalInfo": [
                {
                  "type": "TemplateViolation",
                  "info": {
                    "lineNumber": 1,
                    "linePosition": 853,
                    "path": "properties.template.variables.connectionDefinitions"
                  }
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

Desired behavior

Connections is not a required property on Containers and container Recipe should have logic to handle empty connections. Deployment should be successful

Workaround

No response

rad Version

CLI Version Information:
RELEASE VERSION BICEP COMMIT
edge a48305b 0.39.26 a48305b2b22ef1bcdb562758940ecfc6512aad4b

Control Plane Information:
STATUS VERSION
Installed edge

Operating system

No response

Additional context

No response

Would you like to support us?

  • Yes, I would like to support you

AB#18003

Metadata

Metadata

Assignees

No one assigned

    Labels

    triagedThis item has been triaged by project maintainers and is in the backlog

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions