Applied feedback pt.1

Signed-off-by: MrJack <36191829+biagiopietro@users.noreply.github.com>
pull/31616/head
MrJack 2 weeks ago
parent b91de6dd29
commit d319dd31bd

@ -395,22 +395,30 @@ func (i *Install) RunWithContext(ctx context.Context, ch ci.Charter, vals map[st
// Bail out here if it is a dry run
if isDryRun(i.DryRunStrategy) {
// For server-side dry-run, validate resources against the API server
if i.DryRunStrategy == DryRunServer && len(resources) > 0 {
if len(toBeAdopted) == 0 {
_, err = i.cfg.KubeClient.Create(
resources,
kube.ClientCreateOptionServerSideApply(i.ServerSideApply, false),
kube.ClientCreateOptionDryRun(true),
)
} else {
_, err = i.cfg.KubeClient.Update(
if i.DryRunStrategy == DryRunServer {
var errs []error
if len(toBeAdopted) > 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 err != nil {
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 {
return rel, err
}
}

Loading…
Cancel
Save