Merge pull request #113559 from wojtek-t/clean_shutdown_5

Clean shutdown of few more integration tests
This commit is contained in:
Kubernetes Prow Robot
2022-11-03 09:01:45 -07:00
committed by GitHub
4 changed files with 48 additions and 35 deletions

View File

@@ -138,6 +138,20 @@ func (o *CloudControllerManagerOptions) Flags(allControllers, disabledByDefaultC
// ApplyTo fills up cloud controller manager config with options.
func (o *CloudControllerManagerOptions) ApplyTo(c *config.Config, userAgent string) error {
var err error
// Build kubeconfig first to so that if it fails, it doesn't cause leaking
// goroutines (started from initializing secure serving - which underneath
// creates a queue which in its constructor starts a goroutine).
c.Kubeconfig, err = clientcmd.BuildConfigFromFlags(o.Master, o.Kubeconfig)
if err != nil {
return err
}
c.Kubeconfig.DisableCompression = true
c.Kubeconfig.ContentConfig.AcceptContentTypes = o.Generic.ClientConnection.AcceptContentTypes
c.Kubeconfig.ContentConfig.ContentType = o.Generic.ClientConnection.ContentType
c.Kubeconfig.QPS = o.Generic.ClientConnection.QPS
c.Kubeconfig.Burst = int(o.Generic.ClientConnection.Burst)
if err = o.Generic.ApplyTo(&c.ComponentConfig.Generic); err != nil {
return err
}
@@ -159,16 +173,6 @@ func (o *CloudControllerManagerOptions) ApplyTo(c *config.Config, userAgent stri
}
}
c.Kubeconfig, err = clientcmd.BuildConfigFromFlags(o.Master, o.Kubeconfig)
if err != nil {
return err
}
c.Kubeconfig.DisableCompression = true
c.Kubeconfig.ContentConfig.AcceptContentTypes = o.Generic.ClientConnection.AcceptContentTypes
c.Kubeconfig.ContentConfig.ContentType = o.Generic.ClientConnection.ContentType
c.Kubeconfig.QPS = o.Generic.ClientConnection.QPS
c.Kubeconfig.Burst = int(o.Generic.ClientConnection.Burst)
c.Client, err = clientset.NewForConfig(restclient.AddUserAgent(c.Kubeconfig, userAgent))
if err != nil {
return err