Let the kubernetes service reconciler timeout on shutdown

This commit is contained in:
Jordan Liggitt 2018-05-02 22:44:28 -04:00
parent e3e31ecd40
commit a2ef4735cd
No known key found for this signature in database
GPG Key ID: 39928704103C7229

View File

@ -152,7 +152,22 @@ func (c *Controller) Stop() {
c.runner.Stop()
}
endpointPorts := createEndpointPortSpec(c.PublicServicePort, "https", c.ExtraEndpointPorts)
c.EndpointReconciler.StopReconciling("kubernetes", c.PublicIP, endpointPorts)
finishedReconciling := make(chan struct{})
go func() {
defer close(finishedReconciling)
glog.Infof("Shutting down kubernetes service endpoint reconciler")
if err := c.EndpointReconciler.StopReconciling("kubernetes", c.PublicIP, endpointPorts); err != nil {
glog.Error(err)
}
}()
select {
case <-finishedReconciling:
// done
case <-time.After(2 * c.EndpointInterval):
// don't block server shutdown forever if we can't reach etcd to remove ourselves
glog.Warning("StopReconciling() timed out")
}
}
// RunKubernetesNamespaces periodically makes sure that all internal namespaces exist