mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +00:00
Merge pull request #18449 from timstclair/race
Auto commit by PR queue bot
This commit is contained in:
commit
5429d15fcf
@ -905,8 +905,9 @@ func (kl *Kubelet) Run(updates <-chan kubetypes.PodUpdate) {
|
|||||||
// handled by pod workers).
|
// handled by pod workers).
|
||||||
go util.Until(kl.podKiller, 1*time.Second, util.NeverStop)
|
go util.Until(kl.podKiller, 1*time.Second, util.NeverStop)
|
||||||
|
|
||||||
// Run the system oom watcher forever.
|
// Start component sync loops.
|
||||||
kl.statusManager.Start()
|
kl.statusManager.Start()
|
||||||
|
kl.probeManager.Start()
|
||||||
// Start the pod lifecycle event generator.
|
// Start the pod lifecycle event generator.
|
||||||
kl.pleg.Start()
|
kl.pleg.Start()
|
||||||
kl.syncLoop(updates, kl)
|
kl.syncLoop(updates, kl)
|
||||||
|
@ -29,6 +29,7 @@ var _ Manager = FakeManager{}
|
|||||||
func (_ FakeManager) AddPod(_ *api.Pod) {}
|
func (_ FakeManager) AddPod(_ *api.Pod) {}
|
||||||
func (_ FakeManager) RemovePod(_ *api.Pod) {}
|
func (_ FakeManager) RemovePod(_ *api.Pod) {}
|
||||||
func (_ FakeManager) CleanupPods(_ []*api.Pod) {}
|
func (_ FakeManager) CleanupPods(_ []*api.Pod) {}
|
||||||
|
func (_ FakeManager) Start() {}
|
||||||
|
|
||||||
func (_ FakeManager) UpdatePodStatus(_ types.UID, podStatus *api.PodStatus) {
|
func (_ FakeManager) UpdatePodStatus(_ types.UID, podStatus *api.PodStatus) {
|
||||||
for i := range podStatus.ContainerStatuses {
|
for i := range podStatus.ContainerStatuses {
|
||||||
|
@ -52,6 +52,9 @@ type Manager interface {
|
|||||||
// UpdatePodStatus modifies the given PodStatus with the appropriate Ready state for each
|
// UpdatePodStatus modifies the given PodStatus with the appropriate Ready state for each
|
||||||
// container based on container running status, cached probe results and worker states.
|
// container based on container running status, cached probe results and worker states.
|
||||||
UpdatePodStatus(types.UID, *api.PodStatus)
|
UpdatePodStatus(types.UID, *api.PodStatus)
|
||||||
|
|
||||||
|
// Start starts the Manager sync loops.
|
||||||
|
Start()
|
||||||
}
|
}
|
||||||
|
|
||||||
type manager struct {
|
type manager struct {
|
||||||
@ -79,20 +82,22 @@ func NewManager(
|
|||||||
runner kubecontainer.ContainerCommandRunner,
|
runner kubecontainer.ContainerCommandRunner,
|
||||||
refManager *kubecontainer.RefManager,
|
refManager *kubecontainer.RefManager,
|
||||||
recorder record.EventRecorder) Manager {
|
recorder record.EventRecorder) Manager {
|
||||||
|
|
||||||
prober := newProber(runner, refManager, recorder)
|
prober := newProber(runner, refManager, recorder)
|
||||||
readinessManager := results.NewManager()
|
readinessManager := results.NewManager()
|
||||||
m := &manager{
|
return &manager{
|
||||||
statusManager: statusManager,
|
statusManager: statusManager,
|
||||||
prober: prober,
|
prober: prober,
|
||||||
readinessManager: readinessManager,
|
readinessManager: readinessManager,
|
||||||
livenessManager: livenessManager,
|
livenessManager: livenessManager,
|
||||||
workers: make(map[probeKey]*worker),
|
workers: make(map[probeKey]*worker),
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start syncing probe status. This should only be called once.
|
||||||
|
func (m *manager) Start() {
|
||||||
// Start syncing readiness.
|
// Start syncing readiness.
|
||||||
go util.Forever(m.updateReadiness, 0)
|
go util.Forever(m.updateReadiness, 0)
|
||||||
|
|
||||||
return m
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key uniquely identifying container probes
|
// Key uniquely identifying container probes
|
||||||
|
@ -251,6 +251,7 @@ func TestUpdatePodStatus(t *testing.T) {
|
|||||||
func TestUpdateReadiness(t *testing.T) {
|
func TestUpdateReadiness(t *testing.T) {
|
||||||
testPod := getTestPod(readiness, api.Probe{})
|
testPod := getTestPod(readiness, api.Probe{})
|
||||||
m := newTestManager()
|
m := newTestManager()
|
||||||
|
m.Start()
|
||||||
m.statusManager.SetPodStatus(&testPod, getTestRunningStatus())
|
m.statusManager.SetPodStatus(&testPod, getTestRunningStatus())
|
||||||
|
|
||||||
m.AddPod(&testPod)
|
m.AddPod(&testPod)
|
||||||
|
Loading…
Reference in New Issue
Block a user