Skip to content

Add preview flag for rad install kubernetes - #12504

Open
lakshmimsft wants to merge 1 commit into
mainfrom
lakshmimsft/install-kubernetes-preview
Open

Add preview flag for rad install kubernetes#12504
lakshmimsft wants to merge 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

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
}
return r.ensureDefaultEnvironment(ctx, client)
}

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.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

pls refer to #12415 and #11870

@lakshmimsft
lakshmimsft enabled auto-merge July 29, 2026 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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