mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-18 04:54:54 +00:00
Add MemoryReservationPolicy to kubeletconfig for MemoryQoS feature
Add MemoryReservationPolicy (None/HardReservation) controls memory.min. This allows independently of memory.min protection, providing operators more granular control over memoryQoS behavior. Signed-off-by: Qi Wang <qiwan@redhat.com>
This commit is contained in:
@@ -35,6 +35,7 @@ import (
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
resourcehelper "k8s.io/component-helpers/resource"
|
||||
v1helper "k8s.io/kubernetes/pkg/apis/core/v1/helper"
|
||||
"k8s.io/kubernetes/pkg/kubelet/apis/config"
|
||||
"k8s.io/kubernetes/pkg/kubelet/cm"
|
||||
usernamespacefeature "k8s.io/kubernetes/pkg/kubelet/userns"
|
||||
"k8s.io/kubernetes/pkg/volume"
|
||||
@@ -119,7 +120,7 @@ func calculateEmptyDirMemorySize(nodeAllocatableMemory *resource.Quantity, spec
|
||||
// determine pod resource allocation
|
||||
// we use the same function for pod cgroup assignment to maintain consistent behavior
|
||||
// NOTE: this could be nil on systems that do not support pod memory containment (i.e. windows)
|
||||
podResourceConfig := cm.ResourceConfigForPod(pod, false, uint64(100000), false)
|
||||
podResourceConfig := cm.ResourceConfigForPod(pod, false, uint64(100000), false, config.NoneMemoryReservationPolicy)
|
||||
if podResourceConfig != nil && podResourceConfig.Memory != nil {
|
||||
podMemoryLimit := resource.NewQuantity(*(podResourceConfig.Memory), resource.BinarySI)
|
||||
// ensure 0 < value < size
|
||||
|
||||
Reference in New Issue
Block a user