Skip to content

setup recipepack and new environment as part of rad init #11161

Closed
nithyatsu wants to merge 12 commits intoradius-project:mainfrom
nithyatsu:setupkubepack
Closed

setup recipepack and new environment as part of rad init #11161
nithyatsu wants to merge 12 commits intoradius-project:mainfrom
nithyatsu:setupkubepack

Conversation

@nithyatsu
Copy link
Copy Markdown
Contributor

@nithyatsu nithyatsu commented Feb 3, 2026

Description

Both rad init and rad install kubernetes now automatically create a default local-dev recipe pack with built-in Bicep recipes for Radius resource types. The rad init flow also links this recipe pack to the newly created Radius.Core/environments resource.

Type of change

  • This pull request fixes a bug in Radius and has an approved issue (issue link required).
  • This pull request adds or changes features of Radius and has an approved issue (issue link required).
  • This pull request is a minor refactor, code cleanup, test improvement, or other maintenance task and doesn't change the functionality of Radius (issue link optional).

Fixes: #issue_number

Contributor checklist

Please verify that the PR meets the following requirements, where applicable:

  • An overview of proposed schema changes is included in a linked GitHub issue.
    • Yes
    • Not applicable
  • A design document PR is created in the design-notes repository, if new APIs are being introduced.
    • Yes
    • Not applicable
  • The design document has been reviewed and approved by Radius maintainers/approvers.
    • Yes
    • Not applicable
  • A PR for the samples repository is created, if existing samples are affected by the changes in this PR.
    • Yes
    • Not applicable
  • A PR for the documentation repository is created, if the changes in this PR affect the documentation or any user facing updates are made.
    • Yes
    • Not applicable
  • A PR for the recipes repository is created, if existing recipes are affected by the changes in this PR.
    • Yes
    • Not applicable

@nithyatsu nithyatsu had a problem deploying to external-contributor-approval February 4, 2026 17:49 — with GitHub Actions Failure
@nithyatsu nithyatsu changed the title setup recipepack as part of rad init and install setup recipepack as part of rad init Feb 5, 2026
@nithyatsu nithyatsu had a problem deploying to external-contributor-approval February 5, 2026 17:53 — with GitHub Actions Failure
@nithyatsu nithyatsu had a problem deploying to external-contributor-approval February 5, 2026 18:14 — with GitHub Actions Failure
@nithyatsu nithyatsu had a problem deploying to external-contributor-approval February 5, 2026 21:03 — with GitHub Actions Failure
@nithyatsu nithyatsu had a problem deploying to external-contributor-approval February 5, 2026 21:05 — with GitHub Actions Failure
@nithyatsu nithyatsu had a problem deploying to external-contributor-approval February 5, 2026 21:30 — with GitHub Actions Failure
@nithyatsu nithyatsu marked this pull request as ready for review February 5, 2026 21:31
@nithyatsu nithyatsu requested review from a team as code owners February 5, 2026 21:31
Signed-off-by: nithyatsu <nithyasu@microsoft.com>
Signed-off-by: nithyatsu <nithyasu@microsoft.com>
Signed-off-by: nithyatsu <nithyasu@microsoft.com>
Signed-off-by: nithyatsu <nithyasu@microsoft.com>
Signed-off-by: nithyatsu <nithyasu@microsoft.com>
Signed-off-by: nithyatsu <nithyasu@microsoft.com>
Signed-off-by: nithyatsu <nithyasu@microsoft.com>
Signed-off-by: nithyatsu <nithyasu@microsoft.com>
Signed-off-by: nithyatsu <nithyasu@microsoft.com>
Signed-off-by: nithyatsu <nithyasu@microsoft.com>
Signed-off-by: nithyatsu <nithyasu@microsoft.com>
@nithyatsu nithyatsu temporarily deployed to external-contributor-approval February 5, 2026 21:31 — with GitHub Actions Inactive
@radius-functional-tests
Copy link
Copy Markdown

radius-functional-tests Bot commented Feb 5, 2026

Radius functional test overview

🔍 Go to test action run

Click here to see the test run details
Name Value
Repository nithyatsu/radius
Commit ref 7428414
Unique ID func4fe3c7edae
Image tag pr-func4fe3c7edae
  • gotestsum 1.13.0
  • KinD: v0.29.0
  • Dapr: 1.14.4
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.3.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-func4fe3c7edae
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-func4fe3c7edae
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-func4fe3c7edae
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func4fe3c7edae
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func4fe3c7edae
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting corerp-cloud functional tests...
⌛ Starting ucp-cloud functional tests...
❌ ucp-cloud functional test failed. Please check the logs for more details
❌ corerp-cloud functional test cancelled. Please check the logs for more details
⌛ Starting ucp-cloud functional tests...
✅ ucp-cloud functional tests succeeded
⌛ Starting corerp-cloud functional tests...
✅ corerp-cloud functional tests succeeded

