From 020b5b824980d88e1774d2b73e411f5b0f3abcb1 Mon Sep 17 00:00:00 2001 From: MrJack <36191829+biagiopietro@users.noreply.github.com> Date: Fri, 23 Jan 2026 10:51:05 +0100 Subject: [PATCH] Applied feedback from review pt. 3 Signed-off-by: MrJack <36191829+biagiopietro@users.noreply.github.com> --- pkg/action/install.go | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/pkg/action/install.go b/pkg/action/install.go index a64e80caf..cf29b874f 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -403,29 +403,22 @@ func (i *Install) RunWithContext(ctx context.Context, ch ci.Charter, vals map[st if isDryRun(i.DryRunStrategy) { // For server-side dry-run, validate resources against the API server if i.DryRunStrategy == DryRunServer { - var errs []error - if len(toBeAdopted) > 0 { - _, err := i.cfg.KubeClient.Update( + var err error + if len(toBeAdopted) == 0 && len(resources) > 0 { + _, err = i.cfg.KubeClient.Create( + resources, + kube.ClientCreateOptionServerSideApply(i.ServerSideApply, false), + kube.ClientCreateOptionDryRun(true), + ) + } else if len(resources) > 0 { + _, err = i.cfg.KubeClient.Update( toBeAdopted, resources, kube.ClientUpdateOptionServerSideApply(i.ServerSideApply, i.ForceConflicts), kube.ClientUpdateOptionDryRun(true), ) - if err != nil { - errs = append(errs, err) - } - } - if len(resources) > 0 { - _, err := i.cfg.KubeClient.Create( - resources, - kube.ClientCreateOptionServerSideApply(i.ServerSideApply, false), - kube.ClientCreateOptionDryRun(true), - ) - if err != nil { - errs = append(errs, err) - } } - if err := errors.Join(errs...); err != nil { + if err != nil { return rel, err } }