Skip to content

Commit 57806fa

Browse files
refactor: export lifecycle adapter in updateconfig (#26)
1 parent e3960ec commit 57806fa

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

synccontrols/sync_control.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ func NewRealSyncControl(reconcileMixIn *mixin.ReconcilerMixin,
8383
ResourceContextControl: resourceContexts,
8484
Recorder: reconcileMixIn.Recorder,
8585

86-
scaleInLifecycleAdapter: scaleInOpsLifecycleAdapter,
87-
updateLifecycleAdapter: updateLifecycleAdapter,
86+
ScaleInLifecycleAdapter: scaleInOpsLifecycleAdapter,
87+
UpdateLifecycleAdapter: updateLifecycleAdapter,
8888
CacheExpectations: cacheExpectations,
8989
TargetGVK: targetGVK,
9090
}

synccontrols/x_update.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,8 @@ type UpdateConfig struct {
315315
ResourceContextControl resourcecontexts.ResourceContextControl
316316
Recorder record.EventRecorder
317317

318-
scaleInLifecycleAdapter api.LifecycleAdapter
319-
updateLifecycleAdapter api.LifecycleAdapter
318+
ScaleInLifecycleAdapter api.LifecycleAdapter
319+
UpdateLifecycleAdapter api.LifecycleAdapter
320320

321321
CacheExpectations expectations.CacheExpectationsInterface
322322
TargetGVK schema.GroupVersionKind
@@ -392,7 +392,7 @@ func (u *GenericTargetUpdater) BeginUpdateTarget(ctx context.Context, syncContex
392392
targetInfo := <-targetCh
393393
u.Recorder.Eventf(targetInfo.Object, corev1.EventTypeNormal, "TargetUpdateLifecycle", "try to begin TargetOpsLifecycle for updating Target of XSet")
394394

395-
if updated, err := opslifecycle.BeginWithCleaningOld(ctx, u.XsetLabelAnnoMgr, u.Client, u.updateLifecycleAdapter, targetInfo.Object, func(obj client.Object) (bool, error) {
395+
if updated, err := opslifecycle.BeginWithCleaningOld(ctx, u.XsetLabelAnnoMgr, u.Client, u.UpdateLifecycleAdapter, targetInfo.Object, func(obj client.Object) (bool, error) {
396396
if !targetInfo.OnlyMetadataChanged && !targetInfo.InPlaceUpdateSupport {
397397
return opslifecycle.WhenBeginDelete(u.XsetLabelAnnoMgr, obj)
398398
}
@@ -489,11 +489,11 @@ func (u *GenericTargetUpdater) FilterAllowOpsTargets(ctx context.Context, candid
489489
func (u *GenericTargetUpdater) FinishUpdateTarget(ctx context.Context, targetInfo *TargetUpdateInfo, finishByCancelUpdate bool) error {
490490
if finishByCancelUpdate {
491491
// cancel update lifecycle
492-
return opslifecycle.CancelOpsLifecycle(ctx, u.XsetLabelAnnoMgr, u.Client, u.updateLifecycleAdapter, targetInfo.Object)
492+
return opslifecycle.CancelOpsLifecycle(ctx, u.XsetLabelAnnoMgr, u.Client, u.UpdateLifecycleAdapter, targetInfo.Object)
493493
}
494494

495495
// target is ops finished, finish the lifecycle gracefully
496-
if updated, err := opslifecycle.Finish(ctx, u.XsetLabelAnnoMgr, u.Client, u.updateLifecycleAdapter, targetInfo.Object); err != nil {
496+
if updated, err := opslifecycle.Finish(ctx, u.XsetLabelAnnoMgr, u.Client, u.UpdateLifecycleAdapter, targetInfo.Object); err != nil {
497497
return fmt.Errorf("failed to finish TargetOpsLifecycle for updating Target %s/%s: %w", targetInfo.GetNamespace(), targetInfo.GetName(), err)
498498
} else if updated {
499499
// add an expectation for this target update, before next reconciling

0 commit comments

Comments
 (0)