Skip to content

Commit dea0beb

Browse files
fix: export private vars in updater (#344)
1 parent 849ad35 commit dea0beb

File tree

1 file changed

+10
-10
lines changed
  • pkg/controllers/collaset/synccontrol

1 file changed

+10
-10
lines changed

pkg/controllers/collaset/synccontrol/update.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -376,19 +376,19 @@ type PodUpdater interface {
376376
type GenericPodUpdater struct {
377377
*appsv1alpha1.CollaSet
378378
PodControl podcontrol.Interface
379-
podContextControl podcontext.Interface
379+
PodContextControl podcontext.Interface
380380
Recorder record.EventRecorder
381381
client.Client
382-
cacheExpectations kubeutilsexpectations.CacheExpectationsInterface
382+
CacheExpectations kubeutilsexpectations.CacheExpectationsInterface
383383
}
384384

385385
func (u *GenericPodUpdater) Setup(client client.Client, cls *appsv1alpha1.CollaSet, podControl podcontrol.Interface, podContextControl podcontext.Interface, recorder record.EventRecorder, cacheExpectations kubeutilsexpectations.CacheExpectationsInterface) {
386386
u.Client = client
387387
u.CollaSet = cls
388388
u.PodControl = podControl
389-
u.podContextControl = podContextControl
389+
u.PodContextControl = podContextControl
390390
u.Recorder = recorder
391-
u.cacheExpectations = cacheExpectations
391+
u.CacheExpectations = cacheExpectations
392392
}
393393

394394
func (u *GenericPodUpdater) BeginUpdatePod(_ context.Context, resources *collasetutils.RelatedResources, podCh chan *PodUpdateInfo) (bool, error) {
@@ -405,7 +405,7 @@ func (u *GenericPodUpdater) BeginUpdatePod(_ context.Context, resources *collase
405405
return fmt.Errorf("fail to begin PodOpsLifecycle for updating Pod %s/%s: %w", podInfo.Namespace, podInfo.Name, err)
406406
} else if updated {
407407
// add an expectation for this pod update, before next reconciling
408-
if err := u.cacheExpectations.ExpectUpdation(kubeutilsclient.ObjectKeyString(u.CollaSet), collasetutils.PodGVK, podInfo.Pod.Namespace, podInfo.Pod.Name, podInfo.Pod.ResourceVersion); err != nil {
408+
if err := u.CacheExpectations.ExpectUpdation(kubeutilsclient.ObjectKeyString(u.CollaSet), collasetutils.PodGVK, podInfo.Pod.Namespace, podInfo.Pod.Name, podInfo.Pod.ResourceVersion); err != nil {
409409
return err
410410
}
411411
}
@@ -482,7 +482,7 @@ func (u *GenericPodUpdater) FilterAllowOpsPods(ctx context.Context, candidates [
482482
if needUpdateContext {
483483
u.Recorder.Eventf(u.CollaSet, corev1.EventTypeNormal, "UpdateToPodContext", "try to update ResourceContext for CollaSet")
484484
err := retry.RetryOnConflict(retry.DefaultRetry, func() error {
485-
return u.podContextControl.UpdateToPodContext(ctx, u.CollaSet, ownedIDs)
485+
return u.PodContextControl.UpdateToPodContext(ctx, u.CollaSet, ownedIDs)
486486
})
487487
return recordedRequeueAfter, err
488488
}
@@ -500,7 +500,7 @@ func (u *GenericPodUpdater) FinishUpdatePod(_ context.Context, podInfo *PodUpdat
500500
return fmt.Errorf("failed to finish PodOpsLifecycle for updating Pod %s/%s: %w", podInfo.Namespace, podInfo.Name, err)
501501
} else if updated {
502502
// add an expectation for this pod update, before next reconciling
503-
if err := u.cacheExpectations.ExpectUpdation(kubeutilsclient.ObjectKeyString(u.CollaSet), collasetutils.PodGVK, podInfo.Pod.Namespace, podInfo.Pod.Name, podInfo.Pod.ResourceVersion); err != nil {
503+
if err := u.CacheExpectations.ExpectUpdation(kubeutilsclient.ObjectKeyString(u.CollaSet), collasetutils.PodGVK, podInfo.Pod.Namespace, podInfo.Pod.Name, podInfo.Pod.ResourceVersion); err != nil {
504504
return err
505505
}
506506
u.Recorder.Eventf(podInfo.Pod,
@@ -647,7 +647,7 @@ func (u *inPlaceIfPossibleUpdater) UpgradePod(_ context.Context, podInfo *PodUpd
647647
podInfo.Namespace, podInfo.Name,
648648
podInfo.CurrentRevision.Name,
649649
podInfo.UpdateRevision.Name)
650-
if err := u.cacheExpectations.ExpectUpdation(kubeutilsclient.ObjectKeyString(u.CollaSet), collasetutils.PodGVK, podInfo.Namespace, podInfo.Name, podInfo.Pod.ResourceVersion); err != nil {
650+
if err := u.CacheExpectations.ExpectUpdation(kubeutilsclient.ObjectKeyString(u.CollaSet), collasetutils.PodGVK, podInfo.Namespace, podInfo.Name, podInfo.Pod.ResourceVersion); err != nil {
651651
return err
652652
}
653653
}
@@ -656,7 +656,7 @@ func (u *inPlaceIfPossibleUpdater) UpgradePod(_ context.Context, podInfo *PodUpd
656656
if err := RecreatePod(podInfo, u.PodControl, u.Recorder); err != nil {
657657
return err
658658
}
659-
return u.cacheExpectations.ExpectDeletion(kubeutilsclient.ObjectKeyString(u.CollaSet), collasetutils.PodGVK, podInfo.Namespace, podInfo.Name)
659+
return u.CacheExpectations.ExpectDeletion(kubeutilsclient.ObjectKeyString(u.CollaSet), collasetutils.PodGVK, podInfo.Namespace, podInfo.Name)
660660
}
661661
return nil
662662
}
@@ -786,7 +786,7 @@ func (u *recreatePodUpdater) UpgradePod(_ context.Context, podInfo *PodUpdateInf
786786
if err := RecreatePod(podInfo, u.PodControl, u.Recorder); err != nil {
787787
return err
788788
}
789-
return u.cacheExpectations.ExpectDeletion(kubeutilsclient.ObjectKeyString(u.CollaSet), collasetutils.PodGVK, podInfo.Namespace, podInfo.Name)
789+
return u.CacheExpectations.ExpectDeletion(kubeutilsclient.ObjectKeyString(u.CollaSet), collasetutils.PodGVK, podInfo.Namespace, podInfo.Name)
790790
}
791791

792792
func (u *recreatePodUpdater) GetPodUpdateFinishStatus(_ context.Context, podInfo *PodUpdateInfo) (finished bool, msg string, err error) {

0 commit comments

Comments
 (0)