Skip to content

Commit cb5c8d1

Browse files
committed
Don't automatically clear in-progress status when resize is not allowed
1 parent 523a19a commit cb5c8d1

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

pkg/kubelet/kubelet.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2873,15 +2873,6 @@ func (kl *Kubelet) canResizePod(pod *v1.Pod) (bool, v1.PodResizeStatus, string)
28732873
// the allocation decision and pod status.
28742874
func (kl *Kubelet) handlePodResourcesResize(pod *v1.Pod, podStatus *kubecontainer.PodStatus) (*v1.Pod, error) {
28752875
allocatedPod, updated := kl.allocationManager.UpdatePodFromAllocation(pod)
2876-
if resizable, msg := kuberuntime.IsInPlacePodVerticalScalingAllowed(pod); !resizable {
2877-
if updated {
2878-
kl.recorder.Eventf(pod, v1.EventTypeWarning, events.ResizeInfeasible, msg)
2879-
kl.statusManager.SetPodResizeStatus(pod.UID, v1.PodResizeStatusInfeasible)
2880-
} else {
2881-
kl.statusManager.SetPodResizeStatus(pod.UID, "")
2882-
}
2883-
return allocatedPod, nil
2884-
}
28852876

28862877
if !updated {
28872878
// Desired resources == allocated resources. Check whether a resize is in progress.
@@ -2895,6 +2886,11 @@ func (kl *Kubelet) handlePodResourcesResize(pod *v1.Pod, podStatus *kubecontaine
28952886
}
28962887
// Pod allocation does not need to be updated.
28972888
return allocatedPod, nil
2889+
} else if resizable, msg := kuberuntime.IsInPlacePodVerticalScalingAllowed(pod); !resizable {
2890+
// If there is a pending resize but the resize is not allowed, always use the allocated resources.
2891+
kl.recorder.Eventf(pod, v1.EventTypeWarning, events.ResizeInfeasible, msg)
2892+
kl.statusManager.SetPodResizeStatus(pod.UID, v1.PodResizeStatusInfeasible)
2893+
return allocatedPod, nil
28982894
}
28992895

29002896
kl.podResizeMutex.Lock()

0 commit comments

Comments
 (0)