@@ -31,6 +31,8 @@ import (
31
31
clientset "github.com/openshift/client-go/config/clientset/versioned"
32
32
configinformersv1 "github.com/openshift/client-go/config/informers/externalversions/config/v1"
33
33
configlistersv1 "github.com/openshift/client-go/config/listers/config/v1"
34
+ operatorclientset "github.com/openshift/client-go/operator/clientset/versioned"
35
+ operatorexternalversions "github.com/openshift/client-go/operator/informers/externalversions"
34
36
"github.com/openshift/library-go/pkg/manifest"
35
37
"github.com/openshift/library-go/pkg/verify"
36
38
"github.com/openshift/library-go/pkg/verify/store"
@@ -43,6 +45,7 @@ import (
43
45
"github.com/openshift/cluster-version-operator/pkg/clusterconditions"
44
46
"github.com/openshift/cluster-version-operator/pkg/clusterconditions/standard"
45
47
"github.com/openshift/cluster-version-operator/pkg/customsignaturestore"
48
+ "github.com/openshift/cluster-version-operator/pkg/cvo/configuration"
46
49
cvointernal "github.com/openshift/cluster-version-operator/pkg/cvo/internal"
47
50
"github.com/openshift/cluster-version-operator/pkg/cvo/internal/dynamicclient"
48
51
"github.com/openshift/cluster-version-operator/pkg/featuregates"
@@ -93,9 +96,10 @@ type Operator struct {
93
96
// releaseCreated, if set, is the timestamp of the current update.
94
97
releaseCreated time.Time
95
98
96
- client clientset.Interface
97
- kubeClient kubernetes.Interface
98
- eventRecorder record.EventRecorder
99
+ client clientset.Interface
100
+ kubeClient kubernetes.Interface
101
+ operatorClient operatorclientset.Interface
102
+ eventRecorder record.EventRecorder
99
103
100
104
// minimumUpdateCheckInterval is the minimum duration to check for updates from
101
105
// the update service.
@@ -176,6 +180,9 @@ type Operator struct {
176
180
// alwaysEnableCapabilities is a list of the cluster capabilities which should
177
181
// always be implicitly enabled.
178
182
alwaysEnableCapabilities []configv1.ClusterVersionCapability
183
+
184
+ // configuration, if enabled, reconciles the ClusterVersionOperator configuration.
185
+ configuration * configuration.ClusterVersionOperatorConfiguration
179
186
}
180
187
181
188
// New returns a new cluster version operator.
@@ -190,8 +197,10 @@ func New(
190
197
cmConfigInformer informerscorev1.ConfigMapInformer ,
191
198
cmConfigManagedInformer informerscorev1.ConfigMapInformer ,
192
199
proxyInformer configinformersv1.ProxyInformer ,
200
+ operatorInformerFactory operatorexternalversions.SharedInformerFactory ,
193
201
client clientset.Interface ,
194
202
kubeClient kubernetes.Interface ,
203
+ operatorClient operatorclientset.Interface ,
195
204
exclude string ,
196
205
clusterProfile string ,
197
206
promqlTarget clusterconditions.PromQLTarget ,
@@ -219,6 +228,7 @@ func New(
219
228
220
229
client : client ,
221
230
kubeClient : kubeClient ,
231
+ operatorClient : operatorClient ,
222
232
eventRecorder : eventBroadcaster .NewRecorder (scheme .Scheme , corev1.EventSource {Component : namespace }),
223
233
queue : workqueue .NewTypedRateLimitingQueueWithConfig [any ](workqueue .DefaultTypedControllerRateLimiter [any ](), workqueue.TypedRateLimitingQueueConfig [any ]{Name : "clusterversion" }),
224
234
availableUpdatesQueue : workqueue .NewTypedRateLimitingQueueWithConfig [any ](workqueue .DefaultTypedControllerRateLimiter [any ](), workqueue.TypedRateLimitingQueueConfig [any ]{Name : "availableupdates" }),
@@ -262,6 +272,8 @@ func New(
262
272
// make sure this is initialized after all the listers are initialized
263
273
optr .upgradeableChecks = optr .defaultUpgradeableChecks ()
264
274
275
+ optr .configuration = configuration .NewClusterVersionOperatorConfiguration (operatorClient , operatorInformerFactory )
276
+
265
277
return optr , nil
266
278
}
267
279
@@ -408,6 +420,7 @@ func (optr *Operator) Run(runContext context.Context, shutdownContext context.Co
408
420
defer optr .queue .ShutDown ()
409
421
defer optr .availableUpdatesQueue .ShutDown ()
410
422
defer optr .upgradeableQueue .ShutDown ()
423
+ defer optr .configuration .Queue ().ShutDown ()
411
424
stopCh := runContext .Done ()
412
425
413
426
klog .Infof ("Starting ClusterVersionOperator with minimum reconcile period %s" , optr .minimumUpdateCheckInterval )
@@ -446,6 +459,23 @@ func (optr *Operator) Run(runContext context.Context, shutdownContext context.Co
446
459
resultChannel <- asyncResult {name : "available updates" }
447
460
}()
448
461
462
+ if optr .enabledFeatureGates .CVOConfiguration () {
463
+ resultChannelCount ++
464
+ go func () {
465
+ defer utilruntime .HandleCrash ()
466
+ if err := optr .configuration .Start (runContext ); err != nil {
467
+ utilruntime .HandleError (fmt .Errorf ("unable to initialize the CVO configuration sync: %v" , err ))
468
+ } else {
469
+ wait .UntilWithContext (runContext , func (runContext context.Context ) {
470
+ optr .worker (runContext , optr .configuration .Queue (), optr .configuration .Sync )
471
+ }, time .Second )
472
+ }
473
+ resultChannel <- asyncResult {name : "cvo configuration" }
474
+ }()
475
+ } else {
476
+ klog .Infof ("The ClusterVersionOperatorConfiguration feature gate is disabled; skipping initialization of configuration sync routine" )
477
+ }
478
+
449
479
resultChannelCount ++
450
480
go func () {
451
481
defer utilruntime .HandleCrash ()
@@ -515,6 +545,7 @@ func (optr *Operator) Run(runContext context.Context, shutdownContext context.Co
515
545
optr .queue .ShutDown ()
516
546
optr .availableUpdatesQueue .ShutDown ()
517
547
optr .upgradeableQueue .ShutDown ()
548
+ optr .configuration .Queue ().ShutDown ()
518
549
}
519
550
}
520
551
0 commit comments