fix error treatment and remove annotations from proto

This commit is contained in:
Filipe Xavier 2025-02-22 12:08:23 -03:00
parent 09817b320f
commit dc8dc31442
2 changed files with 10 additions and 6 deletions

View File

@ -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.

View File

@ -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)
}
}
}