mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-17 02:06:23 +00:00
Ensure when pod-level memory is modified, skip cgroup writes, but ensure actuated pod-level resources are updated
This commit is contained in:
@@ -925,7 +925,6 @@ func (m *kubeGenericRuntimeManager) doPodResizeAction(ctx context.Context, pod *
|
||||
}
|
||||
case v1.ResourceMemory:
|
||||
if !setLimitValue {
|
||||
// Memory requests aren't written to cgroups.
|
||||
return nil
|
||||
}
|
||||
resizedResources.Memory = podResources.Memory
|
||||
@@ -951,11 +950,6 @@ func (m *kubeGenericRuntimeManager) doPodResizeAction(ctx context.Context, pod *
|
||||
// Update our tracking of the current state.
|
||||
currentPodResources = mergedPodResources
|
||||
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.InPlacePodLevelResourcesVerticalScaling) {
|
||||
if err = updateActuatedPodLevelResources(rName); err != nil {
|
||||
logger.Error(err, "Failed to update pod-level actuated resources", "resource", rName, "pod", klog.KObj(pod))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -984,6 +978,7 @@ func (m *kubeGenericRuntimeManager) doPodResizeAction(ctx context.Context, pod *
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// At downsizing, requests should shrink prior to limits in order to keep "requests <= limits".
|
||||
if newPodCgReqValue < currPodCgReqValue {
|
||||
// TODO: Pass logger from context once contextual logging migration is complete
|
||||
@@ -997,6 +992,12 @@ func (m *kubeGenericRuntimeManager) doPodResizeAction(ctx context.Context, pod *
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.InPlacePodLevelResourcesVerticalScaling) && podContainerChanges.UpdatePodLevelResources {
|
||||
if err = updateActuatedPodLevelResources(rName); err != nil {
|
||||
logger.Error(err, "Failed to update pod-level actuated resources", "resource", rName, "pod", klog.KObj(pod))
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user