@nithyatsu nithyatsu changed the title setup recipepack as part of rad init setup recipepack and new environment as part of rad init Feb 5, 2026
@kachawla kachawla requested a review from Copilot February 9, 2026 18:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Signed-off-by: nithyatsu <nithyasu@microsoft.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.


func Test_NewSingletonRecipePackResource(t *testing.T) {
resourceType := "Radius.Compute/containers"
recipeLocation := "ghcr.io/radius-project/kube-recipes/containers@latest"
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test uses an OCI reference with @latest, but @ is for digests (e.g. @sha256:...) while tags use :latest. Use a syntactically correct reference (and ideally match the format used in GetSingletonRecipePackDefinitions) to avoid propagating an invalid example.

Suggested change
recipeLocation := "ghcr.io/radius-project/kube-recipes/containers@latest"
recipeLocation := "ghcr.io/radius-project/kube-recipes/containers:latest"

Copilot uses AI. Check for mistakes.
}

workspace.Environment = fmt.Sprintf("/planes/radius/local/resourceGroups/%s/providers/Applications.Core/environments/%s", options.Environment.Name, options.Environment.Name)
workspace.Environment = fmt.Sprintf("/planes/radius/local/resourceGroups/%s/providers/Radius.Core/environments/%s", options.Environment.Name, options.Environment.Name)
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workspace environment ID is now hard-coded to the Radius.Core provider, but selectExistingEnvironment still lists Applications.Core/environments via the ApplicationsManagementClient. If the user selects an existing (Applications.Core) environment, the saved workspace will point at a different (Radius.Core) resource that may not exist. Update the existing-environment discovery/selection to use the Radius.Core Environments API (v20250801preview) or otherwise ensure the provider segment matches the selected environment type.

Suggested change
workspace.Environment = fmt.Sprintf("/planes/radius/local/resourceGroups/%s/providers/Radius.Core/environments/%s", options.Environment.Name, options.Environment.Name)
workspace.Environment = fmt.Sprintf("/planes/radius/local/resourceGroups/%s/providers/Applications.Core/environments/%s", options.Environment.Name, options.Environment.Name)

Copilot uses AI. Check for mistakes.
selectExistingEnvironmentPrompt = "Select an existing environment or create a new one"
selectExistingEnvironmentCreateSentinel = "[create new]"
enterNamespacePrompt = "Enter a namespace name to deploy apps into"
enterNamespacePrompt = "Enter a namespace name to deploy apps into. The namespace must exist in the Kubernetes cluster."
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prompt says the namespace "must exist" in the cluster, but the current validation (prompt.ValidateResourceNameOrDefault) only checks the name format and does not verify existence against Kubernetes. Either add an existence check (using the Kubernetes client) or soften the prompt text to avoid misleading users.

Suggested change
enterNamespacePrompt = "Enter a namespace name to deploy apps into. The namespace must exist in the Kubernetes cluster."
enterNamespacePrompt = "Enter a namespace name to deploy apps into."

Copilot uses AI. Check for mistakes.
Comment on lines +94 to +113
// Create singleton recipe packs (one per resource type) and link them to the environment.
// Singletons always live in the default resource group scope, regardless of the workspace scope.
if r.DefaultScopeClientFactory == nil {
defaultClientFactory, err := cmd.InitializeRadiusCoreClientFactory(ctx, r.Workspace, recipepack.DefaultResourceGroupScope)
if err != nil {
return clierrors.MessageWithCause(err, "Failed to initialize Radius Core client for default scope.")
}
r.DefaultScopeClientFactory = defaultClientFactory
}
recipePackIDs, err := recipepack.CreateSingletonRecipePacks(ctx, r.DefaultScopeClientFactory.NewRecipePacksClient())
if err != nil {
return clierrors.MessageWithCause(err, "Failed to create recipe packs.")
}

// Link all recipe packs to the environment
recipePackPtrs := make([]*string, len(recipePackIDs))
for i, id := range recipePackIDs {
recipePackPtrs[i] = to.Ptr(id)
}
envProperties.RecipePacks = recipePackPtrs
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CreateEnvironment now always creates and links singleton recipe packs, but the options.Recipes.DevRecipes flag is still being set (and is used in the UI summary) to indicate whether a "local-dev" recipe pack will be configured. This can cause the CLI to report different behavior than what actually happens. Either respect the flag here (skip recipe pack creation when false) or remove/repurpose the flag and update the UI messaging accordingly.

