Skip to content

Commit

Permalink
Let the kubernetes service reconciler timeout on shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
liggitt committed May 3, 2018
1 parent e3e31ec commit a2ef473
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion pkg/master/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a2ef473

Please sign in to comment.