mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 21:47:07 +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,
|
ObjectMeta: pod.ObjectMeta,
|
||||||
}
|
}
|
||||||
// TODO: make me easier to express from client code
|
// TODO: make me easier to express from client code
|
||||||
if statusPod, err = s.kubeClient.Pods(statusPod.Namespace).Get(statusPod.Name); err == nil {
|
statusPod, err = s.kubeClient.Pods(statusPod.Namespace).Get(statusPod.Name)
|
||||||
statusPod.Status = status
|
|
||||||
}
|
|
||||||
if err == nil {
|
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.
|
// TODO: handle conflict as a retry, make that easier too.
|
||||||
|
if err == nil {
|
||||||
|
glog.V(3).Infof("Status for pod %q updated successfully", pod.Name)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
}
|
||||||
|
|
||||||
// We failed to update status. In order to make sure we retry next time
|
// 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
|
// we delete cached value. This may result in an additional update, but
|
||||||
// this is ok.
|
// this is ok.
|
||||||
s.DeletePodStatus(podFullName)
|
s.DeletePodStatus(podFullName)
|
||||||
return fmt.Errorf("error updating status for pod %q: %v", pod.Name, err)
|
return fmt.Errorf("error updating status for pod %q: %v", pod.Name, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(3).Infof("Status for pod %q updated successfully", pod.Name)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user