@@ -2873,15 +2873,6 @@ func (kl *Kubelet) canResizePod(pod *v1.Pod) (bool, v1.PodResizeStatus, string)
2873
2873
// the allocation decision and pod status.
2874
2874
func (kl * Kubelet ) handlePodResourcesResize (pod * v1.Pod , podStatus * kubecontainer.PodStatus ) (* v1.Pod , error ) {
2875
2875
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
- }
2885
2876
2886
2877
if ! updated {
2887
2878
// Desired resources == allocated resources. Check whether a resize is in progress.
@@ -2895,6 +2886,11 @@ func (kl *Kubelet) handlePodResourcesResize(pod *v1.Pod, podStatus *kubecontaine
2895
2886
}
2896
2887
// Pod allocation does not need to be updated.
2897
2888
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
2898
2894
}
2899
2895
2900
2896
kl .podResizeMutex .Lock ()
0 commit comments