Skip to content

Instantly share code, notes, and snippets.

@hexfusion
Last active April 16, 2024 13:44
Show Gist options
  • Save hexfusion/77df57751b24f4109030bdb922842405 to your computer and use it in GitHub Desktop.
Save hexfusion/77df57751b24f4109030bdb922842405 to your computer and use it in GitHub Desktop.
featureGateAccessor := featuregates.NewFeatureGateAccess(
desiredVersion, missingVersion,
configSharedInformer.Config().V1().ClusterVersions(), configSharedInformer.Config().V1().FeatureGates(),
recorder,
)
go featureGateAccessor.Run(ctx)
// dep for feature gate
ctrlctx.ConfigInformerFactory.Start(ctrlctx.Stop)
// contains featuregated api's
ctrlctx.InformerFactory.Start(stopCh)
featureGates, err := ctrlctx.FeatureGateAccess.CurrentFeatureGates()
if err != nil {
klog.Fatalf("Could not get FG: %v", err)
} else {
klog.Infof("FeatureGates initialized: knownFeatureGates=%v", featureGates.KnownFeatures())
if featureGates.Enabled(configv1.FeatureGatePinnedImages) {
ctlr := daemon.NewController(
ctrlctx.InformerFactory.Machineconfiguration().V1alpha1().PinnedImageSets(),
)
go ctrl.Run(2, stopCh) // Waits for imageSetInformer.Informer().HasSynced forever.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment