Skip to content

Commit

Permalink
Fix side effect of unnecessary workload cluster machine rollout durin…
Browse files Browse the repository at this point in the history
…g management cluster upgrade due to package reconcile error (#6667)
  • Loading branch information
jiayiwang7 authored Sep 8, 2023
1 parent 82807d0 commit 526d12e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions controllers/cluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,19 @@ func (r *ClusterReconciler) reconcile(ctx context.Context, log logr.Logger, clus
cluster.Status.ReconciledGeneration = cluster.Generation
cluster.Status.ChildrenReconciledGeneration = aggregatedGeneration

// TODO(eksa-controller-SME): properly handle packages reconcile error and not triggering machine upgrade when
// packages reconcile is still in progress.
// Moving the packages reconcile after the above two generation fields are set, so that packages reconcile error
// does not cause side effect of rolling out of workload cluster machines during management cluster upgrade.
reconcileResult, err = r.packagesReconcile(ctx, log, cluster)
if err != nil {
return ctrl.Result{}, err
}

if reconcileResult.Return() {
return reconcileResult.ToCtrlResult(), nil
}

return ctrl.Result{}, nil
}

Expand Down Expand Up @@ -409,6 +422,10 @@ func (r *ClusterReconciler) postClusterProviderReconcile(ctx context.Context, lo
return controller.Result{}, err
}

return controller.Result{}, nil
}

func (r *ClusterReconciler) packagesReconcile(ctx context.Context, log logr.Logger, cluster *anywherev1.Cluster) (controller.Result, error) {
// Self-managed clusters can support curated packages, but that support
// comes from the CLI at this time.
if cluster.IsManaged() && cluster.IsPackagesEnabled() {
Expand Down

0 comments on commit 526d12e

Please sign in to comment.