Skip to content

Commit fc14a9d

Browse files
committed
format comments
1 parent e3230b5 commit fc14a9d

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

pkg/controllers/collaset/synccontrol/sync_control.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ func (r *RealSyncControl) Update(
713713
continue
714714
}
715715

716-
// fulfillPodUpdateInfo to all not updatedRevision pod
716+
// 3.1 fulfillPodUpdateInfo to all not updatedRevision pod
717717
if err = updater.FulfillPodUpdatedInfo(resources.UpdatedRevision, podInfo); err != nil {
718718
logger.Error(err, fmt.Sprintf("fail to analyse pod %s/%s in-place update support", podInfo.Namespace, podInfo.Name))
719719
continue
@@ -726,10 +726,13 @@ func (r *RealSyncControl) Update(
726726
podCh <- podToUpdate[i]
727727
}
728728

729+
// 4. begin pod update lifecycle
729730
updating, err = updater.BeginUpdatePod(resources, podCh)
730731
if err != nil {
731732
return updating, recordedRequeueAfter, err
732733
}
734+
735+
// 5. filter pods not allow to ops now, such as OperationDelaySeconds strategy
733736
recordedRequeueAfter, err = updater.FilterAllowOpsPods(podToUpdate, ownedIDs, resources, podCh)
734737
if err != nil {
735738
collasetutils.AddOrUpdateCondition(resources.NewStatus,
@@ -767,7 +770,7 @@ func (r *RealSyncControl) Update(
767770
collasetutils.AddOrUpdateCondition(resources.NewStatus, appsv1alpha1.CollaSetUpdate, nil, "Updated", "")
768771
}
769772

770-
// try to finish all Pods'PodOpsLifecycle if its update is finished.
773+
// 7. try to finish all Pods'PodOpsLifecycle if its update is finished.
771774
succCount, err = controllerutils.SlowStartBatch(len(podUpdateInfos), controllerutils.SlowStartInitialBatchSize, false, func(i int, _ error) error {
772775
podInfo := podUpdateInfos[i]
773776

pkg/controllers/collaset/synccontrol/update.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ func (u *GenericPodUpdater) FilterAllowOpsPods(podToUpdate []*PodUpdateInfo, own
351351
// if Pod has not been updated, update it.
352352
podCh <- podToUpdate[i]
353353
}
354-
// 4. mark Pod to use updated revision before updating it.
354+
// mark Pod to use updated revision before updating it.
355355
if needUpdateContext {
356356
u.recorder.Eventf(u.collaSet, corev1.EventTypeNormal, "UpdateToPodContext", "try to update ResourceContext for CollaSet")
357357
err := retry.RetryOnConflict(retry.DefaultRetry, func() error {
@@ -363,7 +363,6 @@ func (u *GenericPodUpdater) FilterAllowOpsPods(podToUpdate []*PodUpdateInfo, own
363363
}
364364

365365
func (u *GenericPodUpdater) FinishUpdatePod(podInfo *PodUpdateInfo) error {
366-
//u.recorder.Eventf().V(1).Info("try to finish update PodOpsLifecycle for Pod", "pod", commonutils.ObjectKeyString(podInfo.Pod))
367366
if updated, err := podopslifecycle.Finish(u.Client, collasetutils.UpdateOpsLifecycleAdapter, podInfo.Pod); err != nil {
368367
return fmt.Errorf("failed to finish PodOpsLifecycle for updating Pod %s/%s: %s", podInfo.Namespace, podInfo.Name, err)
369368
} else if updated {
@@ -493,7 +492,7 @@ func (u *inPlaceIfPossibleUpdater) FulfillPodUpdatedInfo(
493492

494493
func (u *inPlaceIfPossibleUpdater) UpgradePod(podInfo *PodUpdateInfo) error {
495494
if podInfo.OnlyMetadataChanged || podInfo.InPlaceUpdateSupport {
496-
// 6.1 if pod template changes only include metadata or support in-place update, just apply these changes to pod directly
495+
// if pod template changes only include metadata or support in-place update, just apply these changes to pod directly
497496
if err := u.podControl.UpdatePod(podInfo.UpdatedPod); err != nil {
498497
return fmt.Errorf("fail to update Pod %s/%s when updating by in-place: %s", podInfo.Namespace, podInfo.Name, err)
499498
} else {
@@ -510,7 +509,7 @@ func (u *inPlaceIfPossibleUpdater) UpgradePod(podInfo *PodUpdateInfo) error {
510509
}
511510
}
512511
} else {
513-
// 6.2 if pod has changes not in-place supported, recreate it
512+
// if pod has changes not in-place supported, recreate it
514513
return recreatePod(u.collaSet, podInfo, u.podControl, u.recorder)
515514
}
516515
return nil

0 commit comments

Comments
 (0)