Add preview flag for rad install kubernetes - #12504
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
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
--previewflag (andRADIUS_PREVIEW=truesupport) to select preview-mode default environment creation. - Implement preview-mode default environment creation via
Radius.Coreclients, 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. |
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
Signed-off-by: lakshmimsft <ljavadekar@microsoft.com>
f3697ef to
9a0a217
Compare
Radius functional test overviewClick here to see the test run details
Test Status⌛ Building Radius and pushing container images for functional tests... |
rad install kubernetesrad install kubernetes
…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>
…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>
…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>
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 kuberneteswas 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 bringsrad install kubernetesin line so users can bootstrap a cluster whose default environment uses the new resource type.Fixes #12415
How to test
rad install kubernetes --preview (or RADIUS_PREVIEW=true rad install kubernetes ).
• 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 .
File change summary
pkg/cli/cmd/install/kubernetes/kubernetes.go--previewflag andPreview/RadiusCoreClientFactoryfields; resolve preview from flag orRADIUS_PREVIEWinValidate; branch default-env creation to newensureDefaultEnvironmentPreview, which GET-first creates aRadius.Core/environmentsdefault env with the default recipe pack anddefaultnamespace. Update command help/examples.pkg/cli/cmd/install/kubernetes/kubernetes_test.go--previewvalidate case; add tests for preview install (asserts scope, recipe pack ID, namespace) and preview reinstall (existing env left unchanged).