mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Merge pull request #66299 from mikedanese/cleanup1
Automatic merge from submit-queue. 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>. pkg/controller: remove old clientbuilder methods everything has moved to client-go now so these are the same as the original Client* methods. The only functional change is the collapse of the "horizontal-pod-autoscaler" from one client to two. This should have no effect because the GoClient was used only for discovery. ```release-note NONE ```
This commit is contained in:
		@@ -67,13 +67,12 @@ func startHPAControllerWithLegacyClient(ctx ControllerContext) (bool, error) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func startHPAControllerWithMetricsClient(ctx ControllerContext, metricsClient metrics.MetricsClient) (bool, error) {
 | 
			
		||||
	hpaClientGoClient := ctx.ClientBuilder.ClientGoClientOrDie("horizontal-pod-autoscaler")
 | 
			
		||||
	hpaClient := ctx.ClientBuilder.ClientOrDie("horizontal-pod-autoscaler")
 | 
			
		||||
	hpaClientConfig := ctx.ClientBuilder.ConfigOrDie("horizontal-pod-autoscaler")
 | 
			
		||||
 | 
			
		||||
	// we don't use cached discovery because DiscoveryScaleKindResolver does its own caching,
 | 
			
		||||
	// so we want to re-fetch every time when we actually ask for it
 | 
			
		||||
	scaleKindResolver := scale.NewDiscoveryScaleKindResolver(hpaClientGoClient.Discovery())
 | 
			
		||||
	scaleKindResolver := scale.NewDiscoveryScaleKindResolver(hpaClient.Discovery())
 | 
			
		||||
	scaleClient, err := scale.NewForConfig(hpaClientConfig, ctx.RESTMapper, dynamic.LegacyAPIPathResolverFunc, scaleKindResolver)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return false, err
 | 
			
		||||
@@ -85,7 +84,7 @@ func startHPAControllerWithMetricsClient(ctx ControllerContext, metricsClient me
 | 
			
		||||
		ctx.ComponentConfig.HPAController.HorizontalPodAutoscalerTolerance,
 | 
			
		||||
	)
 | 
			
		||||
	go podautoscaler.NewHorizontalController(
 | 
			
		||||
		hpaClientGoClient.CoreV1(),
 | 
			
		||||
		hpaClient.CoreV1(),
 | 
			
		||||
		scaleClient,
 | 
			
		||||
		hpaClient.AutoscalingV1(),
 | 
			
		||||
		ctx.RESTMapper,
 | 
			
		||||
 
 | 
			
		||||
@@ -24,7 +24,7 @@ import (
 | 
			
		||||
 | 
			
		||||
func startBootstrapSignerController(ctx ControllerContext) (bool, error) {
 | 
			
		||||
	bsc, err := bootstrap.NewBootstrapSigner(
 | 
			
		||||
		ctx.ClientBuilder.ClientGoClientOrDie("bootstrap-signer"),
 | 
			
		||||
		ctx.ClientBuilder.ClientOrDie("bootstrap-signer"),
 | 
			
		||||
		ctx.InformerFactory.Core().V1().Secrets(),
 | 
			
		||||
		ctx.InformerFactory.Core().V1().ConfigMaps(),
 | 
			
		||||
		bootstrap.DefaultBootstrapSignerOptions(),
 | 
			
		||||
@@ -38,7 +38,7 @@ func startBootstrapSignerController(ctx ControllerContext) (bool, error) {
 | 
			
		||||
 | 
			
		||||
func startTokenCleanerController(ctx ControllerContext) (bool, error) {
 | 
			
		||||
	tcc, err := bootstrap.NewTokenCleaner(
 | 
			
		||||
		ctx.ClientBuilder.ClientGoClientOrDie("token-cleaner"),
 | 
			
		||||
		ctx.ClientBuilder.ClientOrDie("token-cleaner"),
 | 
			
		||||
		ctx.InformerFactory.Core().V1().Secrets(),
 | 
			
		||||
		bootstrap.DefaultTokenCleanerOptions(),
 | 
			
		||||
	)
 | 
			
		||||
 
 | 
			
		||||
@@ -46,8 +46,6 @@ type ControllerClientBuilder interface {
 | 
			
		||||
	ConfigOrDie(name string) *restclient.Config
 | 
			
		||||
	Client(name string) (clientset.Interface, error)
 | 
			
		||||
	ClientOrDie(name string) clientset.Interface
 | 
			
		||||
	ClientGoClient(name string) (clientset.Interface, error)
 | 
			
		||||
	ClientGoClientOrDie(name string) clientset.Interface
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SimpleControllerClientBuilder returns a fixed client with different user agents
 | 
			
		||||
@@ -85,22 +83,6 @@ func (b SimpleControllerClientBuilder) ClientOrDie(name string) clientset.Interf
 | 
			
		||||
	return client
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (b SimpleControllerClientBuilder) ClientGoClient(name string) (clientset.Interface, error) {
 | 
			
		||||
	clientConfig, err := b.Config(name)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	return clientset.NewForConfig(clientConfig)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (b SimpleControllerClientBuilder) ClientGoClientOrDie(name string) clientset.Interface {
 | 
			
		||||
	client, err := b.ClientGoClient(name)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		glog.Fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
	return client
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SAControllerClientBuilder is a ControllerClientBuilder that returns clients identifying as
 | 
			
		||||
// service accounts
 | 
			
		||||
type SAControllerClientBuilder struct {
 | 
			
		||||
@@ -274,19 +256,3 @@ func (b SAControllerClientBuilder) ClientOrDie(name string) clientset.Interface
 | 
			
		||||
	}
 | 
			
		||||
	return client
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (b SAControllerClientBuilder) ClientGoClient(name string) (clientset.Interface, error) {
 | 
			
		||||
	clientConfig, err := b.Config(name)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	return clientset.NewForConfig(clientConfig)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (b SAControllerClientBuilder) ClientGoClientOrDie(name string) clientset.Interface {
 | 
			
		||||
	client, err := b.ClientGoClient(name)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		glog.Fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
	return client
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user