Skip to content
Merged
10 changes: 6 additions & 4 deletions cmd/rad/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,12 @@ func initSubCommands() {
Prompter: &prompt.Impl{},
ConfigFileInterface: &framework.ConfigFileInterfaceImpl{},
KubernetesInterface: &kubernetes.Impl{},
HelmInterface: &helm.Impl{},
NamespaceInterface: &namespace.Impl{},
AWSClient: aws.NewClient(),
AzureClient: azure.NewClient(),
HelmInterface: &helm.Impl{
Helm: helm.NewHelmClient(),
},
NamespaceInterface: &namespace.Impl{},
AWSClient: aws.NewClient(),
AzureClient: azure.NewClient(),
}

deployCmd, _ := cmd_deploy.NewCommand(framework)
Expand Down
3 changes: 2 additions & 1 deletion pkg/cli/cmd/install/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ func (r *Runner) Run(ctx context.Context) error {
}

clusterOptions := helm.PopulateDefaultClusterOptions(cliOptions)
_, err = r.Helm.InstallRadius(ctx, clusterOptions, r.KubeContext)

err = r.Helm.InstallRadius(ctx, clusterOptions, r.KubeContext)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/cli/cmd/install/kubernetes/kubernetes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func Test_Run(t *testing.T) {
},
})
helmMock.EXPECT().InstallRadius(ctx, expectedOptions, "test-context").
Return(true, nil).
Return(nil).
Times(1)

err := runner.Run(ctx)
Expand Down Expand Up @@ -150,7 +150,7 @@ func Test_Run(t *testing.T) {
},
})
helmMock.EXPECT().InstallRadius(ctx, expectedOptions, "test-context").
Return(true, nil).
Return(nil).
Times(1)

err := runner.Run(ctx)
Expand Down
17 changes: 3 additions & 14 deletions pkg/cli/cmd/radinit/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,9 @@ func (r *Runner) Run(ctx context.Context) error {
},
}

// Install radius control plane
err := installRadius(ctx, r, cliOptions)
clusterOptions := helm.PopulateDefaultClusterOptions(cliOptions)

err := r.HelmInterface.InstallRadius(ctx, clusterOptions, r.Options.Cluster.Context)
if err != nil {
return clierrors.MessageWithCause(err, "Failed to install Radius.")
}
Expand Down Expand Up @@ -346,15 +347,3 @@ func (r *Runner) getAWSCredential() (ucp.AwsCredentialResource, error) {
return ucp.AwsCredentialResource{}, fmt.Errorf("unsupported AWS credential kind: %s", r.Options.CloudProviders.AWS.CredentialKind)
}
}

func installRadius(ctx context.Context, r *Runner, cliOptions helm.CLIClusterOptions) error {
clusterOptions := helm.PopulateDefaultClusterOptions(cliOptions)

// Ignore existing radius installation because we already asked the user whether to re-install or not
_, err := r.HelmInterface.InstallRadius(ctx, clusterOptions, r.Options.Cluster.Context)
if err != nil {
return err
}

return nil
}
2 changes: 1 addition & 1 deletion pkg/cli/cmd/radinit/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ func Test_Run_InstallAndCreateEnvironment(t *testing.T) {
helmInterface := helm.NewMockInterface(ctrl)
helmInterface.EXPECT().
InstallRadius(context.Background(), gomock.Any(), "kind-kind").
Return(true, nil).
Return(nil).
Times(1)

prompter := prompt.NewMockInterface(ctrl)
Expand Down
7 changes: 1 addition & 6 deletions pkg/cli/cmd/uninstall/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,8 @@ func (r *Runner) Run(ctx context.Context) error {
}

r.Output.LogInfo("Uninstalling Radius...")
err = r.Helm.UninstallRadius(ctx, helm.ClusterOptions{
Radius: helm.ChartOptions{
Namespace: helm.RadiusSystemNamespace,
ReleaseName: helm.NewDefaultClusterOptions().Radius.ReleaseName,
},
}, r.KubeContext)

err = r.Helm.UninstallRadius(ctx, helm.NewDefaultClusterOptions(), r.KubeContext)
if err != nil {
return err
}
Expand Down
14 changes: 2 additions & 12 deletions pkg/cli/cmd/uninstall/kubernetes/kubernetes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,7 @@ func Test_Run(t *testing.T) {
Return(helm.InstallState{RadiusInstalled: true, RadiusVersion: "test-version"}, nil).
Times(1)

helmMock.EXPECT().UninstallRadius(ctx, helm.ClusterOptions{
Radius: helm.ChartOptions{
Namespace: "radius-system",
ReleaseName: "radius",
},
}, "test-context").
helmMock.EXPECT().UninstallRadius(ctx, helm.NewDefaultClusterOptions(), "test-context").
Return(nil).
Times(1)

Expand Down Expand Up @@ -142,12 +137,7 @@ func Test_Run(t *testing.T) {
Return(helm.InstallState{RadiusInstalled: true, RadiusVersion: "test-version"}, nil).
Times(1)

helmMock.EXPECT().UninstallRadius(ctx, helm.ClusterOptions{
Radius: helm.ChartOptions{
Namespace: "radius-system",
ReleaseName: "radius",
},
}, "test-context").
helmMock.EXPECT().UninstallRadius(ctx, helm.NewDefaultClusterOptions(), "test-context").
Return(nil).
Times(1)

Expand Down
Loading
Loading