Skip to content

Commit 81dc453

Browse files
authored
Merge pull request kubernetes#128287 from Nordix/esotsal/128068
[FG:InPlacePodVerticalScaling] Gate Disallow in-place resize for guaranteed pods on nodes with a static topology policy
2 parents 3232e2f + 2d8939c commit 81dc453

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
@@ -279,6 +279,14 @@ const (
279279
// InPlacePodVerticalScaling also be enabled.
280280
InPlacePodVerticalScalingAllocatedStatus featuregate.Feature = "InPlacePodVerticalScalingAllocatedStatus"
281281

282+
// owner: @tallclair @esotsal
283+
// alpha: v1.32
284+
//
285+
// Allow resource resize for containers in Guaranteed pods with integer CPU requests ( default false ).
286+
// Applies only in nodes with InPlacePodVerticalScaling and CPU Manager features enabled, and
287+
// CPU Manager Static Policy option set.
288+
InPlacePodVerticalScalingExclusiveCPUs featuregate.Feature = "InPlacePodVerticalScalingExclusiveCPUs"
289+
282290
// owner: @trierra
283291
//
284292
// Disables the Portworx in-tree driver.

pkg/features/versioned_kube_features.go

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

409+
InPlacePodVerticalScalingExclusiveCPUs: {
410+
{Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha},
411+
},
412+
409413
InTreePluginPortworxUnregister: {
410414
{Version: version.MustParse("1.23"), Default: false, PreRelease: featuregate.Alpha},
411415
},

pkg/kubelet/kubelet.go

+15
Original file line numberDiff line numberDiff line change
@@ -2830,6 +2830,21 @@ func isPodResizeInProgress(pod *v1.Pod, podStatus *kubecontainer.PodStatus) bool
28302830
// pod should hold the desired (pre-allocated) spec.
28312831
// Returns true if the resize can proceed.
28322832
func (kl *Kubelet) canResizePod(pod *v1.Pod) (bool, v1.PodResizeStatus) {
2833+
if v1qos.GetPodQOS(pod) == v1.PodQOSGuaranteed && !utilfeature.DefaultFeatureGate.Enabled(features.InPlacePodVerticalScalingExclusiveCPUs) {
2834+
if utilfeature.DefaultFeatureGate.Enabled(features.CPUManager) {
2835+
if kl.containerManager.GetNodeConfig().CPUManagerPolicy == "static" {
2836+
klog.V(3).InfoS("Resize is infeasible for Guaranteed Pods alongside CPU Manager static policy")
2837+
return false, v1.PodResizeStatusInfeasible
2838+
}
2839+
}
2840+
if utilfeature.DefaultFeatureGate.Enabled(features.MemoryManager) {
2841+
if kl.containerManager.GetNodeConfig().ExperimentalMemoryManagerPolicy == "static" {
2842+
klog.V(3).InfoS("Resize is infeasible for Guaranteed Pods alongside Memory Manager static policy")
2843+
return false, v1.PodResizeStatusInfeasible
2844+
}
2845+
}
2846+
}
2847+
28332848
node, err := kl.getNodeAnyWay()
28342849
if err != nil {
28352850
klog.ErrorS(err, "getNodeAnyway function failed")

test/featuregates_linter/test_data/versioned_feature_list.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,12 @@
546546
lockToDefault: false
547547
preRelease: Alpha
548548
version: "1.32"
549+
- name: InPlacePodVerticalScalingExclusiveCPUs
550+
versionedSpecs:
551+
- default: false
552+
lockToDefault: false
553+
preRelease: Alpha
554+
version: "1.32"
549555
- name: InTreePluginPortworxUnregister
550556
versionedSpecs:
551557
- default: false

0 commit comments

Comments
 (0)