// Start is a blocking function that monitors Consul for replication controllers. // The Farm will attempt to claim replication controllers as they appear and, // if successful, will start goroutines for those replication controllers to do // their job. Closing the quit channel will cause this function to return, // releasing all locks it holds. // // Start is not safe for concurrent execution. Do not execute multiple // concurrent instances of Start. func (rcf *Farm) Start(quit <-chan struct{}) { consulutil.WithSession(quit, rcf.sessions, func(sessionQuit <-chan struct{}, sessionID string) { rcf.logger.WithField("session", sessionID).Infoln("Acquired new session") rcf.session = rcf.kpStore.NewUnmanagedSession(sessionID, "") rcf.mainLoop(sessionQuit) }) }
func (dsf *Farm) Start(quitCh <-chan struct{}) { consulutil.WithSession(quitCh, dsf.sessions, func(sessionQuit <-chan struct{}, sessionID string) { dsf.logger.WithField("session", sessionID).Infoln("Acquired new session for ds farm") dsf.session = dsf.kpStore.NewUnmanagedSession(sessionID, "") go dsf.cleanupDaemonSetPods(sessionQuit) dsf.mainLoop(sessionQuit) }) }