88 "path"
99 "time"
1010
11- features "github.com/openshift/api/features"
12- mcfginformersv1 "github.com/openshift/client-go/machineconfiguration/informers/externalversions/machineconfiguration/v1"
1311 "github.com/openshift/machine-config-operator/cmd/common"
1412 "github.com/openshift/machine-config-operator/internal/clients"
1513 bootimagecontroller "github.com/openshift/machine-config-operator/pkg/controller/bootimage"
@@ -29,7 +27,6 @@ import (
2927 "github.com/openshift/machine-config-operator/pkg/version"
3028 "github.com/spf13/cobra"
3129 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
32- coreinformersv1 "k8s.io/client-go/informers/core/v1"
3330 "k8s.io/client-go/tools/leaderelection"
3431 "k8s.io/klog/v2"
3532)
@@ -214,25 +211,23 @@ func runStartCmd(_ *cobra.Command, _ []string) {
214211
215212 close (ctrlctx .InformersStarted )
216213
217- if ctrlctx .FeatureGatesHandler .Enabled (features .FeatureGateNoRegistryClusterInstall ) {
218- iriController := internalreleaseimage .New (
219- ctrlctx .InformerFactory .Machineconfiguration ().V1 ().InternalReleaseImages (),
220- ctrlctx .InformerFactory .Machineconfiguration ().V1 ().ControllerConfigs (),
221- ctrlctx .InformerFactory .Machineconfiguration ().V1 ().MachineConfigs (),
222- ctrlctx .ConfigInformerFactory .Config ().V1 ().ClusterVersions (),
223- ctrlctx .KubeInformerFactory .Core ().V1 ().Secrets (),
224- ctrlctx .InformerFactory .Machineconfiguration ().V1 ().MachineConfigNodes (),
225- ctrlctx .KubeInformerFactory .Core ().V1 ().Nodes (),
226- ctrlctx .ConfigInformerFactory .Config ().V1 ().Infrastructures (),
227- ctrlctx .ClientBuilder .KubeClientOrDie ("internalreleaseimage-controller" ),
228- ctrlctx .ClientBuilder .MachineConfigClientOrDie ("internalreleaseimage-controller" ))
214+ iriController := internalreleaseimage .New (
215+ ctrlctx .InformerFactory .Machineconfiguration ().V1 ().InternalReleaseImages (),
216+ ctrlctx .InformerFactory .Machineconfiguration ().V1 ().ControllerConfigs (),
217+ ctrlctx .InformerFactory .Machineconfiguration ().V1 ().MachineConfigs (),
218+ ctrlctx .ConfigInformerFactory .Config ().V1 ().ClusterVersions (),
219+ ctrlctx .KubeInformerFactory .Core ().V1 ().Secrets (),
220+ ctrlctx .InformerFactory .Machineconfiguration ().V1 ().MachineConfigNodes (),
221+ ctrlctx .KubeInformerFactory .Core ().V1 ().Nodes (),
222+ ctrlctx .ConfigInformerFactory .Config ().V1 ().Infrastructures (),
223+ ctrlctx .ClientBuilder .KubeClientOrDie ("internalreleaseimage-controller" ),
224+ ctrlctx .ClientBuilder .MachineConfigClientOrDie ("internalreleaseimage-controller" ))
229225
230- go iriController .Run (ctx , 2 )
231- // start the informers again to enable feature gated types.
232- // see comments in SharedInformerFactory interface.
233- ctrlctx .InformerFactory .Start (ctx .Done ())
234- ctrlctx .KubeInformerFactory .Start (ctx .Done ())
235- }
226+ go iriController .Run (ctx , 2 )
227+ // start the informers again to pick up newly registered types.
228+ // see comments in SharedInformerFactory interface.
229+ ctrlctx .InformerFactory .Start (ctx .Done ())
230+ ctrlctx .KubeInformerFactory .Start (ctx .Done ())
236231
237232 if ctrlcommon .IsBootImageControllerRequired (ctrlctx ) {
238233 bootImageController := bootimagecontroller .New (
@@ -290,17 +285,6 @@ func runStartCmd(_ *cobra.Command, _ []string) {
290285}
291286
292287func createControllers (ctx * ctrlcommon.ControllerContext , inspectionCache * imageutils.FileInspectionCache , inspectorFactory osimagestream.ImagesInspectorFactory ) []ctrlcommon.Controller {
293- // Only watch IRI informers when the feature gate is enabled. The
294- // InternalReleaseImages CRD is not installed on clusters where the gate is
295- // off, so the informer list call would fail and WaitForCacheSync in the
296- // template controller would block forever.
297- var iriSecretsInformer coreinformersv1.SecretInformer
298- var iriInformer mcfginformersv1.InternalReleaseImageInformer
299- if ctx .FeatureGatesHandler .Enabled (features .FeatureGateNoRegistryClusterInstall ) {
300- iriSecretsInformer = ctx .KubeInformerFactory .Core ().V1 ().Secrets ()
301- iriInformer = ctx .InformerFactory .Machineconfiguration ().V1 ().InternalReleaseImages ()
302- }
303-
304288 renderCtrl := render .New (
305289 ctx .InformerFactory .Machineconfiguration ().V1 ().MachineConfigPools (),
306290 ctx .InformerFactory .Machineconfiguration ().V1 ().MachineConfigs (),
@@ -331,8 +315,8 @@ func createControllers(ctx *ctrlcommon.ControllerContext, inspectionCache *image
331315 rootOpts .templates ,
332316 ctx .InformerFactory .Machineconfiguration ().V1 ().ControllerConfigs (),
333317 ctx .OpenShiftConfigKubeNamespacedInformerFactory .Core ().V1 ().Secrets (),
334- iriSecretsInformer ,
335- iriInformer ,
318+ ctx . KubeInformerFactory . Core (). V1 (). Secrets () ,
319+ ctx . InformerFactory . Machineconfiguration (). V1 (). InternalReleaseImages () ,
336320 ctx .ConfigInformerFactory .Config ().V1 ().APIServers (),
337321 ctx .ClientBuilder .KubeClientOrDie ("template-controller" ),
338322 ctx .ClientBuilder .MachineConfigClientOrDie ("template-controller" ),
0 commit comments