Skip to content

Commit

Permalink
fix: prevent pod reconcile storm when remount requested
Browse files Browse the repository at this point in the history
Longhorn 9019

Co-authored-by: Chin-Ya Huang <chin-ya.huang@suse.com>
Signed-off-by: Eric Weber <eric.weber@suse.com>
(cherry picked from commit 219c9f0)
  • Loading branch information
ejweber authored and derekbit committed Jul 17, 2024
1 parent cdeba01 commit ecb2573
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions controller/kubernetes_pod_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func (kc *KubernetesPodController) handlePodDeletionIfVolumeRequestRemount(pod *
if podStartTime.Before(remountRequestedAt) {
if !timeNow.After(remountRequestedAt.Add(remountRequestDelayDuration)) {
kc.logger.Infof("Current time is not %v seconds after request remount, requeue the pod %v to handle it later", remountRequestDelayDuration.Seconds(), pod.GetName())
kc.enqueuePod(pod)
kc.enqueuePodAfter(pod, remountRequestDelayDuration)
return nil
}

Expand Down Expand Up @@ -476,12 +476,12 @@ func (kc *KubernetesPodController) getAssociatedVolumes(pod *corev1.Pod) ([]*lon
return volumeList, nil
}

func (kc *KubernetesPodController) enqueuePod(obj interface{}) {
func (kc *KubernetesPodController) enqueuePodAfter(obj interface{}, delay time.Duration) {
key, err := controller.KeyFunc(obj)
if err != nil {
utilruntime.HandleError(fmt.Errorf("couldn't get key for object %#v: %v", obj, err))
return
}

kc.queue.Add(key)
kc.queue.AddAfter(key, delay)
}

0 comments on commit ecb2573

Please sign in to comment.