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