Skip to content

Commit 2d8939c

Browse files
author
Sotiris Salloumis
committed
Gate: disallow in-place resize for guaranteed pods on nodes with a static topology policy
New gate "InPlacePodVerticalScalingExclusiveCPUs" is off by default, but can be enabled to unblock development of Static CPU management alongside InPlacePodVerticalScaling.
1 parent af41aa1 commit 2d8939c

File tree

4 files changed

+33
-0
lines changed

4 files changed

+33
-0
lines changed

pkg/features/kube_features.go

+8
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,14 @@ const (
270270
// InPlacePodVerticalScaling also be enabled.
271271
InPlacePodVerticalScalingAllocatedStatus featuregate.Feature = "InPlacePodVerticalScalingAllocatedStatus"
272272

273+
// owner: @tallclair @esotsal
274+
// alpha: v1.32
275+
//
276+
// Allow resource resize for containers in Guaranteed pods with integer CPU requests ( default false ).
277+
// Applies only in nodes with InPlacePodVerticalScaling and CPU Manager features enabled, and
278+
// CPU Manager Static Policy option set.
279+
InPlacePodVerticalScalingExclusiveCPUs featuregate.Feature = "InPlacePodVerticalScalingExclusiveCPUs"
280+
273281
// owner: @trierra
274282
//
275283
// Disables the Portworx in-tree driver.

pkg/features/versioned_kube_features.go

+4
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,10 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate
397397
{Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha},
398398
},
399399

400+
InPlacePodVerticalScalingExclusiveCPUs: {
401+
{Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha},
402+
},
403+
400404
InTreePluginPortworxUnregister: {
401405
{Version: version.MustParse("1.23"), Default: false, PreRelease: featuregate.Alpha},
402406
},

pkg/kubelet/kubelet.go

+15
Original file line numberDiff line numberDiff line change
@@ -2838,6 +2838,21 @@ func isPodResizeInProgress(pod *v1.Pod, podStatus *kubecontainer.PodStatus) bool
28382838
// pod should hold the desired (pre-allocated) spec.
28392839
// Returns true if the resize can proceed.
28402840
func (kl *Kubelet) canResizePod(pod *v1.Pod) (bool, v1.PodResizeStatus) {
2841+
if v1qos.GetPodQOS(pod) == v1.PodQOSGuaranteed && !utilfeature.DefaultFeatureGate.Enabled(features.InPlacePodVerticalScalingExclusiveCPUs) {
2842+
if utilfeature.DefaultFeatureGate.Enabled(features.CPUManager) {
2843+
if kl.containerManager.GetNodeConfig().CPUManagerPolicy == "static" {
2844+
klog.V(3).InfoS("Resize is infeasible for Guaranteed Pods alongside CPU Manager static policy")
2845+
return false, v1.PodResizeStatusInfeasible
2846+
}
2847+
}
2848+
if utilfeature.DefaultFeatureGate.Enabled(features.MemoryManager) {
2849+
if kl.containerManager.GetNodeConfig().ExperimentalMemoryManagerPolicy == "static" {
2850+
klog.V(3).InfoS("Resize is infeasible for Guaranteed Pods alongside Memory Manager static policy")
2851+
return false, v1.PodResizeStatusInfeasible
2852+
}
2853+
}
2854+
}
2855+
28412856
node, err := kl.getNodeAnyWay()
28422857
if err != nil {
28432858
klog.ErrorS(err, "getNodeAnyway function failed")

test/featuregates_linter/test_data/versioned_feature_list.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,12 @@
522522
lockToDefault: false
523523
preRelease: Alpha
524524
version: "1.32"
525+
- name: InPlacePodVerticalScalingExclusiveCPUs
526+
versionedSpecs:
527+
- default: false
528+
lockToDefault: false
529+
preRelease: Alpha
530+
version: "1.32"
525531
- name: InTreePluginPortworxUnregister
526532
versionedSpecs:
527533
- default: false

0 commit comments

Comments
 (0)