@@ -121,8 +121,7 @@ func (hc *HealthController) CheckHealth() bool {
121121
122122//Run starts the HealthController 
123123func  (hc  * HealthController ) Run (healthChan  <- chan  * ControllerHeartbeat , stopCh  <- chan  struct {}, wg  * sync.WaitGroup ) error  {
124- 	Started  :=  time .Now ()
125- 	t  :=  time .NewTicker (500  *  time .Millisecond )
124+ 	t  :=  time .NewTicker (5000  *  time .Millisecond )
126125	defer  wg .Done ()
127126	glog .Info ("Starting health controller" )
128127
@@ -144,11 +143,10 @@ func (hc *HealthController) Run(healthChan <-chan *ControllerHeartbeat, stopCh <
144143		hc .HTTPEnabled  =  false 
145144	}
146145
146+ 	//Give the controllers a few seconds to start before checking health 
147+ 	time .Sleep (60  *  time .Second )
148+ 
147149	for  {
148- 		//Give the controllers a few seconds to start before checking health 
149- 		if  time .Since (Started ) >  5 * time .Second  {
150- 			hc .Status .Healthy  =  hc .CheckHealth ()
151- 		}
152150		select  {
153151		case  <- stopCh :
154152			glog .Infof ("Shutting down health controller" )
@@ -163,6 +161,7 @@ func (hc *HealthController) Run(healthChan <-chan *ControllerHeartbeat, stopCh <
163161		case  <- t .C :
164162			glog .V (4 ).Info ("Health controller tick" )
165163		}
164+ 		hc .Status .Healthy  =  hc .CheckHealth ()
166165	}
167166
168167}
@@ -173,7 +172,11 @@ func NewHealthController(config *options.KubeRouterConfig) (*HealthController, e
173172		Config :     config ,
174173		HealthPort : config .HealthPort ,
175174		Status : HealthStats {
176- 			Healthy : false ,
175+ 			Healthy :                        true ,
176+ 			MetricsControllerAlive :         time .Now (),
177+ 			NetworkPolicyControllerAlive :   time .Now (),
178+ 			NetworkRoutingControllerAlive :  time .Now (),
179+ 			NetworkServicesControllerAlive : time .Now (),
177180		},
178181	}
179182	return  & hc , nil 
0 commit comments