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
12 changes: 6 additions & 6 deletions docs/architecture/extensibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ properties:
properties:
recipes:
Radius.Data/redisCaches:
recipeKind: bicep
recipeLocation: ghcr.io/.../redis:1.0.0
kind: bicep
source: ghcr.io/.../redis:1.0.0
plainHttp: false
parameters: { ... }
```
Expand Down Expand Up @@ -400,8 +400,8 @@ The engine
`EnvironmentDefinition` whose `Driver` field is the `TemplateKind` string.
For `Radius.Core` environments, this fetches the referenced recipe packs,
finds the definition keyed by the resource type, applies matching
environment-level recipe parameter overrides, and maps `RecipeKind` /
`RecipeLocation` into the same `EnvironmentDefinition` shape.
environment-level recipe parameter overrides, and maps `Kind` /
`Source` into the same `EnvironmentDefinition` shape.
4. Selects the driver from the engine's `Drivers` map keyed by
`EnvironmentDefinition.Driver`
(see
Expand Down Expand Up @@ -480,7 +480,7 @@ up before the Radius resource record is removed.
- Dynamic resources default to recipe name `default` when `properties.recipe`
is omitted.
- The driver lookup key is the recipe's `templateKind` for
`Applications.Core` recipes and the mapped `recipeKind` for
`Applications.Core` recipes and the mapped `kind` for
`Radius.Core` recipe packs. Adding a new driver means registering it in the
engine's `Drivers` map.
- Dynamic recipe output only becomes user-visible resource properties when
Expand All @@ -500,7 +500,7 @@ up before the Radius resource record is removed.
recipe through the environment recipe map or a recipe pack used by tests.
- Adding a new recipe driver: implement `recipes/driver.Driver`, register it
in [controllerconfig/config.go](../../pkg/recipes/controllerconfig/config.go),
and pick a stable driver key used by `templateKind` or `recipeKind`.
and pick a stable driver key used by `templateKind` or `kind`.
- Adding a new capability that changes the deployment path: extend
`DynamicResourceController.selectController` and add the corresponding
controller under
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1581,7 +1581,7 @@
"$type": "ObjectType",
"name": "RecipeDefinition",
"properties": {
"recipeKind": {
"kind": {
"type": {
"$ref": "#/138"
},
Expand All @@ -1593,14 +1593,14 @@
"$ref": "#/29"
},
"flags": 0,
"description": "Connect to the location using HTTP (not HTTPS). This should be used when the location is known not to support HTTPS, for example in a locally hosted registry for Bicep recipes. Defaults to false (use HTTPS/TLS)"
"description": "Connect to the source using HTTP (not HTTPS). This should be used when the source is known not to support HTTPS, for example in a locally hosted registry for Bicep recipes. Defaults to false (use HTTPS/TLS)"
},
"recipeLocation": {
"source": {
"type": {
"$ref": "#/0"
},
"flags": 1,
"description": "URL path to the recipe"
"description": "The source of the recipe. For Bicep recipes this is the OCI registry reference. For Terraform recipes this is the module source."
},
"parameters": {
"type": {
Expand Down
30 changes: 22 additions & 8 deletions pkg/cli/cmd/env/show/preview/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ rad env show my-env --group my-env
}

type EnvRecipes struct {
RecipePack string
ResourceType string
RecipeKind string
RecipeLocation string
RecipePack string
ResourceType string
Kind string
Source string
}

// Runner is the runner implementation for the `rad env show` preview command.
Expand Down Expand Up @@ -188,11 +188,25 @@ func (r *Runner) Run(ctx context.Context) error {
}

for resourceType, recipe := range pack.RecipePackResource.Properties.Recipes {
if recipe == nil {
continue
}

kind := "unknown"
Comment thread
willdavsmith marked this conversation as resolved.
if recipe.Kind != nil {
kind = string(*recipe.Kind)
}

source := ""
if recipe.Source != nil {
source = *recipe.Source
}

envRecipes = append(envRecipes, EnvRecipes{
RecipePack: ID.Name(),
ResourceType: resourceType,
RecipeKind: string(*recipe.RecipeKind),
RecipeLocation: *recipe.RecipeLocation,
RecipePack: ID.Name(),
ResourceType: resourceType,
Kind: kind,
Source: source,
})
}
}
Expand Down
40 changes: 20 additions & 20 deletions pkg/cli/cmd/env/show/preview/show_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,16 @@ func Test_Run(t *testing.T) {
Format: "table",
Obj: []EnvRecipes{
{
RecipePack: "test-recipe-pack",
ResourceType: "test-recipe1",
RecipeKind: string(corerpv20250801.RecipeKindTerraform),
RecipeLocation: "https://example.com/recipe1?ref=v0.1",
RecipePack: "test-recipe-pack",
ResourceType: "test-recipe1",
Kind: string(corerpv20250801.RecipeKindTerraform),
Source: "https://example.com/recipe1?ref=v0.1",
},
{
RecipePack: "test-recipe-pack",
ResourceType: "test-recipe2",
RecipeKind: string(corerpv20250801.RecipeKindTerraform),
RecipeLocation: "https://example.com/recipe2?ref=v0.1",
RecipePack: "test-recipe-pack",
ResourceType: "test-recipe2",
Kind: string(corerpv20250801.RecipeKindTerraform),
Source: "https://example.com/recipe2?ref=v0.1",
},
},
Options: objectformats.GetRecipesForEnvironmentTableFormat(),
Expand Down Expand Up @@ -244,23 +244,23 @@ func Test_Run_RecipeSortOrder(t *testing.T) {
if recipePackName == "pack-a" {
recipes = map[string]*corerpv20250801.RecipeDefinition{
"Applications.Datastores/sqlDatabases": {
RecipeLocation: new("ghcr.io/radius-project/recipes/sql"),
RecipeKind: to.Ptr(corerpv20250801.RecipeKindTerraform),
Source: new("ghcr.io/radius-project/recipes/sql"),
Kind: to.Ptr(corerpv20250801.RecipeKindTerraform),
},
"Applications.Datastores/redisCaches": {
RecipeLocation: new("ghcr.io/radius-project/recipes/redis"),
RecipeKind: to.Ptr(corerpv20250801.RecipeKindTerraform),
Source: new("ghcr.io/radius-project/recipes/redis"),
Kind: to.Ptr(corerpv20250801.RecipeKindTerraform),
},
}
} else {
recipes = map[string]*corerpv20250801.RecipeDefinition{
"Applications.Messaging/rabbitMQQueues": {
RecipeLocation: new("ghcr.io/radius-project/recipes/rabbitmq"),
RecipeKind: to.Ptr(corerpv20250801.RecipeKindBicep),
Source: new("ghcr.io/radius-project/recipes/rabbitmq"),
Kind: to.Ptr(corerpv20250801.RecipeKindBicep),
},
"Applications.Dapr/stateStores": {
RecipeLocation: new("ghcr.io/radius-project/recipes/dapr-state"),
RecipeKind: to.Ptr(corerpv20250801.RecipeKindBicep),
Source: new("ghcr.io/radius-project/recipes/dapr-state"),
Kind: to.Ptr(corerpv20250801.RecipeKindBicep),
},
}
}
Expand Down Expand Up @@ -295,10 +295,10 @@ func Test_Run_RecipeSortOrder(t *testing.T) {

// Verify the recipes are sorted by RecipePack first, then by ResourceType
expectedRecipes := []EnvRecipes{
{RecipePack: "pack-a", ResourceType: "Applications.Datastores/redisCaches", RecipeKind: "terraform", RecipeLocation: "ghcr.io/radius-project/recipes/redis"},
{RecipePack: "pack-a", ResourceType: "Applications.Datastores/sqlDatabases", RecipeKind: "terraform", RecipeLocation: "ghcr.io/radius-project/recipes/sql"},
{RecipePack: "pack-b", ResourceType: "Applications.Dapr/stateStores", RecipeKind: "bicep", RecipeLocation: "ghcr.io/radius-project/recipes/dapr-state"},
{RecipePack: "pack-b", ResourceType: "Applications.Messaging/rabbitMQQueues", RecipeKind: "bicep", RecipeLocation: "ghcr.io/radius-project/recipes/rabbitmq"},
{RecipePack: "pack-a", ResourceType: "Applications.Datastores/redisCaches", Kind: "terraform", Source: "ghcr.io/radius-project/recipes/redis"},
{RecipePack: "pack-a", ResourceType: "Applications.Datastores/sqlDatabases", Kind: "terraform", Source: "ghcr.io/radius-project/recipes/sql"},
{RecipePack: "pack-b", ResourceType: "Applications.Dapr/stateStores", Kind: "bicep", Source: "ghcr.io/radius-project/recipes/dapr-state"},
{RecipePack: "pack-b", ResourceType: "Applications.Messaging/rabbitMQQueues", Kind: "bicep", Source: "ghcr.io/radius-project/recipes/rabbitmq"},
}

// The third output should be the recipes table
Expand Down
12 changes: 6 additions & 6 deletions pkg/cli/cmd/recipepack/show/display.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,18 @@ func (r *Runner) display(recipePack v20250801preview.RecipePackResource) error {
}

kind := "unknown"
if definition.RecipeKind != nil {
kind = string(*definition.RecipeKind)
if definition.Kind != nil {
kind = string(*definition.Kind)
}

location := ""
if definition.RecipeLocation != nil {
location = *definition.RecipeLocation
source := ""
if definition.Source != nil {
source = *definition.Source
}

r.Output.LogInfo("%s", resourceType)
r.Output.LogInfo(" Kind: %s", kind)
r.Output.LogInfo(" Location: %s", location)
r.Output.LogInfo(" Source: %s", source)

if len(definition.Parameters) > 0 {
formatted, err := formatRecipeParameters(definition.Parameters)
Expand Down
4 changes: 2 additions & 2 deletions pkg/cli/cmd/recipepack/show/show_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ func Test_Run(t *testing.T) {
Properties: &corerpv20250801preview.RecipePackProperties{
Recipes: map[string]*corerpv20250801preview.RecipeDefinition{
"Radius.Core/example": {
RecipeKind: to.Ptr(corerpv20250801preview.RecipeKindTerraform),
RecipeLocation: new("https://github.com/radius-project/example"),
Kind: to.Ptr(corerpv20250801preview.RecipeKindTerraform),
Source: new("https://github.com/radius-project/example"),
Parameters: map[string]any{
"foo": "bar",
},
Expand Down
16 changes: 8 additions & 8 deletions pkg/cli/objectformats/objectformats.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ func GetRecipeFormat() output.FormatterOptions {
},
{
Heading: "RECIPE KIND",
JSONPath: "{ .RecipeKind }",
JSONPath: "{ .Kind }",
},
{
Heading: "RECIPE LOCATION",
JSONPath: "{ .RecipeLocation }",
Heading: "RECIPE SOURCE",
JSONPath: "{ .Source }",
},
},
}
Expand All @@ -90,11 +90,11 @@ func GetRecipeFormatWithoutHeadings() output.FormatterOptions {
},
{
Heading: "",
JSONPath: "{ .RecipeKind }",
JSONPath: "{ .Kind }",
},
{
Heading: "",
JSONPath: "{ .RecipeLocation }",
JSONPath: "{ .Source }",
},
},
}
Expand Down Expand Up @@ -141,11 +141,11 @@ func GetRecipesForEnvironmentTableFormat() output.FormatterOptions {
},
{
Heading: "RECIPE KIND",
JSONPath: "{ .RecipeKind }",
JSONPath: "{ .Kind }",
},
{
Heading: "RECIPE LOCATION",
JSONPath: "{ .RecipeLocation }",
Heading: "RECIPE SOURCE",
JSONPath: "{ .Source }",
},
},
}
Expand Down
30 changes: 15 additions & 15 deletions pkg/cli/recipepack/recipepack.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ func NewDefaultRecipePackResource() corerpv20250801.RecipePackResource {
recipes := make(map[string]*corerpv20250801.RecipeDefinition)
for _, def := range GetCoreTypesRecipeInfo() {
recipes[def.ResourceType] = &corerpv20250801.RecipeDefinition{
RecipeKind: &bicepKind,
RecipeLocation: to.Ptr(def.RecipeLocation),
Parameters: def.Parameters,
Kind: &bicepKind,
Source: to.Ptr(def.Source),
Parameters: def.Parameters,
}
}
return corerpv20250801.RecipePackResource{
Expand Down Expand Up @@ -120,8 +120,8 @@ func GetOrCreateDefaultRecipePack(ctx context.Context, client *corerpv20250801.R
type CoreTypesRecipeInfo struct {
// ResourceType is the full resource type (e.g., "Radius.Compute/containers").
ResourceType string
// RecipeLocation is the OCI registry location for the recipe.
RecipeLocation string
// Source is the OCI registry location for the recipe.
Source string
// Parameters is the optional parameter bag passed to the recipe.
Parameters map[string]any
}
Expand All @@ -137,28 +137,28 @@ func GetCoreTypesRecipeInfo() []CoreTypesRecipeInfo {
}
return []CoreTypesRecipeInfo{
{
ResourceType: "Radius.Compute/containers",
RecipeLocation: "ghcr.io/radius-project/kube-recipes/containers:" + tag,
ResourceType: "Radius.Compute/containers",
Source: "ghcr.io/radius-project/kube-recipes/containers:" + tag,
},
{
ResourceType: "Radius.Compute/persistentVolumes",
RecipeLocation: "ghcr.io/radius-project/kube-recipes/persistentvolumes:" + tag,
ResourceType: "Radius.Compute/persistentVolumes",
Source: "ghcr.io/radius-project/kube-recipes/persistentvolumes:" + tag,
},
{
ResourceType: "Radius.Compute/routes",
RecipeLocation: "ghcr.io/radius-project/kube-recipes/routes:" + tag,
ResourceType: "Radius.Compute/routes",
Source: "ghcr.io/radius-project/kube-recipes/routes:" + tag,
Parameters: map[string]any{
"gatewayName": DefaultRoutesGatewayName,
"gatewayNamespace": DefaultRoutesGatewayNamespace,
},
},
{
ResourceType: "Radius.Security/secrets",
RecipeLocation: "ghcr.io/radius-project/kube-recipes/secrets:" + tag,
ResourceType: "Radius.Security/secrets",
Source: "ghcr.io/radius-project/kube-recipes/secrets:" + tag,
},
{
ResourceType: "Radius.Data/mySqlDatabases",
RecipeLocation: "ghcr.io/radius-project/kube-recipes/mysqldatabases:" + tag,
ResourceType: "Radius.Data/mySqlDatabases",
Source: "ghcr.io/radius-project/kube-recipes/mysqldatabases:" + tag,
},
}
}
14 changes: 7 additions & 7 deletions pkg/cli/recipepack/recipepack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func Test_GetDefaultRecipePackDefinition(t *testing.T) {
actualResourceTypes := make([]string, len(definitions))
for i, def := range definitions {
actualResourceTypes[i] = def.ResourceType
require.NotEmpty(t, def.RecipeLocation, "RecipeLocation should not be empty for %s", def.ResourceType)
require.NotEmpty(t, def.Source, "Source should not be empty for %s", def.ResourceType)
}
require.ElementsMatch(t, expectedResourceTypes, actualResourceTypes)
}
Expand All @@ -53,8 +53,8 @@ func Test_GetDefaultRecipePackDefinition_UsesLatestTagForEdgeChannel(t *testing.

definitions := GetCoreTypesRecipeInfo()
for _, def := range definitions {
require.True(t, strings.HasSuffix(def.RecipeLocation, ":latest"),
"Expected :latest tag for edge channel, got %s", def.RecipeLocation)
require.True(t, strings.HasSuffix(def.Source, ":latest"),
"Expected :latest tag for edge channel, got %s", def.Source)
}
}

Expand All @@ -76,10 +76,10 @@ func Test_NewDefaultRecipePackResource(t *testing.T) {
for _, def := range definitions {
recipe, exists := resource.Properties.Recipes[def.ResourceType]
require.True(t, exists, "Expected recipe for resource type %s to exist", def.ResourceType)
require.NotNil(t, recipe.RecipeKind)
require.Equal(t, corerpv20250801.RecipeKindBicep, *recipe.RecipeKind)
require.NotNil(t, recipe.RecipeLocation)
require.Equal(t, def.RecipeLocation, *recipe.RecipeLocation)
require.NotNil(t, recipe.Kind)
require.Equal(t, corerpv20250801.RecipeKindBicep, *recipe.Kind)
require.NotNil(t, recipe.Source)
require.Equal(t, def.Source, *recipe.Source)
require.Equal(t, def.Parameters, recipe.Parameters)
}

Expand Down
Loading
Loading