Fix graceful shutdown

graceful shutdown of goroutines on operator exit
This commit is contained in:
Murat Kabilov
2017-07-27 12:54:22 +02:00
committed by GitHub
parent 1f8b37f33d
commit 3ad4b127c4
3 changed files with 32 additions and 16 deletions
+5 -1
View File
@@ -1,6 +1,8 @@
package controller
import (
"sync"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/watch"
@@ -97,7 +99,9 @@ func (c *Controller) podDelete(obj interface{}) {
c.podCh <- podEvent
}
func (c *Controller) podEventsDispatcher(stopCh <-chan struct{}) {
func (c *Controller) podEventsDispatcher(stopCh <-chan struct{}, wg *sync.WaitGroup) {
defer wg.Done()
c.logger.Debugln("Watching all pod events")
for {
select {