mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
pkg/kubelet: clean up status manager
This commit is contained in:
parent
d577db9987
commit
d24f60b5b8
@ -112,21 +112,20 @@ func (s *statusManager) syncBatch() error {
|
||||
ObjectMeta: pod.ObjectMeta,
|
||||
}
|
||||
// TODO: make me easier to express from client code
|
||||
if statusPod, err = s.kubeClient.Pods(statusPod.Namespace).Get(statusPod.Name); err == nil {
|
||||
statusPod.Status = status
|
||||
}
|
||||
statusPod, err = s.kubeClient.Pods(statusPod.Namespace).Get(statusPod.Name)
|
||||
if err == nil {
|
||||
statusPod, err = s.kubeClient.Pods(pod.Namespace).UpdateStatus(statusPod)
|
||||
statusPod.Status = status
|
||||
_, err = s.kubeClient.Pods(pod.Namespace).UpdateStatus(statusPod)
|
||||
// TODO: handle conflict as a retry, make that easier too.
|
||||
}
|
||||
if err != nil {
|
||||
// We failed to update status. In order to make sure we retry next time
|
||||
// we delete cached value. This may result in an additional update, but
|
||||
// this is ok.
|
||||
s.DeletePodStatus(podFullName)
|
||||
return fmt.Errorf("error updating status for pod %q: %v", pod.Name, err)
|
||||
if err == nil {
|
||||
glog.V(3).Infof("Status for pod %q updated successfully", pod.Name)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
glog.V(3).Infof("Status for pod %q updated successfully", pod.Name)
|
||||
return nil
|
||||
// We failed to update status. In order to make sure we retry next time
|
||||
// we delete cached value. This may result in an additional update, but
|
||||
// this is ok.
|
||||
s.DeletePodStatus(podFullName)
|
||||
return fmt.Errorf("error updating status for pod %q: %v", pod.Name, err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user