Kubelet: pass the acutal pod for status update
Pod status update should include the ObjectMeta of the pod. This change is required for #5738 to merge.
This commit is contained in:
@@ -29,7 +29,7 @@ import (
|
||||
"github.com/golang/glog"
|
||||
)
|
||||
|
||||
type syncPodFnType func(*api.Pod, bool, container.Pod) error
|
||||
type syncPodFnType func(*api.Pod, *api.Pod, container.Pod) error
|
||||
|
||||
type podWorkers struct {
|
||||
// Protects all per worker fields.
|
||||
@@ -61,8 +61,8 @@ type workUpdate struct {
|
||||
// The pod state to reflect.
|
||||
pod *api.Pod
|
||||
|
||||
// Whether there exists a mirror pod for pod.
|
||||
hasMirrorPod bool
|
||||
// The mirror pod of pod; nil if it does not exist.
|
||||
mirrorPod *api.Pod
|
||||
|
||||
// Function to call when the update is complete.
|
||||
updateCompleteFn func()
|
||||
@@ -97,7 +97,7 @@ func (p *podWorkers) managePodLoop(podUpdates <-chan workUpdate) {
|
||||
return
|
||||
}
|
||||
|
||||
err = p.syncPodFn(newWork.pod, newWork.hasMirrorPod,
|
||||
err = p.syncPodFn(newWork.pod, newWork.mirrorPod,
|
||||
container.Pods(pods).FindPodByID(newWork.pod.UID))
|
||||
if err != nil {
|
||||
glog.Errorf("Error syncing pod %s, skipping: %v", newWork.pod.UID, err)
|
||||
@@ -112,7 +112,7 @@ func (p *podWorkers) managePodLoop(podUpdates <-chan workUpdate) {
|
||||
}
|
||||
|
||||
// Apply the new setting to the specified pod. updateComplete is called when the update is completed.
|
||||
func (p *podWorkers) UpdatePod(pod *api.Pod, hasMirrorPod bool, updateComplete func()) {
|
||||
func (p *podWorkers) UpdatePod(pod *api.Pod, mirrorPod *api.Pod, updateComplete func()) {
|
||||
uid := pod.UID
|
||||
var podUpdates chan workUpdate
|
||||
var exists bool
|
||||
@@ -135,13 +135,13 @@ func (p *podWorkers) UpdatePod(pod *api.Pod, hasMirrorPod bool, updateComplete f
|
||||
p.isWorking[pod.UID] = true
|
||||
podUpdates <- workUpdate{
|
||||
pod: pod,
|
||||
hasMirrorPod: hasMirrorPod,
|
||||
mirrorPod: mirrorPod,
|
||||
updateCompleteFn: updateComplete,
|
||||
}
|
||||
} else {
|
||||
p.lastUndeliveredWorkUpdate[pod.UID] = workUpdate{
|
||||
pod: pod,
|
||||
hasMirrorPod: hasMirrorPod,
|
||||
mirrorPod: mirrorPod,
|
||||
updateCompleteFn: updateComplete,
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user