You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add liveness check to pkg/gameservers/controller. #116
I don't know if this is possible, but what would determine if this controller is healthy is that the goroutines generated in this code are still running and haven't exited in any way.
@enocom mind if I edit this ticket to include the full details? Just in case anyone else happens to want to pick this up? (Unless you want to expand this out, since I know you had ideas)
I imagine adding a Registrar, which in functionality would be similar to a sync.WaitGroup. We pass the Registrar to anything that starts a goroutine and upon starting the goroutine, we maybe call registrar.Inc() with a corresponding defer registrar.Dec() for when the goroutine exits. Then the liveness check could simply query the Registrar to see if all registered goroutines are still running.
Activity
markmandel commentedon Mar 14, 2018
@enocom mind if I edit this ticket to include the full details? Just in case anyone else happens to want to pick this up? (Unless you want to expand this out, since I know you had ideas)
enocom commentedon Mar 14, 2018
@markmandel Please do. I think this issue might be good for first-time contributors, too.
markmandel commentedon Mar 14, 2018
Some interesting notes here:
Final thought - for a readiness check, readiness can be turned on as soon as the WebHook that powers the MutationWebhookConfiguration is ready
markmandel commentedon Mar 14, 2018
@enocom did you have some thoughts on how you were thinking of tracking if the goroutines were still active? (or maybe a PR 😁 )
enocom commentedon Mar 15, 2018
I imagine adding a
Registrar, which in functionality would be similar to async.WaitGroup. We pass theRegistrarto anything that starts agoroutineand upon starting thegoroutine, we maybe callregistrar.Inc()with a correspondingdefer registrar.Dec()for when thegoroutineexits. Then the liveness check could simply query theRegistrarto see if all registeredgoroutinesare still running.Thoughts?
markmandel commentedon Mar 15, 2018
Works for me. Although the
Inc(),Dec()andCount()would need to be threadsafe. I'm assuming async.RWMutex?Thought - would this be part of a
Registrar, or maybe just part of theWorkerQueue?enocom commentedon Mar 15, 2018
There's some question of where this responsibility belongs.
Insofar as implementation,
sync.RWMutexworks and maybe even async.Mutextoo. Just depends where the hot paths may be.Register liveness check in gameservers.Controller