@@ -7,15 +7,11 @@ import (
7
7
8
8
"k8s.io/klog/v2"
9
9
10
- "k8s.io/apimachinery/pkg/api/meta"
11
10
"k8s.io/apimachinery/pkg/runtime/schema"
12
11
"k8s.io/apimachinery/pkg/util/sets"
13
- "k8s.io/apimachinery/pkg/util/wait"
14
- cacheddiscovery "k8s.io/client-go/discovery/cached"
15
12
"k8s.io/client-go/informers"
16
13
"k8s.io/client-go/kubernetes"
17
14
"k8s.io/client-go/rest"
18
- "k8s.io/client-go/restmapper"
19
15
"k8s.io/controller-manager/app"
20
16
"k8s.io/controller-manager/pkg/clientbuilder"
21
17
@@ -68,11 +64,6 @@ func NewControllerContext(
68
64
clientConfig .Burst = clientConfig .Burst / 10 + 1
69
65
}
70
66
71
- discoveryClient := cacheddiscovery .NewMemCacheClient (kubeClient .Discovery ())
72
- dynamicRestMapper := restmapper .NewDeferredDiscoveryRESTMapper (discoveryClient )
73
- dynamicRestMapper .Reset ()
74
- go wait .Until (dynamicRestMapper .Reset , 30 * time .Second , ctx .Done ())
75
-
76
67
appsClient , err := appsclient .NewForConfig (clientConfig )
77
68
if err != nil {
78
69
return nil , err
@@ -117,20 +108,17 @@ func NewControllerContext(
117
108
ClientBuilder : OpenshiftControllerClientBuilder {
118
109
ControllerClientBuilder : clientbuilder .NewDynamicClientBuilder (rest .AnonymousClientConfig (clientConfig ), kubeClient .CoreV1 (), defaultOpenShiftInfraNamespace ),
119
110
},
120
- KubernetesInformers : informers .NewSharedInformerFactory (kubeClient , defaultInformerResyncPeriod ),
121
- OpenshiftConfigKubernetesInformers : informers .NewSharedInformerFactoryWithOptions (kubeClient , defaultInformerResyncPeriod , informers .WithNamespace ("openshift-config" )),
122
- ControllerManagerKubeInformers : informers .NewSharedInformerFactoryWithOptions (kubeClient , defaultInformerResyncPeriod , informers .WithNamespace ("openshift-controller-manager" )),
123
- AppsInformers : appsinformer .NewSharedInformerFactory (appsClient , defaultInformerResyncPeriod ),
124
- BuildInformers : buildinformer .NewSharedInformerFactory (buildClient , defaultInformerResyncPeriod ),
125
- ConfigInformers : configinformer .NewSharedInformerFactory (configClient , defaultInformerResyncPeriod ),
126
- ImageInformers : imageinformer .NewSharedInformerFactory (imageClient , defaultInformerResyncPeriod ),
127
- OperatorInformers : operatorinformer .NewSharedInformerFactory (operatorClient , defaultInformerResyncPeriod ),
128
- QuotaInformers : quotainformer .NewSharedInformerFactory (quotaClient , defaultInformerResyncPeriod ),
129
- RouteInformers : routeinformer .NewSharedInformerFactory (routerClient , defaultInformerResyncPeriod ),
130
- SecurityInformers : securityinformer .NewSharedInformerFactory (securityClient , defaultInformerResyncPeriod ),
131
- TemplateInformers : templateinformer .NewSharedInformerFactory (templateClient , defaultInformerResyncPeriod ),
132
- InformersStarted : make (chan struct {}),
133
- RestMapper : dynamicRestMapper ,
111
+ KubernetesInformers : informers .NewSharedInformerFactory (kubeClient , defaultInformerResyncPeriod ),
112
+ AppsInformers : appsinformer .NewSharedInformerFactory (appsClient , defaultInformerResyncPeriod ),
113
+ BuildInformers : buildinformer .NewSharedInformerFactory (buildClient , defaultInformerResyncPeriod ),
114
+ ConfigInformers : configinformer .NewSharedInformerFactory (configClient , defaultInformerResyncPeriod ),
115
+ ImageInformers : imageinformer .NewSharedInformerFactory (imageClient , defaultInformerResyncPeriod ),
116
+ OperatorInformers : operatorinformer .NewSharedInformerFactory (operatorClient , defaultInformerResyncPeriod ),
117
+ QuotaInformers : quotainformer .NewSharedInformerFactory (quotaClient , defaultInformerResyncPeriod ),
118
+ RouteInformers : routeinformer .NewSharedInformerFactory (routerClient , defaultInformerResyncPeriod ),
119
+ SecurityInformers : securityinformer .NewSharedInformerFactory (securityClient , defaultInformerResyncPeriod ),
120
+ TemplateInformers : templateinformer .NewSharedInformerFactory (templateClient , defaultInformerResyncPeriod ),
121
+ InformersStarted : make (chan struct {}),
134
122
}
135
123
openshiftControllerContext .GenericResourceInformer = openshiftControllerContext .ToGenericInformer ()
136
124
@@ -172,9 +160,7 @@ type EnhancedControllerContext struct {
172
160
// ClientBuilder will provide a client for this controller to use
173
161
ClientBuilder ControllerClientBuilder
174
162
175
- KubernetesInformers informers.SharedInformerFactory
176
- OpenshiftConfigKubernetesInformers informers.SharedInformerFactory
177
- ControllerManagerKubeInformers informers.SharedInformerFactory
163
+ KubernetesInformers informers.SharedInformerFactory
178
164
179
165
TemplateInformers templateinformer.SharedInformerFactory
180
166
QuotaInformers quotainformer.SharedInformerFactory
@@ -188,7 +174,6 @@ type EnhancedControllerContext struct {
188
174
SecurityInformers securityinformer.SharedInformerFactory
189
175
190
176
GenericResourceInformer genericinformers.GenericResourceInformer
191
- RestMapper meta.RESTMapper
192
177
193
178
informersStartedLock sync.Mutex
194
179
informersStartedClosed bool
@@ -199,8 +184,6 @@ type EnhancedControllerContext struct {
199
184
200
185
func (c * EnhancedControllerContext ) StartInformers (stopCh <- chan struct {}) {
201
186
c .KubernetesInformers .Start (stopCh )
202
- c .OpenshiftConfigKubernetesInformers .Start (stopCh )
203
- c .ControllerManagerKubeInformers .Start (stopCh )
204
187
205
188
c .AppsInformers .Start (stopCh )
206
189
c .BuildInformers .Start (stopCh )
0 commit comments