Skip to content

Commit

Permalink
more logs and nits
Browse files Browse the repository at this point in the history
  • Loading branch information
Pothulapati committed Oct 19, 2023
1 parent e0681c5 commit 71709da
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions internal/controller/dragonfly_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,15 @@ func (r *DragonflyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
// are on latest version
if !masterOnLatest {
// Update master now
log.Info("Running REPLTAKEOVER on replica", "pod", master.Name)
if err := replTakeover(ctx, r.Client, latestReplica); err != nil {
log.Error(err, "could not update master")
return ctrl.Result{RequeueAfter: 5 * time.Second}, err
}
r.EventRecorder.Event(&df, corev1.EventTypeNormal, "Rollout", fmt.Sprintf("Shutting down master %s", master.Name))

// delete the old master, so that it gets recreated with the new version
log.Info("deleting master", "pod", master.Name)
if err := r.Delete(ctx, &master); err != nil {
log.Error(err, "could not delete pod")
return ctrl.Result{RequeueAfter: 5 * time.Second}, err
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func getLatestReplica(ctx context.Context, c client.Client, statefulSet *appsv1.
return nil, err
}

// Iterate over the pods and find the one which is on the latest version
// Iterate over the pods and find a replica which is on the latest version
for _, pod := range podList.Items {

isLatest, err := isPodOnLatestVersion(ctx, c, &pod, statefulSet)
Expand Down

0 comments on commit 71709da

Please sign in to comment.