|
|
|
|
@ -421,22 +421,25 @@ 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
|
|
|
|
|
// For server-side dry-run, validate resources against the API server.
|
|
|
|
|
// Force server-side apply in this path because kube dry-run semantics are
|
|
|
|
|
// only honored by the server-side apply create/update code paths.
|
|
|
|
|
if i.DryRunStrategy == DryRunServer {
|
|
|
|
|
serverSideDryRun := true
|
|
|
|
|
var err error
|
|
|
|
|
if len(toBeAdopted) == 0 && len(resources) > 0 {
|
|
|
|
|
_, err = i.cfg.KubeClient.Create(
|
|
|
|
|
resources,
|
|
|
|
|
kube.ClientCreateOptionServerSideApply(i.ServerSideApply, false),
|
|
|
|
|
kube.ClientCreateOptionServerSideApply(serverSideDryRun, false),
|
|
|
|
|
kube.ClientCreateOptionDryRun(true),
|
|
|
|
|
)
|
|
|
|
|
} else if len(resources) > 0 {
|
|
|
|
|
updateThreeWayMergeForUnstructured := i.TakeOwnership && !i.ServerSideApply
|
|
|
|
|
updateThreeWayMergeForUnstructured := i.TakeOwnership && !serverSideDryRun
|
|
|
|
|
_, err = i.cfg.KubeClient.Update(
|
|
|
|
|
toBeAdopted,
|
|
|
|
|
resources,
|
|
|
|
|
kube.ClientUpdateOptionForceReplace(i.ForceReplace),
|
|
|
|
|
kube.ClientUpdateOptionServerSideApply(i.ServerSideApply, i.ForceConflicts),
|
|
|
|
|
kube.ClientUpdateOptionServerSideApply(serverSideDryRun, i.ForceConflicts),
|
|
|
|
|
kube.ClientUpdateOptionDryRun(true),
|
|
|
|
|
kube.ClientUpdateOptionThreeWayMergeForUnstructured(updateThreeWayMergeForUnstructured),
|
|
|
|
|
kube.ClientUpdateOptionUpgradeClientSideFieldManager(true),
|
|
|
|
|
|