Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 107 additions & 0 deletions deploy/manifest/built-in-providers/dev/radius_compute.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -727,3 +727,110 @@ types:
enum: [ReadWriteOnce, ReadOnlyMany, ReadWriteMany]
description: (Optional) The access modes which are permitted to be requested by a Container. Assumed to be all modes if not specified.
required: [environment, sizeInGib]
containerImages:
description: |
The Radius.Compute/containerImages Resource Type builds a container image from source and pushes it to a container registry. It is always part of a Radius Application.

Comment thread
willdavsmith marked this conversation as resolved.
Resolved
This resource type is designed for local development workflows where the source code is available on the Kubernetes node filesystem (e.g., via kind `extraMounts` or k3d `-v` flags). It uses BuildKit to build and push the image.

To build and push a container image, add a containerImages resource to your application definition Bicep file:

extension radius
extension containerImages
Comment thread
willdavsmith marked this conversation as resolved.
Resolved

param environment string

resource myApp 'Radius.Core/applications@2025-08-01-preview' = {
name: 'myApp'
properties: {
environment: environment
}
}

resource myImage 'Radius.Compute/containerImages@2025-08-01-preview' = {
name: 'myImage'
properties: {
environment: environment
application: myApp.id
image: 'ghcr.io/myorg/myapp:latest'
build: {
context: '/app/src/myapp'
}
}
}

Registry credentials are configured by the platform engineer when registering the recipe. Developers do not need to manage credentials.

To reference the built image in a Container resource:

resource myContainer 'Radius.Compute/containers@2025-08-01-preview' = {
name: 'myContainer'
properties: {
environment: environment
application: myApp.id
containers: {
app: {
image: myImage.properties.image
ports: {
web: {
containerPort: 3000
}
}
}
}
}
}

Prerequisites:

1. The Kubernetes cluster must have the source directory available on the node. For kind, use `extraMounts`. For k3d, use `-v` flags.

2. Registry credentials must be configured as recipe parameters when registering the recipe:

rad recipe register default --resource-type Radius.Compute/containerImages --template-kind terraform --template-path git::https://github.com/radius-project/resource-types-contrib.git//Compute/containerImages/recipes/kubernetes/terraform --parameters ghcr_username=USERNAME --parameters ghcr_token=PAT

apiVersions:
'2025-08-01-preview':
schema:
type: object
properties:
environment:
type: string
description: (Required) The Radius Environment ID. Typically set by the rad CLI. Typically value should be `environment`.
application:
type: string
description: (Required) The Radius Application ID. `myApplication.id` for example.
Comment thread
willdavsmith marked this conversation as resolved.
Resolved
image:
type: string
description: (Required) The full container image reference including registry, repository, and tag. `ghcr.io/myorg/myapp:latest` for example. Must be lowercase.
build:
type: object
description: (Required) Build configuration for the container image.
properties:
context:
type: string
description: (Required) The path to the build context directory on the Kubernetes node. This must be a path available on the node, for example via kind extraMounts or k3d volume flags. `/app/src/myapp` for example.
dockerfile:
type: string
description: (Optional) The path to the Dockerfile relative to the build context. If not specified, `Dockerfile` is assumed.
required:
- context
registry:
type: object
description: (Optional) Registry authentication overrides. If not specified, the recipe uses credentials configured by the platform engineer as recipe parameters.
properties:
server:
type: string
description: (Optional) The registry server address. If not specified, `ghcr.io` is assumed.
username:
type: string
description: (Optional) The registry username.
token:
type: string
description: (Optional) The registry token or PAT.
x-radius-sensitive: true
required:
- environment
- application
- image
- build
99 changes: 99 additions & 0 deletions deploy/manifest/built-in-providers/dev/radius_data.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
namespace: Radius.Data
location:
global: "http://localhost:8082"
types:
mySqlDatabases:
description: |
The Radius.Data/mySqlDatabases Resource Type deploys a MySQL database. To deploy a new MySQL database, first add a secret resource with the database credentials to the application definition Bicep file, then add a mySqlDatabases resource referencing the secret name.
```
resource mysql 'Radius.Data/mySqlDatabases@2025-08-01-preview' = {
name: 'mysql'
properties: {
environment: environment
application: myApplication.id
secretName: dbCredentials.name
}
}

resource dbCredentials 'Radius.Security/secrets@2025-08-01-preview' = {
name: 'db-creds'
properties: {
environment: environment
application: myApplication.id
data: {
USERNAME: {
value: 'admin'
}
PASSWORD: {
# From password parameter passed in via CLI
value: password
}
}
}
}
```

When deploying the application definition, provide the database password value as a parameter. It is recommended to use a password generator such as `openssl` or equivalent. For example, `rad deploy app.bicep -p password=$(openssl rand -hex 16)`.

