diff --git a/pkg/controller/servingcert/starter/starter.go b/pkg/controller/servingcert/starter/starter.go index f83e9b22f..529ada43e 100644 --- a/pkg/controller/servingcert/starter/starter.go +++ b/pkg/controller/servingcert/starter/starter.go @@ -53,6 +53,7 @@ func StartServiceServingCertSigner(ctx context.Context, controllerContext *contr configInformers := configexternalinformers.NewSharedInformerFactory(configClient, 10*time.Minute) + stopChan := ctx.Done() klog.Infof("ShortCertRotation: fetching FeatureGates") desiredVersion := status.VersionForOperatorFromEnv() missingVersion := "0.0.1-snapshot" @@ -61,6 +62,9 @@ func StartServiceServingCertSigner(ctx context.Context, controllerContext *contr configInformers.Config().V1().ClusterVersions(), configInformers.Config().V1().FeatureGates(), controllerContext.EventRecorder, ) + configInformers.Start(stopChan) + go featureGateAccessor.Run(ctx) + var featureGates featuregates.FeatureGate select { case <-featureGateAccessor.InitialFeatureGatesObserved(): @@ -104,7 +108,6 @@ func StartServiceServingCertSigner(ctx context.Context, controllerContext *contr certificateLifetime, ) - stopChan := ctx.Done() kubeInformers.Start(stopChan) go servingCertController.Run(ctx, 5) diff --git a/pkg/operator/starter.go b/pkg/operator/starter.go index 2508169b0..07b78d99a 100644 --- a/pkg/operator/starter.go +++ b/pkg/operator/starter.go @@ -105,6 +105,7 @@ func RunOperator(ctx context.Context, controllerContext *controllercmd.Controlle controllerContext.EventRecorder, ) + stopChan := ctx.Done() klog.Infof("ShortCertRotation: fetching FeatureGates") desiredVersion := status.VersionForOperatorFromEnv() missingVersion := "0.0.1-snapshot" @@ -113,6 +114,9 @@ func RunOperator(ctx context.Context, controllerContext *controllercmd.Controlle configInformers.Config().V1().ClusterVersions(), configInformers.Config().V1().FeatureGates(), controllerContext.EventRecorder, ) + configInformers.Start(stopChan) + go featureGateAccessor.Run(ctx) + var featureGates featuregates.FeatureGate select { case <-featureGateAccessor.InitialFeatureGatesObserved(): @@ -144,11 +148,8 @@ func RunOperator(ctx context.Context, controllerContext *controllercmd.Controlle signingCertificateLifetime, ) - stopChan := ctx.Done() - for _, informerStarter := range []func(<-chan struct{}){ operatorConfigInformers.Start, - configInformers.Start, kubeInformersNamespaced.Start, kubeInformersForNamespaces.Start, } { @@ -163,7 +164,6 @@ func RunOperator(ctx context.Context, controllerContext *controllercmd.Controlle } { go controllerRunner(ctx, 1) } - <-stopChan return nil }