mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Merge pull request #40385 from ncdc/shared-informers-02-swap-existing
Automatic merge from submit-queue Replace hand-written informers with generated ones Replace existing uses of hand-written informers with generated ones. Follow-up commits will switch the use of one-off informers to shared informers. This is a precursor to #40097. That PR will switch one-off informers to shared informers for the majority of the code base (but not quite all of it...). NOTE: this does create a second set of shared informers in the kube-controller-manager. This will be resolved back down to a single factory once #40097 is reviewed and merged. There are a couple of places where I expanded the # of caches we wait for in the calls to `WaitForCacheSync` - please pay attention to those. I also added in a commented-out wait in the attach/detach controller. If @kubernetes/sig-storage-pr-reviews is ok with enabling the waiting, I'll do it (I'll just need to tweak an integration test slightly). @deads2k @sttts @smarterclayton @liggitt @soltysh @timothysc @lavalamp @wojtek-t @gmarek @sjenning @derekwaynecarr @kubernetes/sig-scalability-pr-reviews
This commit is contained in:
		@@ -57,6 +57,7 @@ import (
 | 
			
		||||
	"k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
 | 
			
		||||
	coreclient "k8s.io/kubernetes/pkg/client/clientset_generated/clientset/typed/core/v1"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
 | 
			
		||||
	informers "k8s.io/kubernetes/pkg/client/informers/informers_generated"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/controller"
 | 
			
		||||
	replicationcontroller "k8s.io/kubernetes/pkg/controller/replication"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/generated/openapi"
 | 
			
		||||
@@ -120,11 +121,13 @@ func NewMasterComponents(c *Config) *MasterComponents {
 | 
			
		||||
	// TODO: caesarxuchao: remove this client when the refactoring of client libraray is done.
 | 
			
		||||
	clientset := clientset.NewForConfigOrDie(&restclient.Config{Host: s.URL, ContentConfig: restclient.ContentConfig{GroupVersion: &api.Registry.GroupOrDie(v1.GroupName).GroupVersion}, QPS: c.QPS, Burst: c.Burst})
 | 
			
		||||
	rcStopCh := make(chan struct{})
 | 
			
		||||
	controllerManager := replicationcontroller.NewReplicationManagerFromClient(clientset, controller.NoResyncPeriodFunc, c.Burst, 4096)
 | 
			
		||||
	informerFactory := informers.NewSharedInformerFactory(nil, clientset, controller.NoResyncPeriodFunc())
 | 
			
		||||
	controllerManager := replicationcontroller.NewReplicationManager(informerFactory.Core().V1().Pods(), informerFactory.Core().V1().ReplicationControllers(), clientset, c.Burst, 4096, false)
 | 
			
		||||
 | 
			
		||||
	// TODO: Support events once we can cleanly shutdown an event recorder.
 | 
			
		||||
	controllerManager.SetEventRecorder(&record.FakeRecorder{})
 | 
			
		||||
	if c.StartReplicationManager {
 | 
			
		||||
		informerFactory.Start(rcStopCh)
 | 
			
		||||
		go controllerManager.Run(goruntime.NumCPU(), rcStopCh)
 | 
			
		||||
	}
 | 
			
		||||
	return &MasterComponents{
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user