diff --git a/pkg/kubelet/kuberuntime/kuberuntime_container.go b/pkg/kubelet/kuberuntime/kuberuntime_container.go index b57148c0213..b148f07f757 100644 --- a/pkg/kubelet/kuberuntime/kuberuntime_container.go +++ b/pkg/kubelet/kuberuntime/kuberuntime_container.go @@ -423,11 +423,12 @@ func (m *kubeGenericRuntimeManager) updatePodSandboxResources(sandboxID string, if err != nil { stat, _ := grpcstatus.FromError(err) if stat.Code() == codes.Unimplemented { - klog.ErrorS(err, "updatePodSandboxResources failed: method unimplemented on runtime service", "sandboxID", sandboxID) + klog.InfoS("updatePodSandboxResources failed: method unimplemented on runtime service", "sandboxID", sandboxID) return nil } + klog.ErrorS(err, "updatePodSandboxResources failed", "sandboxID", sandboxID) } - return err + return nil } // makeDevices generates container devices for kubelet runtime v1. diff --git a/pkg/kubelet/kuberuntime/kuberuntime_manager.go b/pkg/kubelet/kuberuntime/kuberuntime_manager.go index 20c49327844..6d2d6e629c7 100644 --- a/pkg/kubelet/kuberuntime/kuberuntime_manager.go +++ b/pkg/kubelet/kuberuntime/kuberuntime_manager.go @@ -747,6 +747,7 @@ func (m *kubeGenericRuntimeManager) doPodResizeAction(pod *v1.Pod, podContainerC // partially actuated. defer m.runtimeHelper.SetPodWatchCondition(pod.UID, "doPodResizeAction", func(*kubecontainer.PodStatus) bool { return true }) + anyResizeDone := false if len(podContainerChanges.ContainersToUpdate[v1.ResourceMemory]) > 0 || podContainerChanges.UpdatePodResources { currentPodMemoryConfig, err := pcm.GetPodCgroupConfig(pod, v1.ResourceMemory) if err != nil { @@ -775,9 +776,7 @@ func (m *kubeGenericRuntimeManager) doPodResizeAction(pod *v1.Pod, podContainerC result.Fail(errResize) return } - if errUpdate := m.updatePodSandboxResources(podContainerChanges.SandboxID, pod); errUpdate != nil { - klog.ErrorS(err, "updatePodSandboxResources failed", "pod", pod.Name) - } + anyResizeDone = true } if len(podContainerChanges.ContainersToUpdate[v1.ResourceCPU]) > 0 || podContainerChanges.UpdatePodResources { if podResources.CPUShares == nil { @@ -804,8 +803,12 @@ func (m *kubeGenericRuntimeManager) doPodResizeAction(pod *v1.Pod, podContainerC result.Fail(errResize) return } + anyResizeDone = true + } + + if anyResizeDone { if errUpdate := m.updatePodSandboxResources(podContainerChanges.SandboxID, pod); errUpdate != nil { - klog.ErrorS(err, "updatePodSandboxResources failed", "pod", pod.Name) + klog.ErrorS(errUpdate, "updatePodSandboxResources failed", "pod", pod.Name) } } }