@@ -30,7 +30,6 @@ import (
30
30
"time"
31
31
32
32
"github.com/spf13/cobra"
33
-
34
33
v1 "k8s.io/api/core/v1"
35
34
"k8s.io/apimachinery/pkg/runtime/schema"
36
35
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
@@ -60,6 +59,7 @@ import (
60
59
"k8s.io/component-base/version"
61
60
"k8s.io/component-base/version/verflag"
62
61
genericcontrollermanager "k8s.io/controller-manager/app"
62
+ "k8s.io/controller-manager/pkg/clientbuilder"
63
63
"k8s.io/klog/v2"
64
64
"k8s.io/kubernetes/cmd/kube-controller-manager/app/config"
65
65
"k8s.io/kubernetes/cmd/kube-controller-manager/app/options"
@@ -209,10 +209,10 @@ func Run(c *config.CompletedConfig, stopCh <-chan struct{}) error {
209
209
}
210
210
211
211
run := func (ctx context.Context ) {
212
- rootClientBuilder := controller .SimpleControllerClientBuilder {
212
+ rootClientBuilder := clientbuilder .SimpleControllerClientBuilder {
213
213
ClientConfig : c .Kubeconfig ,
214
214
}
215
- var clientBuilder controller .ControllerClientBuilder
215
+ var clientBuilder clientbuilder .ControllerClientBuilder
216
216
if c .ComponentConfig .KubeCloudShared .UseServiceAccountCredentials {
217
217
if len (c .ComponentConfig .SAController .ServiceAccountKeyFile ) == 0 {
218
218
// It's possible another controller process is creating the tokens for us.
@@ -229,7 +229,7 @@ func Run(c *config.CompletedConfig, stopCh <-chan struct{}) error {
229
229
"kube-system" )
230
230
} else {
231
231
klog .V (1 ).Infof ("using legacy client builder" )
232
- clientBuilder = controller .SAControllerClientBuilder {
232
+ clientBuilder = clientbuilder .SAControllerClientBuilder {
233
233
ClientConfig : restclient .AnonymousClientConfig (c .Kubeconfig ),
234
234
CoreClient : c .Client .CoreV1 (),
235
235
AuthenticationClient : c .Client .AuthenticationV1 (),
@@ -302,7 +302,7 @@ func Run(c *config.CompletedConfig, stopCh <-chan struct{}) error {
302
302
// ControllerContext defines the context object for controller
303
303
type ControllerContext struct {
304
304
// ClientBuilder will provide a client for this controller to use
305
- ClientBuilder controller .ControllerClientBuilder
305
+ ClientBuilder clientbuilder .ControllerClientBuilder
306
306
307
307
// InformerFactory gives access to informers for the controller.
308
308
InformerFactory informers.SharedInformerFactory
@@ -433,7 +433,7 @@ func NewControllerInitializers(loopMode ControllerLoopMode) map[string]InitFunc
433
433
// TODO: In general, any controller checking this needs to be dynamic so
434
434
// users don't have to restart their controller manager if they change the apiserver.
435
435
// Until we get there, the structure here needs to be exposed for the construction of a proper ControllerContext.
436
- func GetAvailableResources (clientBuilder controller .ControllerClientBuilder ) (map [schema.GroupVersionResource ]bool , error ) {
436
+ func GetAvailableResources (clientBuilder clientbuilder .ControllerClientBuilder ) (map [schema.GroupVersionResource ]bool , error ) {
437
437
client := clientBuilder .ClientOrDie ("controller-discovery" )
438
438
discoveryClient := client .Discovery ()
439
439
_ , resourceMap , err := discoveryClient .ServerGroupsAndResources ()
@@ -461,7 +461,7 @@ func GetAvailableResources(clientBuilder controller.ControllerClientBuilder) (ma
461
461
// CreateControllerContext creates a context struct containing references to resources needed by the
462
462
// controllers such as the cloud provider and clientBuilder. rootClientBuilder is only used for
463
463
// the shared-informers client and token controller.
464
- func CreateControllerContext (s * config.CompletedConfig , rootClientBuilder , clientBuilder controller .ControllerClientBuilder , stop <- chan struct {}) (ControllerContext , error ) {
464
+ func CreateControllerContext (s * config.CompletedConfig , rootClientBuilder , clientBuilder clientbuilder .ControllerClientBuilder , stop <- chan struct {}) (ControllerContext , error ) {
465
465
versionedClient := rootClientBuilder .ClientOrDie ("shared-informers" )
466
466
sharedInformers := informers .NewSharedInformerFactory (versionedClient , ResyncPeriod (s )())
467
467
@@ -556,7 +556,7 @@ func StartControllers(ctx ControllerContext, startSATokenController InitFunc, co
556
556
// It cannot use the "normal" client builder, so it tracks its own. It must also avoid being included in the "normal"
557
557
// init map so that it can always run first.
558
558
type serviceAccountTokenControllerStarter struct {
559
- rootClientBuilder controller .ControllerClientBuilder
559
+ rootClientBuilder clientbuilder .ControllerClientBuilder
560
560
}
561
561
562
562
func (c serviceAccountTokenControllerStarter ) startServiceAccountTokenController (ctx ControllerContext ) (http.Handler , bool , error ) {
0 commit comments