@@ -1883,7 +1883,7 @@ func (kl *Kubelet) SyncPod(ctx context.Context, updateType kubetypes.SyncPodType
1883
1883
// handlePodResourcesResize updates the pod to use the allocated resources. This should come
1884
1884
// before the main business logic of SyncPod, so that a consistent view of the pod is used
1885
1885
// across the sync loop.
1886
- if kuberuntime . IsInPlacePodVerticalScalingAllowed ( pod ) {
1886
+ if utilfeature . DefaultFeatureGate . Enabled ( features . InPlacePodVerticalScaling ) {
1887
1887
// Handle pod resize here instead of doing it in HandlePodUpdates because
1888
1888
// this conveniently retries any Deferred resize requests
1889
1889
// TODO(vinaykul,InPlacePodVerticalScaling): Investigate doing this in HandlePodUpdates + periodic SyncLoop scan
@@ -2816,10 +2816,6 @@ func (kl *Kubelet) HandlePodSyncs(pods []*v1.Pod) {
2816
2816
// pod should hold the desired (pre-allocated) spec.
2817
2817
// Returns true if the resize can proceed.
2818
2818
func (kl * Kubelet ) canResizePod (pod * v1.Pod ) (bool , v1.PodResizeStatus , string ) {
2819
- if goos == "windows" {
2820
- return false , v1 .PodResizeStatusInfeasible , "Resizing Windows pods is not supported"
2821
- }
2822
-
2823
2819
if v1qos .GetPodQOS (pod ) == v1 .PodQOSGuaranteed && ! utilfeature .DefaultFeatureGate .Enabled (features .InPlacePodVerticalScalingExclusiveCPUs ) {
2824
2820
if utilfeature .DefaultFeatureGate .Enabled (features .CPUManager ) {
2825
2821
if kl .containerManager .GetNodeConfig ().CPUManagerPolicy == "static" {
@@ -2877,6 +2873,27 @@ func (kl *Kubelet) canResizePod(pod *v1.Pod) (bool, v1.PodResizeStatus, string)
2877
2873
// the allocation decision and pod status.
2878
2874
func (kl * Kubelet ) handlePodResourcesResize (pod * v1.Pod , podStatus * kubecontainer.PodStatus ) (* v1.Pod , error ) {
2879
2875
allocatedPod , updated := kl .allocationManager .UpdatePodFromAllocation (pod )
2876
+ // Keep this logic in sync with kuberuntime.isInPlacePodVerticalScalingAllowed
2877
+ if goos == "windows" || kubetypes .IsStaticPod (pod ) {
2878
+ if updated {
2879
+ // A resize is requested but not supported.
2880
+ var msg string
2881
+ switch {
2882
+ case goos == "windows" :
2883
+ msg = "Resizing Windows pods is not supported"
2884
+ case kubetypes .IsStaticPod (pod ):
2885
+ msg = "Resizing static pods is not supported"
2886
+ default :
2887
+ msg = "Resizing this pod is not supported"
2888
+ }
2889
+ kl .recorder .Eventf (pod , v1 .EventTypeWarning , events .ResizeInfeasible , msg )
2890
+ kl .statusManager .SetPodResizeStatus (pod .UID , v1 .PodResizeStatusInfeasible )
2891
+ } else {
2892
+ kl .statusManager .SetPodResizeStatus (pod .UID , "" )
2893
+ }
2894
+ return allocatedPod , nil
2895
+ }
2896
+
2880
2897
if ! updated {
2881
2898
// Desired resources == allocated resources. Check whether a resize is in progress.
2882
2899
resizeInProgress := ! allocatedResourcesMatchStatus (allocatedPod , podStatus )
0 commit comments