To connect your container to the database, create a connection from the Container resource to the database as shown below.
```
resource myApplication 'Radius.Core/Applications@2025-08-01-preview' = { ... }

resource frontend 'Radius.Compute/containers@2025-08-01-preview' = {
name: 'frontend'
properties: {
application: myApplication.id
environment: environment
container: {
image: 'frontend:1.25'
ports: {
web: {
containerPort: 8080
}
}
}
connections: {
mysqldb: {
source: database.id
}
}
}
}
```

The connection automatically injects environment variables into the container for all properties from the database. The environment variables are named `CONNECTION_<CONNECTION-NAME>_<PROPERTY-NAME>`. In this example, the connection name is `mysqldb` so the environment variables will be:

- CONNECTION_MYSQLDB_DATABASE
- CONNECTION_MYSQLDB_HOST
- CONNECTION_MYSQLDB_PORT

apiVersions:
'2025-08-01-preview':
schema:
type: object
properties:
environment:
type: string
description: "(Required) The Radius EnvironmentID. Typically set by the rad CLI. Typically value should be `environment`"
application:
type: string
description: "(Optional) The Radius Application ID. `myApplication.id` for example."
database:
type: string
description: "(Optional) The name of the database. Defaults to `mysql_db` if not provided."
secretName:
type: string
description: "(Required) The name of the secret containing the database credentials."
version:
type: string
enum: ['5.7', '8.0', '8.4']
description: "(Optional) The major MySQL server version in the X.Y format. Assumed to be 8.4 if not specified."
host:
type: string
description: "(Read-only) The host name used to connect to the database."
readOnly: true
port:
type: integer
description: "(Read-only) The port number used to connect to the database."
readOnly: true
required: [environment,secretName]
107 changes: 107 additions & 0 deletions deploy/manifest/built-in-providers/self-hosted/radius_compute.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -727,3 +727,110 @@ types:
enum: [ReadWriteOnce, ReadOnlyMany, ReadWriteMany]
description: (Optional) The access modes which are permitted to be requested by a Container. Assumed to be all modes if not specified.
required: [environment, sizeInGib]
containerImages:
description: |
The Radius.Compute/containerImages Resource Type builds a container image from source and pushes it to a container registry. It is always part of a Radius Application.

This resource type is designed for local development workflows where the source code is available on the Kubernetes node filesystem (e.g., via kind `extraMounts` or k3d `-v` flags). It uses BuildKit to build and push the image.

To build and push a container image, add a containerImages resource to your application definition Bicep file:

extension radius
extension containerImages

param environment string

resource myApp 'Radius.Core/applications@2025-08-01-preview' = {
name: 'myApp'
properties: {
environment: environment
}
}

resource myImage 'Radius.Compute/containerImages@2025-08-01-preview' = {
name: 'myImage'
properties: {
environment: environment
application: myApp.id
image: 'ghcr.io/myorg/myapp:latest'
build: {
context: '/app/src/myapp'
}
}
}

Registry credentials are configured by the platform engineer when registering the recipe. Developers do not need to manage credentials.

To reference the built image in a Container resource:

resource myContainer 'Radius.Compute/containers@2025-08-01-preview' = {
name: 'myContainer'
properties: {
environment: environment
application: myApp.id
containers: {
app: {
image: myImage.properties.image
ports: {
web: {
containerPort: 3000
}
}
}
}
}
}

Prerequisites:

1. The Kubernetes cluster must have the source directory available on the node. For kind, use `extraMounts`. For k3d, use `-v` flags.

2. Registry credentials must be configured as recipe parameters when registering the recipe:

rad recipe register default --resource-type Radius.Compute/containerImages --template-kind terraform --template-path git::https://github.com/radius-project/resource-types-contrib.git//Compute/containerImages/recipes/kubernetes/terraform --parameters ghcr_username=USERNAME --parameters ghcr_token=PAT

apiVersions:
'2025-08-01-preview':
schema:
type: object
properties:
environment:
type: string
description: (Required) The Radius Environment ID. Typically set by the rad CLI. Typically value should be `environment`.
application:
type: string
description: (Required) The Radius Application ID. `myApplication.id` for example.
image:
type: string
description: (Required) The full container image reference including registry, repository, and tag. `ghcr.io/myorg/myapp:latest` for example. Must be lowercase.
build:
type: object
description: (Required) Build configuration for the container image.
properties:
context:
type: string
description: (Required) The path to the build context directory on the Kubernetes node. This must be a path available on the node, for example via kind extraMounts or k3d volume flags. `/app/src/myapp` for example.
dockerfile:
type: string
description: (Optional) The path to the Dockerfile relative to the build context. If not specified, `Dockerfile` is assumed.
required:
- context
registry:
type: object
description: (Optional) Registry authentication overrides. If not specified, the recipe uses credentials configured by the platform engineer as recipe parameters.
properties:
server:
type: string
description: (Optional) The registry server address. If not specified, `ghcr.io` is assumed.
username:
type: string
description: (Optional) The registry username.
token:
type: string
description: (Optional) The registry token or PAT.
x-radius-sensitive: true
required:
- environment
- application
- image
- build
Loading
Loading