Merge pull request #125650 from mjudeikis/mjudeikis/generic-controlplane
Generic Control Plane: Add Extra.DisableAvailableConditionController for kube-aggregator
This commit is contained in:
		@@ -95,6 +95,13 @@ type ExtraConfig struct {
 | 
				
			|||||||
	ServiceResolver ServiceResolver
 | 
						ServiceResolver ServiceResolver
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	RejectForwardingRedirects bool
 | 
						RejectForwardingRedirects bool
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// DisableAvailableConditionController disables the controller that updates the Available conditions for
 | 
				
			||||||
 | 
						// APIServices, Endpoints and Services. This controller runs in kube-aggregator and can interfere with
 | 
				
			||||||
 | 
						// Generic Control Plane components when certain apis are not available.
 | 
				
			||||||
 | 
						// TODO: We should find a better way to handle this. For now it will be for Generic Control Plane authors to
 | 
				
			||||||
 | 
						// disable this controller if they see issues.
 | 
				
			||||||
 | 
						DisableAvailableConditionController bool
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Config represents the configuration needed to create an APIAggregator.
 | 
					// Config represents the configuration needed to create an APIAggregator.
 | 
				
			||||||
@@ -307,24 +314,35 @@ func (c completedConfig) NewWithDelegate(delegationTarget genericapiserver.Deleg
 | 
				
			|||||||
		})
 | 
							})
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	availableController, err := statuscontrollers.NewAvailableConditionController(
 | 
						// If the AvailableConditionController is disabled, we don't need to start the informers
 | 
				
			||||||
		informerFactory.Apiregistration().V1().APIServices(),
 | 
						// and the controller.
 | 
				
			||||||
		c.GenericConfig.SharedInformerFactory.Core().V1().Services(),
 | 
						if !c.ExtraConfig.DisableAvailableConditionController {
 | 
				
			||||||
		c.GenericConfig.SharedInformerFactory.Core().V1().Endpoints(),
 | 
							availableController, err := statuscontrollers.NewAvailableConditionController(
 | 
				
			||||||
		apiregistrationClient.ApiregistrationV1(),
 | 
								informerFactory.Apiregistration().V1().APIServices(),
 | 
				
			||||||
		proxyTransportDial,
 | 
								c.GenericConfig.SharedInformerFactory.Core().V1().Services(),
 | 
				
			||||||
		(func() ([]byte, []byte))(s.proxyCurrentCertKeyContent),
 | 
								c.GenericConfig.SharedInformerFactory.Core().V1().Endpoints(),
 | 
				
			||||||
		s.serviceResolver,
 | 
								apiregistrationClient.ApiregistrationV1(),
 | 
				
			||||||
	)
 | 
								proxyTransportDial,
 | 
				
			||||||
	if err != nil {
 | 
								(func() ([]byte, []byte))(s.proxyCurrentCertKeyContent),
 | 
				
			||||||
		return nil, err
 | 
								s.serviceResolver,
 | 
				
			||||||
 | 
							)
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								return nil, err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							s.GenericAPIServer.AddPostStartHookOrDie("start-kube-aggregator-informers", func(context genericapiserver.PostStartHookContext) error {
 | 
				
			||||||
 | 
								informerFactory.Start(context.Done())
 | 
				
			||||||
 | 
								c.GenericConfig.SharedInformerFactory.Start(context.Done())
 | 
				
			||||||
 | 
								return nil
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							s.GenericAPIServer.AddPostStartHookOrDie("apiservice-status-available-controller", func(context genericapiserver.PostStartHookContext) error {
 | 
				
			||||||
 | 
								// if we end up blocking for long periods of time, we may need to increase workers.
 | 
				
			||||||
 | 
								go availableController.Run(5, context.Done())
 | 
				
			||||||
 | 
								return nil
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	s.GenericAPIServer.AddPostStartHookOrDie("start-kube-aggregator-informers", func(context genericapiserver.PostStartHookContext) error {
 | 
					 | 
				
			||||||
		informerFactory.Start(context.StopCh)
 | 
					 | 
				
			||||||
		c.GenericConfig.SharedInformerFactory.Start(context.StopCh)
 | 
					 | 
				
			||||||
		return nil
 | 
					 | 
				
			||||||
	})
 | 
					 | 
				
			||||||
	s.GenericAPIServer.AddPostStartHookOrDie("apiservice-registration-controller", func(context genericapiserver.PostStartHookContext) error {
 | 
						s.GenericAPIServer.AddPostStartHookOrDie("apiservice-registration-controller", func(context genericapiserver.PostStartHookContext) error {
 | 
				
			||||||
		go apiserviceRegistrationController.Run(context.StopCh, apiServiceRegistrationControllerInitiated)
 | 
							go apiserviceRegistrationController.Run(context.StopCh, apiServiceRegistrationControllerInitiated)
 | 
				
			||||||
		select {
 | 
							select {
 | 
				
			||||||
@@ -334,11 +352,6 @@ func (c completedConfig) NewWithDelegate(delegationTarget genericapiserver.Deleg
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		return nil
 | 
							return nil
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
	s.GenericAPIServer.AddPostStartHookOrDie("apiservice-status-available-controller", func(context genericapiserver.PostStartHookContext) error {
 | 
					 | 
				
			||||||
		// if we end up blocking for long periods of time, we may need to increase workers.
 | 
					 | 
				
			||||||
		go availableController.Run(5, context.StopCh)
 | 
					 | 
				
			||||||
		return nil
 | 
					 | 
				
			||||||
	})
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if utilfeature.DefaultFeatureGate.Enabled(genericfeatures.AggregatedDiscoveryEndpoint) {
 | 
						if utilfeature.DefaultFeatureGate.Enabled(genericfeatures.AggregatedDiscoveryEndpoint) {
 | 
				
			||||||
		s.discoveryAggregationController = NewDiscoveryManager(
 | 
							s.discoveryAggregationController = NewDiscoveryManager(
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user