diff --git a/pkg/features/kube_features.go b/pkg/features/kube_features.go index 7fa39beadcbd8..9f15b2b3ee6fd 100644 --- a/pkg/features/kube_features.go +++ b/pkg/features/kube_features.go @@ -279,6 +279,14 @@ const ( // InPlacePodVerticalScaling also be enabled. InPlacePodVerticalScalingAllocatedStatus featuregate.Feature = "InPlacePodVerticalScalingAllocatedStatus" + // owner: @tallclair @esotsal + // alpha: v1.32 + // + // Allow resource resize for containers in Guaranteed pods with integer CPU requests ( default false ). + // Applies only in nodes with InPlacePodVerticalScaling and CPU Manager features enabled, and + // CPU Manager Static Policy option set. + InPlacePodVerticalScalingExclusiveCPUs featuregate.Feature = "InPlacePodVerticalScalingExclusiveCPUs" + // owner: @trierra // // Disables the Portworx in-tree driver. diff --git a/pkg/features/versioned_kube_features.go b/pkg/features/versioned_kube_features.go index dd53ee19823cc..a0a792fe0a309 100644 --- a/pkg/features/versioned_kube_features.go +++ b/pkg/features/versioned_kube_features.go @@ -406,6 +406,10 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha}, }, + InPlacePodVerticalScalingExclusiveCPUs: { + {Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha}, + }, + InTreePluginPortworxUnregister: { {Version: version.MustParse("1.23"), Default: false, PreRelease: featuregate.Alpha}, }, diff --git a/pkg/kubelet/kubelet.go b/pkg/kubelet/kubelet.go index afaf9b6ab349d..4ec01b5865ce3 100644 --- a/pkg/kubelet/kubelet.go +++ b/pkg/kubelet/kubelet.go @@ -2830,6 +2830,21 @@ func isPodResizeInProgress(pod *v1.Pod, podStatus *kubecontainer.PodStatus) bool // pod should hold the desired (pre-allocated) spec. // Returns true if the resize can proceed. func (kl *Kubelet) canResizePod(pod *v1.Pod) (bool, v1.PodResizeStatus) { + if v1qos.GetPodQOS(pod) == v1.PodQOSGuaranteed && !utilfeature.DefaultFeatureGate.Enabled(features.InPlacePodVerticalScalingExclusiveCPUs) { + if utilfeature.DefaultFeatureGate.Enabled(features.CPUManager) { + if kl.containerManager.GetNodeConfig().CPUManagerPolicy == "static" { + klog.V(3).InfoS("Resize is infeasible for Guaranteed Pods alongside CPU Manager static policy") + return false, v1.PodResizeStatusInfeasible + } + } + if utilfeature.DefaultFeatureGate.Enabled(features.MemoryManager) { + if kl.containerManager.GetNodeConfig().ExperimentalMemoryManagerPolicy == "static" { + klog.V(3).InfoS("Resize is infeasible for Guaranteed Pods alongside Memory Manager static policy") + return false, v1.PodResizeStatusInfeasible + } + } + } + node, err := kl.getNodeAnyWay() if err != nil { klog.ErrorS(err, "getNodeAnyway function failed") diff --git a/test/featuregates_linter/test_data/versioned_feature_list.yaml b/test/featuregates_linter/test_data/versioned_feature_list.yaml index d9d91e031156e..e69d01200abfd 100644 --- a/test/featuregates_linter/test_data/versioned_feature_list.yaml +++ b/test/featuregates_linter/test_data/versioned_feature_list.yaml @@ -546,6 +546,12 @@ lockToDefault: false preRelease: Alpha version: "1.32" +- name: InPlacePodVerticalScalingExclusiveCPUs + versionedSpecs: + - default: false + lockToDefault: false + preRelease: Alpha + version: "1.32" - name: InTreePluginPortworxUnregister versionedSpecs: - default: false