Skip to content

Add preview flag for rad install kubernetes - #12504

Merged
lakshmimsft merged 1 commit into
mainfrom
lakshmimsft/install-kubernetes-preview
Jul 30, 2026
Merged

lakshmimsft merged 1 commit into
mainfrom
lakshmimsft/install-kubernetes-preview

Conversation

@lakshmimsft

Copy link
Copy Markdown
Contributor

This pull request adds a  --preview  flag to  rad install kubernetes . By default the command creates the default environment using the legacy  Applications.Core/environments  resource type. With  --preview  (or  RADIUS_PREVIEW=true ), it instead creates the default environment using the new  Radius.Core/environments  resource type with the default recipe pack attached and the Kubernetes namespace set to  default  — matching the behavior of  rad env create --preview .

Environment creation stays GET-first: an existing default environment is left unchanged so user customizations are preserved across reinstalls.

Reason for change

 rad install kubernetes  was hardcoded to the legacy  Applications.Core/environments  type. Other commands ( rad app * ,  rad env * ) already expose a  --preview  flag to opt into the new  Radius.Core/*  resource types. This brings  rad install kubernetes  in line so users can bootstrap a cluster whose default environment uses the new resource type.

Fixes #12415

How to test

  1. Build the CLI:  make build-rad .
  2. On a Kubernetes cluster with no existing  Radius.Core/environments/default , run:
     rad install kubernetes --preview  (or  RADIUS_PREVIEW=true rad install kubernetes ).
  3. Verify the default environment is the new type and is fully configured:
    •  rad resource list Radius.Core/environments -g default  → shows  default  as  Succeeded .
    •  rad resource show Radius.Core/environments default -g default -o json  →  properties.recipePacks  references  .../Radius.Core/recipePacks/default  and  properties.providers.kubernetes.namespace  is  default .
    •  rad resource list Radius.Core/recipePacks -g default  → default recipe pack is  Succeeded .
  4. Confirm default (non-preview) behavior is unchanged:  rad install kubernetes  still creates  Applications.Core/environments/default .
  5. Confirm idempotency: re-running  --preview  leaves an existing environment unchanged ("already exists; leaving it unchanged").

File change summary

File Summary of change
pkg/cli/cmd/install/kubernetes/kubernetes.go Add --preview flag and Preview/RadiusCoreClientFactory fields; resolve preview from flag or RADIUS_PREVIEW in Validate; branch default-env creation to new ensureDefaultEnvironmentPreview, which GET-first creates a Radius.Core/environments default env with the default recipe pack and default namespace. Update command help/examples.
pkg/cli/cmd/install/kubernetes/kubernetes_test.go Add --preview validate case; add tests for preview install (asserts scope, recipe pack ID, namespace) and preview reinstall (existing env left unchanged).

@lakshmimsft
lakshmimsft requested review from a team as code owners July 22, 2026 01:29
Copilot AI review requested due to automatic review settings July 22, 2026 01:29
@github-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@lakshmimsft lakshmimsft added the pr:standard Ongoing maintenance, minor improvements, documentation updates, and routine development work label Jul 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds an opt-in preview mode to rad install kubernetes so the default environment is created using the new Radius.Core/environments resource type (with the default recipe pack and Kubernetes namespace set to default), aligning install behavior with other preview-enabled CLI commands.

Changes:

  • Add --preview flag (and RADIUS_PREVIEW=true support) to select preview-mode default environment creation.
  • Implement preview-mode default environment creation via Radius.Core clients, including ensuring the default recipe pack exists before referencing it.
  • Add validation + run-path tests for preview installs and preview reinstalls (existing env preserved).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pkg/cli/cmd/install/kubernetes/kubernetes.go Adds preview flag handling and a new preview path to create Radius.Core/environments/default with the default recipe pack and default namespace.
pkg/cli/cmd/install/kubernetes/kubernetes_test.go Adds validation coverage for --preview and new tests asserting preview-mode env creation + idempotent behavior when the env already exists.

Comment thread pkg/cli/cmd/install/kubernetes/kubernetes.go
@github-actions

github-actions Bot commented Jul 22, 2026 •

Copy link
Copy Markdown

Unit Tests

    2 files  ±0    457 suites  ±0   6m 38s ⏱️ -47s
6 066 tests +3  6 064 ✅ +3  2 💤 ±0  0 ❌ ±0 
7 276 runs  +6  7 274 ✅ +6  2 💤 ±0  0 ❌ ±0 

Results for commit 9a0a217. ± Comparison against base commit d5258ce.

♻️ This comment has been updated with latest results.

@codecov

codecov Bot commented Jul 22, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.91667% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.89%. Comparing base (d5258ce) to head (9a0a217).

Files with missing lines Patch % Lines
pkg/cli/cmd/install/kubernetes/kubernetes.go 72.91% 8 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12504      +/-   ##
==========================================
+ Coverage   53.87%   53.89%   +0.01%     
==========================================
  Files         765      765              
  Lines       50647    50691      +44     
==========================================
+ Hits        27288    27319      +31     
- Misses      20788    20796       +8     
- Partials     2571     2576       +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Jul 22, 2026 •

Copy link
Copy Markdown

Functional Tests - upgrade-noncloud

3 tests  ±0   3 ✅ ±0   3m 57s ⏱️ +23s
1 suites ±0   0 💤 ±0 
1 files   ±0   0 ❌ ±0 

Results for commit 9a0a217. ± Comparison against base commit d5258ce.

♻️ This comment has been updated with latest results.

Signed-off-by: lakshmimsft <ljavadekar@microsoft.com>
Copilot AI review requested due to automatic review settings July 22, 2026 02:38
@lakshmimsft
lakshmimsft force-pushed the lakshmimsft/install-kubernetes-preview branch from f3697ef to 9a0a217 Compare July 22, 2026 02:38
@radius-functional-tests

radius-functional-tests Bot commented Jul 22, 2026 •

Copy link
Copy Markdown

Radius functional test overview

🔍 Go to test action run

Click here to see the test run details
Name Value
Repository radius-project/radius
Commit ref 9a0a217
Unique ID funcde23eeffe8
Image tag pr-funcde23eeffe8
  • 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-funcde23eeffe8
  • 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-funcde23eeffe8
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-funcde23eeffe8
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-funcde23eeffe8
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-funcde23eeffe8
  • 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 tests succeeded
✅ corerp-cloud functional tests succeeded

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 2 out of 2 changed files in this pull request and generated no new comments.

@lakshmimsft lakshmimsft changed the title add preview flag for rad install kubernetes Add preview flag for rad install kubernetes Jul 22, 2026
@lakshmimsft
lakshmimsft requested a review from nithyatsu July 23, 2026 06:18
Comment thread pkg/cli/cmd/install/kubernetes/kubernetes.go
@lakshmimsft
lakshmimsft enabled auto-merge July 29, 2026 22:37
@lakshmimsft
lakshmimsft added this pull request to the merge queue Jul 30, 2026
Merged via the queue into main with commit 2fefcc5 Jul 30, 2026
78 checks passed
@lakshmimsft
lakshmimsft deleted the lakshmimsft/install-kubernetes-preview branch July 30, 2026 16:58
DariuszPorowski pushed a commit that referenced this pull request Aug 26, 2026
…ll kubernetes (#12829)

## Summary
Reverts the default resource group and environment creation that `rad
install kubernetes` performed,
returning it to a barebones control-plane install. Also removes the
`--preview` flag from this command,
since its only effect was selecting the resource type (and default
recipe pack) for the default
environment that is no longer created.

After this change:

- `rad install kubernetes` installs the Radius control plane .
- No `default` resource group, no `default` environment, no default
recipe pack, and no environment
  targeting the `default` Kubernetes namespace.

This reverts the behavior introduced by #11870 (shipped in v0.59.0) and
the `--preview` flag added on
top of it by #12504 (shipped in v0.60.0). Unrelated changes that landed
in the same files since then
are preserved: the `t.Context()` test modernization from #12523 and the
current `docs.radapp.io`
architecture URL.

## Reason for change

`rad install kubernetes` silently provisioning a default environment and
recipe packs is undesirable
for anyone who intends to customize environments, namespaces, or recipe
packs — notably the GitHub
Copilot app integration, where a default environment targeting the
`default` Kubernetes namespace
conflicts with the intended setup.

Opinionated initialization belongs in `rad init`, where users expect an
onboarding flow with defaults
preset. This restores a clean separation of responsibilities:

- `rad install kubernetes` — install the control plane only.
- `rad init` — install and/or initialize Radius with default resources
and recipe packs.

Fixes #12827

## How to test
Manual, against a clean cluster:

rad install kubernetes
rad group show default   # expect: not found
rad env show default     # expect: not found

rad init # still creates the default group, environment, and recipe pack
rad group show default   # expect: exists
rad env show default     # expect: exists

Also confirm  rad install kubernetes --preview  now reports  unknown
flag: --preview , and that the
existing install flags ( --reinstall ,  --chart ,  --set ,  --set-file ,
 --kubecontext ,
 --skip-contour-install , and the  --contour-*  flags) are unchanged.


| File | Summary of change |
| ---- | ----------------- |
| `pkg/cli/cmd/install/kubernetes/kubernetes.go` | Removed
`createDefaultGroupAndEnvironment`, `ensureDefaultResourceGroup`,
`ensureDefaultEnvironment`, and `ensureDefaultEnvironmentPreview`, along
with the `--preview` flag and the `ConnectionFactory`,
`KubernetesInterface`, `Preview`, and `RadiusCoreClientFactory` runner
fields. `Run` now returns after `Helm.InstallRadius`. Added help text
stating the command installs the control plane only and pointing to `rad
init` for defaults. |
| `pkg/cli/cmd/install/kubernetes/kubernetes_test.go` | Removed mock
expectations for default group/environment/recipe-pack creation. Each
install test now asserts the full `Output.Writes` sequence exactly, so
any reintroduced default-resource logging fails the test. Retains the
`t.Context()` usage from #12523. |
| `.github/extension/actions/restore-state/action.yml` | Updated a
now-inaccurate comment claiming `rad install kubernetes` creates the
`default` resource group. Behavior is unchanged — the action already
creates the group explicitly. |

Note for follow-up:
Check for docs update to reflect updated changes.

---------

Signed-off-by: lakshmimsft <ljavadekar@microsoft.com>
DariuszPorowski pushed a commit that referenced this pull request Aug 26, 2026
…ll kubernetes (#12829)

## Summary
Reverts the default resource group and environment creation that `rad
install kubernetes` performed,
returning it to a barebones control-plane install. Also removes the
`--preview` flag from this command,
since its only effect was selecting the resource type (and default
recipe pack) for the default
environment that is no longer created.

After this change:

- `rad install kubernetes` installs the Radius control plane .
- No `default` resource group, no `default` environment, no default
recipe pack, and no environment
  targeting the `default` Kubernetes namespace.

This reverts the behavior introduced by #11870 (shipped in v0.59.0) and
the `--preview` flag added on
top of it by #12504 (shipped in v0.60.0). Unrelated changes that landed
in the same files since then
are preserved: the `t.Context()` test modernization from #12523 and the
current `docs.radapp.io`
architecture URL.

## Reason for change

`rad install kubernetes` silently provisioning a default environment and
recipe packs is undesirable
for anyone who intends to customize environments, namespaces, or recipe
packs — notably the GitHub
Copilot app integration, where a default environment targeting the
`default` Kubernetes namespace
conflicts with the intended setup.

Opinionated initialization belongs in `rad init`, where users expect an
onboarding flow with defaults
preset. This restores a clean separation of responsibilities:

- `rad install kubernetes` — install the control plane only.
- `rad init` — install and/or initialize Radius with default resources
and recipe packs.

Fixes #12827

## How to test
Manual, against a clean cluster:

rad install kubernetes
rad group show default   # expect: not found
rad env show default     # expect: not found

rad init # still creates the default group, environment, and recipe pack
rad group show default   # expect: exists
rad env show default     # expect: exists

Also confirm  rad install kubernetes --preview  now reports  unknown
flag: --preview , and that the
existing install flags ( --reinstall ,  --chart ,  --set ,  --set-file ,
 --kubecontext ,
 --skip-contour-install , and the  --contour-*  flags) are unchanged.

| File | Summary of change |
| ---- | ----------------- |
| `pkg/cli/cmd/install/kubernetes/kubernetes.go` | Removed
`createDefaultGroupAndEnvironment`, `ensureDefaultResourceGroup`,
`ensureDefaultEnvironment`, and `ensureDefaultEnvironmentPreview`, along
with the `--preview` flag and the `ConnectionFactory`,
`KubernetesInterface`, `Preview`, and `RadiusCoreClientFactory` runner
fields. `Run` now returns after `Helm.InstallRadius`. Added help text
stating the command installs the control plane only and pointing to `rad
init` for defaults. |
| `pkg/cli/cmd/install/kubernetes/kubernetes_test.go` | Removed mock
expectations for default group/environment/recipe-pack creation. Each
install test now asserts the full `Output.Writes` sequence exactly, so
any reintroduced default-resource logging fails the test. Retains the
`t.Context()` usage from #12523. |
| `.github/extension/actions/restore-state/action.yml` | Updated a
now-inaccurate comment claiming `rad install kubernetes` creates the
`default` resource group. Behavior is unchanged — the action already
creates the group explicitly. |

Note for follow-up:
Check for docs update to reflect updated changes.

---------

Signed-off-by: lakshmimsft <ljavadekar@microsoft.com>
(cherry picked from commit 19376c3)
Signed-off-by: Dariusz Porowski <3431813+DariuszPorowski@users.noreply.github.com>
DariuszPorowski pushed a commit that referenced this pull request Aug 26, 2026
…ll kubernetes (#12829)

## Summary
Reverts the default resource group and environment creation that `rad
install kubernetes` performed,
returning it to a barebones control-plane install. Also removes the
`--preview` flag from this command,
since its only effect was selecting the resource type (and default
recipe pack) for the default
environment that is no longer created.

After this change:

- `rad install kubernetes` installs the Radius control plane .
- No `default` resource group, no `default` environment, no default
recipe pack, and no environment
  targeting the `default` Kubernetes namespace.

This reverts the behavior introduced by #11870 (shipped in v0.59.0) and
the `--preview` flag added on
top of it by #12504 (shipped in v0.60.0). Unrelated changes that landed
in the same files since then
are preserved: the `t.Context()` test modernization from #12523 and the
current `docs.radapp.io`
architecture URL.

## Reason for change

`rad install kubernetes` silently provisioning a default environment and
recipe packs is undesirable
for anyone who intends to customize environments, namespaces, or recipe
packs — notably the GitHub
Copilot app integration, where a default environment targeting the
`default` Kubernetes namespace
conflicts with the intended setup.

Opinionated initialization belongs in `rad init`, where users expect an
onboarding flow with defaults
preset. This restores a clean separation of responsibilities:

- `rad install kubernetes` — install the control plane only.
- `rad init` — install and/or initialize Radius with default resources
and recipe packs.

Fixes #12827

## How to test
Manual, against a clean cluster:

rad install kubernetes
rad group show default   # expect: not found
rad env show default     # expect: not found

rad init # still creates the default group, environment, and recipe pack
rad group show default   # expect: exists
rad env show default     # expect: exists

Also confirm  rad install kubernetes --preview  now reports  unknown
flag: --preview , and that the
existing install flags ( --reinstall ,  --chart ,  --set ,  --set-file ,
 --kubecontext ,
 --skip-contour-install , and the  --contour-*  flags) are unchanged.

| File | Summary of change |
| ---- | ----------------- |
| `pkg/cli/cmd/install/kubernetes/kubernetes.go` | Removed
`createDefaultGroupAndEnvironment`, `ensureDefaultResourceGroup`,
`ensureDefaultEnvironment`, and `ensureDefaultEnvironmentPreview`, along
with the `--preview` flag and the `ConnectionFactory`,
`KubernetesInterface`, `Preview`, and `RadiusCoreClientFactory` runner
fields. `Run` now returns after `Helm.InstallRadius`. Added help text
stating the command installs the control plane only and pointing to `rad
init` for defaults. |
| `pkg/cli/cmd/install/kubernetes/kubernetes_test.go` | Removed mock
expectations for default group/environment/recipe-pack creation. Each
install test now asserts the full `Output.Writes` sequence exactly, so
any reintroduced default-resource logging fails the test. Retains the
`t.Context()` usage from #12523. |
| `.github/extension/actions/restore-state/action.yml` | Updated a
now-inaccurate comment claiming `rad install kubernetes` creates the
`default` resource group. Behavior is unchanged — the action already
creates the group explicitly. |

Note for follow-up:
Check for docs update to reflect updated changes.

---------

Signed-off-by: lakshmimsft <ljavadekar@microsoft.com>
(cherry picked from commit 19376c3)
Signed-off-by: Dariusz Porowski <3431813+DariuszPorowski@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:standard Ongoing maintenance, minor improvements, documentation updates, and routine development work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rad install kubernetes creates environment using old Applications.Core/environments resource type

3 participants