Suggested change
// Create singleton recipe packs (one per resource type) and link them to the environment.
// Singletons always live in the default resource group scope, regardless of the workspace scope.
if r.DefaultScopeClientFactory == nil {
defaultClientFactory, err := cmd.InitializeRadiusCoreClientFactory(ctx, r.Workspace, recipepack.DefaultResourceGroupScope)
if err != nil {
return clierrors.MessageWithCause(err, "Failed to initialize Radius Core client for default scope.")
}
r.DefaultScopeClientFactory = defaultClientFactory
}
recipePackIDs, err := recipepack.CreateSingletonRecipePacks(ctx, r.DefaultScopeClientFactory.NewRecipePacksClient())
if err != nil {
return clierrors.MessageWithCause(err, "Failed to create recipe packs.")
}
// Link all recipe packs to the environment
recipePackPtrs := make([]*string, len(recipePackIDs))
for i, id := range recipePackIDs {
recipePackPtrs[i] = to.Ptr(id)
}
envProperties.RecipePacks = recipePackPtrs
// Create singleton recipe packs (one per resource type) and link them to the environment
// when dev recipes are enabled. Singletons always live in the default resource group scope,
// regardless of the workspace scope.
if r.Options.Recipes.DevRecipes {
if r.DefaultScopeClientFactory == nil {
defaultClientFactory, err := cmd.InitializeRadiusCoreClientFactory(ctx, r.Workspace, recipepack.DefaultResourceGroupScope)
if err != nil {
return clierrors.MessageWithCause(err, "Failed to initialize Radius Core client for default scope.")
}
r.DefaultScopeClientFactory = defaultClientFactory
}
recipePackIDs, err := recipepack.CreateSingletonRecipePacks(ctx, r.DefaultScopeClientFactory.NewRecipePacksClient())
if err != nil {
return clierrors.MessageWithCause(err, "Failed to create recipe packs.")
}
// Link all recipe packs to the environment
recipePackPtrs := make([]*string, len(recipePackIDs))
for i, id := range recipePackIDs {
recipePackPtrs[i] = to.Ptr(id)
}
envProperties.RecipePacks = recipePackPtrs
}

Copilot uses AI. Check for mistakes.
Comment on lines +27 to +72
const (
// DefaultRecipePackName is the name of the default Kubernetes recipe pack.
DefaultRecipePackName = "local-dev"

// DefaultResourceGroupName is the name of the default resource group where singleton recipe packs are stored.
DefaultResourceGroupName = "default"

// DefaultResourceGroupScope is the full scope for the default resource group.
DefaultResourceGroupScope = "/planes/radius/local/resourceGroups/default"
)

// SingletonRecipePackDefinition defines a singleton recipe pack for a single resource type.
type SingletonRecipePackDefinition struct {
// Name is the name of the recipe pack (derived from resource type).
Name string
// ResourceType is the full resource type (e.g., "Radius.Compute/containers").
ResourceType string
// RecipeLocation is the OCI registry location for the recipe.
RecipeLocation string
}

// GetSingletonRecipePackDefinitions returns the list of singleton recipe pack definitions.
// Each definition represents a single recipe pack containing one recipe for one resource type.
func GetSingletonRecipePackDefinitions() []SingletonRecipePackDefinition {
return []SingletonRecipePackDefinition{
{
Name: "containers",
ResourceType: "Radius.Compute/containers",
RecipeLocation: "ghcr.io/radius-project/kube-recipes/containers:latest",
},
{
Name: "persistentvolumes",
ResourceType: "Radius.Compute/persistentVolumes",
RecipeLocation: "ghcr.io/radius-project/kube-recipes/persistentvolumes:latest",
},
{
Name: "routes",
ResourceType: "Radius.Compute/routes",
RecipeLocation: "ghcr.io/radius-project/kube-recipes/routes:latest",
},
{
Name: "secrets",
ResourceType: "Radius.Security/secrets",
RecipeLocation: "ghcr.io/radius-project/kube-recipes/secrets:latest",
},
}
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description mentions creating a default "local-dev" recipe pack, but this code creates multiple recipe packs named after resource types (e.g. "containers", "routes") and never uses DefaultRecipePackName. Either create a single recipe pack named local-dev (containing multiple recipes) or update naming/constants/docs so the implementation and description match.

Copilot uses AI. Check for mistakes.
@nithyatsu nithyatsu closed this Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants