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
| } | ||
| return r.ensureDefaultEnvironment(ctx, client) | ||
| } | ||
|
|
There was a problem hiding this comment.
I am not sure why we started creating the environment at all in rad install.
install command was purely for control plane. I understand that was not part of your PR and the env was being created already. Perhaps we should discuss this more and see of we should be removing the env creation instead.
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).