Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
65081b9
update rad install
nithyatsu Feb 3, 2026
10c5bc2
rad init uses new env
nithyatsu Feb 3, 2026
4e4bf8a
check default rg
nithyatsu Feb 10, 2026
8933fc8
wip
nithyatsu Feb 10, 2026
3b37f5d
update tests
nithyatsu Feb 10, 2026
f9e7294
wip
nithyatsu Feb 10, 2026
7aaf0ab
refactor
nithyatsu Feb 11, 2026
df8323a
fix for recipepack reference from template
nithyatsu Feb 11, 2026
f79a9f8
Update rad init
nithyatsu Feb 19, 2026
6d29dd3
remove changes to update
nithyatsu Feb 19, 2026
aa50904
rad init updates
nithyatsu Feb 19, 2026
019c8eb
update env create
nithyatsu Feb 19, 2026
d9dc987
add comments - deploy
nithyatsu Feb 23, 2026
3b50081
update create -refactor
nithyatsu Feb 23, 2026
fbf3313
wip
nithyatsu Feb 23, 2026
fccc041
wip
nithyatsu Feb 23, 2026
8ba677b
rad env update changes
nithyatsu Feb 25, 2026
ba5db63
remove findRadiusCoreEnvironmentResources function
nithyatsu Mar 18, 2026
f0afee7
refactoring GetOrCreateDefaultRecipePack into recipepack.go
nithyatsu Mar 18, 2026
8b474ee
refactor
nithyatsu Mar 18, 2026
8a272aa
refactor
nithyatsu Mar 18, 2026
52c9d54
refactor
nithyatsu Mar 18, 2026
ed8ccd3
add tests to cover CreateOrUpdateResourceGroup errors
nithyatsu Mar 18, 2026
f4acb15
add tests and a warning about recipe packs replacement.
nithyatsu Mar 18, 2026
7002f4b
bring back old test cases
nithyatsu Mar 18, 2026
d2a5b74
remove dev recipe related code.
nithyatsu Mar 19, 2026
af87370
remove obsolete tests
nithyatsu Mar 19, 2026
cb81c27
refactoring
nithyatsu Mar 19, 2026
74d3c7a
fix errors
nithyatsu Apr 13, 2026
7e6538e
rad init support new and old env
nithyatsu Apr 13, 2026
e4e5c49
refactor applications.go
nithyatsu Apr 14, 2026
d347786
refactor common code
nithyatsu Apr 14, 2026
5aec669
wip
nithyatsu Apr 23, 2026
6459702
wip
nithyatsu Apr 23, 2026
0a3aa69
wip
nithyatsu Apr 23, 2026
893ff4b
pop up rad core env list
nithyatsu Apr 29, 2026
07a4cf1
wip
nithyatsu Apr 29, 2026
abcee35
wip
nithyatsu Apr 29, 2026
d142b77
wip
nithyatsu Apr 30, 2026
cd710e6
wip
nithyatsu Apr 30, 2026
5524a3b
wip confirm to mockgen version on CI
nithyatsu Apr 30, 2026
392506f
fix text
nithyatsu May 4, 2026
4707b77
refactor
nithyatsu May 4, 2026
79ca800
refactor
nithyatsu May 4, 2026
760d31f
wip
nithyatsu May 4, 2026
5bc5b4b
refactor
nithyatsu May 4, 2026
5ee7e48
Merge branch 'main' into working
nithyatsu May 5, 2026
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
3 changes: 3 additions & 0 deletions cmd/rad/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import (
"github.com/radius-project/radius/pkg/cli/cmd/install"
install_kubernetes "github.com/radius-project/radius/pkg/cli/cmd/install/kubernetes"
"github.com/radius-project/radius/pkg/cli/cmd/radinit"
radinit_preview "github.com/radius-project/radius/pkg/cli/cmd/radinit/preview"
recipe_list "github.com/radius-project/radius/pkg/cli/cmd/recipe/list"
recipe_register "github.com/radius-project/radius/pkg/cli/cmd/recipe/register"
recipe_show "github.com/radius-project/radius/pkg/cli/cmd/recipe/show"
Expand Down Expand Up @@ -342,6 +343,8 @@ func initSubCommands() {
RootCmd.AddCommand(groupCmd)

initCmd, _ := radinit.NewCommand(framework)
previewInitCmd, _ := radinit_preview.NewCommand(framework)
wirePreviewSubcommand(initCmd, previewInitCmd)
Comment thread
nithyatsu marked this conversation as resolved.
RootCmd.AddCommand(initCmd)

envCreateCmd, _ := env_create.NewCommand(framework)
Expand Down
14 changes: 14 additions & 0 deletions pkg/cli/bicep/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ var radiusNamespacePatterns = []string{
type TemplateInspectionResult struct {
// ContainsEnvironmentResource indicates whether the template contains an environment resource.
ContainsEnvironmentResource bool

// EnvironmentResources contains the list of environment resources found in the template.
EnvironmentResources []map[string]any
}

// ResourceTypeEntry represents a parsed resource type from a compiled Bicep/ARM template.
Expand Down Expand Up @@ -169,6 +172,11 @@ func InspectTemplateResources(template map[string]any) TemplateInspectionResult
strings.HasPrefix(resourceTypeLower, legacyEnvironmentResourceType) {
result.ContainsEnvironmentResource = true
}

// add Radius.Core environment resources to the result list
if strings.HasPrefix(resourceTypeLower, environmentResourceType) {
result.EnvironmentResources = append(result.EnvironmentResources, resource)
}
}

return result
Expand All @@ -182,3 +190,9 @@ func InspectTemplateResources(template map[string]any) TemplateInspectionResult
func ContainsEnvironmentResource(template map[string]any) bool {
return InspectTemplateResources(template).ContainsEnvironmentResource
}

// GetEnvironmentResources inspects the compiled Radius Bicep template's resources and returns
// all environment resources found as maps.
func GetEnvironmentResources(template map[string]any) []map[string]any {
return InspectTemplateResources(template).EnvironmentResources
}
Comment thread
nithyatsu marked this conversation as resolved.
3 changes: 3 additions & 0 deletions pkg/cli/clients/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ type ApplicationsManagementClient interface {
// ListEnvironmentsAll lists all environments across resource groups.
ListEnvironmentsAll(ctx context.Context) ([]corerp.EnvironmentResource, error)

// ListRadiusCoreEnvironmentsAll lists all Radius.Core environments across resource groups.
ListRadiusCoreEnvironmentsAll(ctx context.Context) ([]radiuscore.EnvironmentResource, error)

// ListRecipePacksInResourceGroup lists all recipe packs in the configured scope (assumes configured scope is a resource group).
ListRecipePacksInResourceGroup(ctx context.Context) ([]radiuscore.RecipePackResource, error)

Expand Down
74 changes: 62 additions & 12 deletions pkg/cli/clients/management.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,19 @@ import (
)

type UCPApplicationsManagementClient struct {
RootScope string
ClientOptions *arm.ClientOptions
genericResourceClientFactory func(scope string, resourceType string) (genericResourceClient, error)
applicationResourceClientFactory func(scope string) (applicationResourceClient, error)
environmentResourceClientFactory func(scope string) (environmentResourceClient, error)
recipePackResourceClientFactory func(scope string) (recipePackResourceClient, error)
resourceGroupClientFactory func() (resourceGroupClient, error)
resourceProviderClientFactory func() (resourceProviderClient, error)
resourceTypeClientFactory func() (resourceTypeClient, error)
apiVersionClientFactory func() (apiVersionClient, error)
locationClientFactory func() (locationClient, error)
capture func(ctx context.Context, capture **http.Response) context.Context
RootScope string
ClientOptions *arm.ClientOptions
genericResourceClientFactory func(scope string, resourceType string) (genericResourceClient, error)
applicationResourceClientFactory func(scope string) (applicationResourceClient, error)
environmentResourceClientFactory func(scope string) (environmentResourceClient, error)
recipePackResourceClientFactory func(scope string) (recipePackResourceClient, error)
radiusCoreEnvironmentResourceClientFactory func(scope string) (radiusCoreEnvironmentResourceClient, error)
resourceGroupClientFactory func() (resourceGroupClient, error)
resourceProviderClientFactory func() (resourceProviderClient, error)
resourceTypeClientFactory func() (resourceTypeClient, error)
apiVersionClientFactory func() (apiVersionClient, error)
locationClientFactory func() (locationClient, error)
capture func(ctx context.Context, capture **http.Response) context.Context
}

var _ ApplicationsManagementClient = (*UCPApplicationsManagementClient)(nil)
Expand Down Expand Up @@ -519,6 +520,46 @@ func (amc *UCPApplicationsManagementClient) ListEnvironmentsAll(ctx context.Cont
return environments, nil
}

// ListRadiusCoreEnvironmentsAll queries the plane scope for all Radius.Core environment resources
// across all resource groups and returns them as a slice. It mirrors ListEnvironmentsAll, but
// targets Radius.Core/environments (v20250801preview) instead of Applications.Core/environments
// (v20231001preview).
func (amc *UCPApplicationsManagementClient) ListRadiusCoreEnvironmentsAll(ctx context.Context) ([]corerpv20250801.EnvironmentResource, error) {
scope, err := resources.ParseScope(amc.RootScope)
if err != nil {
return []corerpv20250801.EnvironmentResource{}, err
}

// Query at plane scope, not resource group scope. We don't enforce the exact structure of the scope, so handle both cases.
//
// - /planes/radius/local
// - /planes/radius/local/resourceGroups/my-group
if scope.FindScope(resources_radius.ScopeResourceGroups) != "" {
scope = scope.Truncate()
}

// Generated client doesn't like the leading '/' in the scope.
client, err := amc.createRadiusCoreEnvironmentClient(scope.String())
if err != nil {
return []corerpv20250801.EnvironmentResource{}, err
}

environments := []corerpv20250801.EnvironmentResource{}
pager := client.NewListByScopePager(&corerpv20250801.EnvironmentsClientListByScopeOptions{})
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
return []corerpv20250801.EnvironmentResource{}, err
}

for _, environment := range page.EnvironmentResourceListResult.Value {
environments = append(environments, *environment)
}
}

return environments, nil
}

// GetEnvironment retrieves an environment by its name (in the configured scope) or resource ID.
func (amc *UCPApplicationsManagementClient) GetEnvironment(ctx context.Context, environmentNameOrID string) (corerpv20231001.EnvironmentResource, error) {
scope, name, err := amc.extractScopeAndName(environmentNameOrID)
Expand Down Expand Up @@ -1223,6 +1264,15 @@ func (amc *UCPApplicationsManagementClient) createEnvironmentClient(scope string
return amc.environmentResourceClientFactory(scope)
}

func (amc *UCPApplicationsManagementClient) createRadiusCoreEnvironmentClient(scope string) (radiusCoreEnvironmentResourceClient, error) {
if amc.radiusCoreEnvironmentResourceClientFactory == nil {
// Generated client doesn't like the leading '/' in the scope.
return corerpv20250801.NewEnvironmentsClient(strings.TrimPrefix(scope, resources.SegmentSeparator), &aztoken.AnonymousCredential{}, amc.ClientOptions)
}

return amc.radiusCoreEnvironmentResourceClientFactory(scope)
}

func (amc *UCPApplicationsManagementClient) createGenericClient(scope string, resourceType string, apiVersion ...string) (genericResourceClient, error) {
if amc.genericResourceClientFactory == nil {
clientOptions := *amc.ClientOptions
Expand Down
10 changes: 9 additions & 1 deletion pkg/cli/clients/management_mocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
// Because these interfaces are non-exported, they MUST be defined in their own file
// and we MUST use -source on mockgen to generate mocks for them.

//go:generate mockgen -typed -source=./management_mocks.go -destination=./mock_management_wrapped_clients.go -package=clients -self_package github.com/radius-project/radius/pkg/cli/clients github.com/radius-project/radius/pkg/cli/clients genericResourceClient,applicationResourceClient,environmentResourceClient,resourceGroupClient,resourceProviderClient,resourceTypeClient,apiVersonClient,locationClient,recipePackResourceClient
//go:generate mockgen -typed -source=./management_mocks.go -destination=./mock_management_wrapped_clients.go -package=clients -self_package github.com/radius-project/radius/pkg/cli/clients github.com/radius-project/radius/pkg/cli/clients genericResourceClient,applicationResourceClient,environmentResourceClient,resourceGroupClient,resourceProviderClient,resourceTypeClient,apiVersonClient,locationClient,recipePackResourceClient,radiusCoreEnvironmentResourceClient

// genericResourceClient is an interface for mocking the generated SDK client for any resource.
type genericResourceClient interface {
Expand Down Expand Up @@ -106,3 +106,11 @@ type recipePackResourceClient interface {
Get(ctx context.Context, recipePackName string, options *corerpv20250801.RecipePacksClientGetOptions) (corerpv20250801.RecipePacksClientGetResponse, error)
NewListByScopePager(options *corerpv20250801.RecipePacksClientListByScopeOptions) *runtime.Pager[corerpv20250801.RecipePacksClientListByScopeResponse]
}

// radiusCoreEnvironmentResourceClient is an interface for mocking the generated SDK client for Radius.Core/environments resources.
type radiusCoreEnvironmentResourceClient interface {
CreateOrUpdate(ctx context.Context, environmentName string, resource corerpv20250801.EnvironmentResource, options *corerpv20250801.EnvironmentsClientCreateOrUpdateOptions) (corerpv20250801.EnvironmentsClientCreateOrUpdateResponse, error)
Delete(ctx context.Context, environmentName string, options *corerpv20250801.EnvironmentsClientDeleteOptions) (corerpv20250801.EnvironmentsClientDeleteResponse, error)
Get(ctx context.Context, environmentName string, options *corerpv20250801.EnvironmentsClientGetOptions) (corerpv20250801.EnvironmentsClientGetResponse, error)
NewListByScopePager(options *corerpv20250801.EnvironmentsClientListByScopeOptions) *runtime.Pager[corerpv20250801.EnvironmentsClientListByScopeResponse]
}
70 changes: 70 additions & 0 deletions pkg/cli/clients/management_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
v1 "github.com/radius-project/radius/pkg/armrpc/api/v1"
"github.com/radius-project/radius/pkg/cli/clients_new/generated"
corerp "github.com/radius-project/radius/pkg/corerp/api/v20231001preview"
corerpv20250801 "github.com/radius-project/radius/pkg/corerp/api/v20250801preview"
"github.com/radius-project/radius/pkg/to"
ucp "github.com/radius-project/radius/pkg/ucp/api/v20231001preview"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -1362,6 +1363,75 @@ func Test_Environment(t *testing.T) {
})
}

func Test_RadiusCoreEnvironment(t *testing.T) {
t.Parallel()
createClient := func(wrapped radiusCoreEnvironmentResourceClient) *UCPApplicationsManagementClient {
return &UCPApplicationsManagementClient{
RootScope: testScope,
radiusCoreEnvironmentResourceClientFactory: func(scope string) (radiusCoreEnvironmentResourceClient, error) {
return wrapped, nil
},
capture: testCapture,
}
}

testResourceType := "Radius.Core/environments"

listPages := []corerpv20250801.EnvironmentsClientListByScopeResponse{
{
EnvironmentResourceListResult: corerpv20250801.EnvironmentResourceListResult{
Value: []*corerpv20250801.EnvironmentResource{
{
ID: to.Ptr(testScope + "/providers/" + testResourceType + "/" + "test1"),
Name: to.Ptr("test1"),
Type: &testResourceType,
Location: to.Ptr(v1.LocationGlobal),
},
{
ID: to.Ptr(testScope + "/providers/" + testResourceType + "/" + "test2"),
Name: to.Ptr("test2"),
Type: &testResourceType,
Location: to.Ptr(v1.LocationGlobal),
},
},
NextLink: to.Ptr("0"),
},
},
{
EnvironmentResourceListResult: corerpv20250801.EnvironmentResourceListResult{
Value: []*corerpv20250801.EnvironmentResource{
{
ID: to.Ptr(testScope + "/providers/" + testResourceType + "/" + "test3"),
Name: to.Ptr("test3"),
Type: &testResourceType,
Location: to.Ptr(v1.LocationGlobal),
},
},
NextLink: to.Ptr("1"),
},
},
}

t.Run("ListRadiusCoreEnvironmentsAll", func(t *testing.T) {
mock := NewMockradiusCoreEnvironmentResourceClient(gomock.NewController(t))
client := createClient(mock)

mock.EXPECT().
NewListByScopePager(gomock.Any()).
Return(pager(listPages))

expected := []corerpv20250801.EnvironmentResource{
*listPages[0].Value[0],
*listPages[0].Value[1],
*listPages[1].Value[0],
}

resources, err := client.ListRadiusCoreEnvironmentsAll(context.Background())
require.NoError(t, err)
require.Equal(t, expected, resources)
})
}

func Test_ResourceGroup(t *testing.T) {
t.Parallel()
createClient := func(wrapped resourceGroupClient) *UCPApplicationsManagementClient {
Expand Down
39 changes: 39 additions & 0 deletions pkg/cli/clients/mock_applicationsclient.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading