Merge pull request #65866 from sttts/sttts-ctrl-manager-stopch

Automatic merge from submit-queue (batch tested with PRs 64511, 65865, 65867, 65866). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

kube-controller-manager: add stopCh plumbing

Needed for integration testing.
This commit is contained in:
Kubernetes Submit Queue 2018-07-05 13:01:18 -07:00 committed by GitHub
commit 43b59986f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -96,7 +96,7 @@ controller, and serviceaccounts controller.`,
os.Exit(1) os.Exit(1)
} }
if err := Run(c.Complete()); err != nil { if err := Run(c.Complete(), wait.NeverStop); err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err) fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(1) os.Exit(1)
} }
@ -118,7 +118,7 @@ func ResyncPeriod(c *config.CompletedConfig) func() time.Duration {
} }
// Run runs the KubeControllerManagerOptions. This should never exit. // Run runs the KubeControllerManagerOptions. This should never exit.
func Run(c *config.CompletedConfig) error { func Run(c *config.CompletedConfig, stopCh <-chan struct{}) error {
// To help debugging, immediately log version // To help debugging, immediately log version
glog.Infof("Version: %+v", version.Get()) glog.Infof("Version: %+v", version.Get())
@ -129,7 +129,6 @@ func Run(c *config.CompletedConfig) error {
} }
// Start the controller manager HTTP server // Start the controller manager HTTP server
stopCh := make(chan struct{})
if c.SecureServing != nil { if c.SecureServing != nil {
handler := genericcontrollermanager.NewBaseHandler(&c.ComponentConfig.Debugging) handler := genericcontrollermanager.NewBaseHandler(&c.ComponentConfig.Debugging)
handler = genericcontrollermanager.BuildHandlerChain(handler, &c.Authorization, &c.Authentication) handler = genericcontrollermanager.BuildHandlerChain(handler, &c.Authorization, &c.Authentication)