diff --git a/pkg/controller/servingcert/starter/starter.go b/pkg/controller/servingcert/starter/starter.go index b1212fe6d..f83e9b22f 100644 --- a/pkg/controller/servingcert/starter/starter.go +++ b/pkg/controller/servingcert/starter/starter.go @@ -61,9 +61,14 @@ func StartServiceServingCertSigner(ctx context.Context, controllerContext *contr configInformers.Config().V1().ClusterVersions(), configInformers.Config().V1().FeatureGates(), controllerContext.EventRecorder, ) - featureGates, err := featureGateAccessor.CurrentFeatureGates() - if err != nil { - return fmt.Errorf("unable to get FeatureGates: %w", err) + var featureGates featuregates.FeatureGate + select { + case <-featureGateAccessor.InitialFeatureGatesObserved(): + featureGates, _ = featureGateAccessor.CurrentFeatureGates() + klog.Infof("FeatureGates initialized: knownFeatureGates=%v", featureGates.KnownFeatures()) + case <-time.After(1 * time.Minute): + klog.Errorf("timed out waiting for FeatureGate detection") + return fmt.Errorf("timed out waiting for FeatureGate detection") } minTimeLeftForCert := time.Hour diff --git a/pkg/operator/starter.go b/pkg/operator/starter.go index 4a961b8a0..2508169b0 100644 --- a/pkg/operator/starter.go +++ b/pkg/operator/starter.go @@ -113,9 +113,14 @@ func RunOperator(ctx context.Context, controllerContext *controllercmd.Controlle configInformers.Config().V1().ClusterVersions(), configInformers.Config().V1().FeatureGates(), controllerContext.EventRecorder, ) - featureGates, err := featureGateAccessor.CurrentFeatureGates() - if err != nil { - return fmt.Errorf("unable to get FeatureGates: %w", err) + var featureGates featuregates.FeatureGate + select { + case <-featureGateAccessor.InitialFeatureGatesObserved(): + featureGates, _ = featureGateAccessor.CurrentFeatureGates() + klog.Infof("FeatureGates initialized: knownFeatureGates=%v", featureGates.KnownFeatures()) + case <-time.After(1 * time.Minute): + klog.Errorf("timed out waiting for FeatureGate detection") + return fmt.Errorf("timed out waiting for FeatureGate detection") } minimumTrustDuration := 395 * 24 * time.Hour