diff --git a/pkg/kubelet/kuberuntime/kuberuntime_manager.go b/pkg/kubelet/kuberuntime/kuberuntime_manager.go index 55cdf9d4c43..0074688aa6a 100644 --- a/pkg/kubelet/kuberuntime/kuberuntime_manager.go +++ b/pkg/kubelet/kuberuntime/kuberuntime_manager.go @@ -22,6 +22,7 @@ import ( "fmt" "os" "path/filepath" + "runtime" "sort" "time" @@ -551,19 +552,19 @@ func containerSucceeded(c *v1.Container, podStatus *kubecontainer.PodStatus) boo } func IsInPlacePodVerticalScalingAllowed(pod *v1.Pod) bool { - if !utilfeature.DefaultFeatureGate.Enabled(features.InPlacePodVerticalScaling) { - return false - } - if types.IsStaticPod(pod) { - return false - } - return true + return utilfeature.DefaultFeatureGate.Enabled(features.InPlacePodVerticalScaling) && + !types.IsStaticPod(pod) && + runtime.GOOS != "windows" } // computePodResizeAction determines the actions required (if any) to resize the given container. // Returns whether to keep (true) or restart (false) the container. // TODO(vibansal): Make this function to be agnostic to whether it is dealing with a restartable init container or not (i.e. remove the argument `isRestartableInitContainer`). func (m *kubeGenericRuntimeManager) computePodResizeAction(pod *v1.Pod, containerIdx int, isRestartableInitContainer bool, kubeContainerStatus *kubecontainer.Status, changes *podActions) (keepContainer bool) { + if !IsInPlacePodVerticalScalingAllowed(pod) { + return true + } + var container v1.Container if isRestartableInitContainer { container = pod.Spec.InitContainers[containerIdx] @@ -1092,7 +1093,7 @@ func (m *kubeGenericRuntimeManager) computePodActions(ctx context.Context, pod * // If the container failed the startup probe, we should kill it. message = fmt.Sprintf("Container %s failed startup probe", container.Name) reason = reasonStartupProbe - } else if IsInPlacePodVerticalScalingAllowed(pod) && !m.computePodResizeAction(pod, idx, false, containerStatus, &changes) { + } else if !m.computePodResizeAction(pod, idx, false, containerStatus, &changes) { // computePodResizeAction updates 'changes' if resize policy requires restarting this container continue } else {