Documentation
¶
Index ¶
- Constants
- func DefaultRecipePackID() string
- func EnsureDefaultResourceGroup(ctx context.Context, createOrUpdate ResourceGroupCreator) error
- func GetOrCreateDefaultRecipePack(ctx context.Context, client *corerpv20250801.RecipePacksClient) (string, error)
- func NewDefaultRecipePackResource() corerpv20250801.RecipePackResource
- func NormalizeRecipePacks(recipePacks []string) []string
- func NotFoundError(recipePack string, recipePackID resources.ID, isFullID bool) error
- func RefExists(environmentRefs []*string, id string) bool
- func ResolveID(recipePack string, workspaceScope string) (id resources.ID, isFullID bool, err error)
- type CoreTypesRecipeInfo
- type ResourceGroupCreator
Constants ¶
const ( // DefaultRecipePackResourceName is the name of the Radius provided // recipe pack resource that contains kubernetes recipes for all core resource types. DefaultRecipePackResourceName = "default" // DefaultResourceGroupName is the name of the default resource group where // the default recipe pack is created and looked up. DefaultResourceGroupName = "default" // DefaultResourceGroupScope is the full scope path for the default resource group. // default recipe pack that Radius provides always live in this scope. DefaultResourceGroupScope = "/planes/radius/local/resourceGroups/" + DefaultResourceGroupName // DefaultRoutesGatewayName is the name of the Gateway installed by the default // Radius-managed Contour installation. DefaultRoutesGatewayName = helm.DefaultContourGatewayName // DefaultRoutesGatewayNamespace is the namespace of the Gateway installed by // the default Radius-managed Contour installation. DefaultRoutesGatewayNamespace = helm.DefaultContourGatewayNamespace )
const ResourceType = "Radius.Core/recipePacks"
ResourceType is the resource type of a recipe pack.
Variables ¶
This section is empty.
Functions ¶
func DefaultRecipePackID ¶
func DefaultRecipePackID() string
DefaultRecipePackID returns the full resource ID of the default recipe pack in the default resource group scope.
func EnsureDefaultResourceGroup ¶
func EnsureDefaultResourceGroup(ctx context.Context, createOrUpdate ResourceGroupCreator) error
EnsureDefaultResourceGroup creates the default resource group if it does not already exist. This must be called before creating the default recipe pack, because recipe packs are stored in the default resource group and the PUT will fail with 404 if the group is missing. The group might be missing in a sequence such as below: 1. rad install 2. rad workspace create kubernetes 3. rad group create prod 4. rad group switch prod 5. .rad deploy <template contains the environment>
func GetOrCreateDefaultRecipePack ¶
func GetOrCreateDefaultRecipePack(ctx context.Context, client *corerpv20250801.RecipePacksClient) (string, error)
GetOrCreateDefaultRecipePack attempts to GET the default recipe pack from the default scope. If it doesn't exist (404), it creates it with all core resource type recipes. Returns the full resource ID.
func NewDefaultRecipePackResource ¶
func NewDefaultRecipePackResource() corerpv20250801.RecipePackResource
NewDefaultRecipePackResource creates a RecipePackResource containing recipes for all core resource types. This is the default recipe pack that gets injected into environments that have no recipe packs configured.
func NormalizeRecipePacks ¶ added in v0.60.0
NormalizeRecipePacks splits comma-separated values, trims whitespace, and removes empty entries and duplicates while preserving the first-seen order. Deduplication avoids redundant referencedBy sync work and prevents server-side recipe pack conflict validation from failing on repeated entries.
func NotFoundError ¶ added in v0.60.0
NotFoundError builds the error returned when a recipe pack passed to --recipe-packs cannot be found. When the user supplied a bare name, the message names the resource group that was searched and shows how to reference a pack in another resource group.
func ResolveID ¶ added in v0.60.0
func ResolveID(recipePack string, workspaceScope string) (id resources.ID, isFullID bool, err error)
ResolveID resolves a recipe pack reference to a full resource ID. The reference may be a full recipe pack resource ID, in which case it is used as-is and isFullID is true, or a bare name, which is scoped to workspaceScope. A value that parses as a resource ID but is not a Radius.Core/recipePacks resource is rejected, so that a mistyped ID of another type is not silently looked up as a recipe pack name.
Types ¶
type CoreTypesRecipeInfo ¶
type CoreTypesRecipeInfo struct {
// ResourceType is the full resource type (e.g., "Radius.Compute/containers").
ResourceType 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
}
CoreTypesRecipeInfo defines a recipe entry for a single resource type in the default recipe pack.
func GetCoreTypesRecipeInfo ¶
func GetCoreTypesRecipeInfo() []CoreTypesRecipeInfo
GetCoreTypesRecipeInfo returns recipe information for all core types. Each definition represents a recipe for one core resource type.
The OCI tag pinned on each recipe source is derived from the build channel and the per-namespace pin recorded in deploy/manifest/defaults.yaml under `resourceTypes`:
- Edge / dev builds (channel == "edge") always use the mutable tag "edge" so a locally-built CLI picks up whatever the recipes publishing pipeline last pushed for the tip of the recipes repository. This matches the "edge" convention used elsewhere for unpinned builds.
- Release builds resolve the recipe's resource-type namespace (e.g. "Radius.Compute" for "Radius.Compute/containers") to the immutable commit SHA that defaults.yaml pins that namespace to, via defaults.ResourceTypePin. The recipes publishing pipeline tags each namespace's OCI artifacts with the same commit SHA, so this guarantees a released rad CLI installs exactly the recipes that were published from the pinned resource-types-contrib revision, regardless of what the mutable "edge" tag currently points at.
- As a defensive fallback, a namespace missing from the defaults.yaml `resourceTypes` list falls back to "edge" so a mis-configured build still installs something rather than producing an invalid OCI reference.
type ResourceGroupCreator ¶
type ResourceGroupCreator func(ctx context.Context, planeName string, resourceGroupName string, resource *ucpv20231001.ResourceGroupResource) error
ResourceGroupCreator is a function that creates or updates a Radius resource group. This is typically satisfied by ApplicationsManagementClient.CreateOrUpdateResourceGroup.