@@ -120,6 +120,9 @@ type Controller struct {
120120 mcopLister mcoplistersv1.MachineConfigurationLister
121121 mcopListerSynced cache.InformerSynced
122122
123+ infraLister cligolistersv1.InfrastructureLister
124+ infraListerSynced cache.InformerSynced
125+
123126 queue workqueue.TypedRateLimitingInterface [string ]
124127
125128 fgHandler ctrlcommon.FeatureGatesHandler
@@ -144,6 +147,7 @@ func New(
144147 schedulerInformer cligoinformersv1.SchedulerInformer ,
145148 mcopInformer mcopinformersv1.MachineConfigurationInformer ,
146149 osImageStreamInformer mcfginformersv1alpha1.OSImageStreamInformer ,
150+ infraInformer cligoinformersv1.InfrastructureInformer ,
147151 kubeClient clientset.Interface ,
148152 mcfgClient mcfgclientset.Interface ,
149153 fgHandler ctrlcommon.FeatureGatesHandler ,
@@ -160,6 +164,7 @@ func New(
160164 schedulerInformer ,
161165 mcopInformer ,
162166 osImageStreamInformer ,
167+ infraInformer ,
163168 kubeClient ,
164169 mcfgClient ,
165170 defaultUpdateDelay ,
@@ -179,6 +184,7 @@ func NewWithCustomUpdateDelay(
179184 schedulerInformer cligoinformersv1.SchedulerInformer ,
180185 mcopInformer mcopinformersv1.MachineConfigurationInformer ,
181186 osImageStreamInformer mcfginformersv1alpha1.OSImageStreamInformer ,
187+ infraInformer cligoinformersv1.InfrastructureInformer ,
182188 kubeClient clientset.Interface ,
183189 mcfgClient mcfgclientset.Interface ,
184190 updateDelay time.Duration ,
@@ -196,6 +202,7 @@ func NewWithCustomUpdateDelay(
196202 schedulerInformer ,
197203 mcopInformer ,
198204 osImageStreamInformer ,
205+ infraInformer ,
199206 kubeClient ,
200207 mcfgClient ,
201208 updateDelay ,
@@ -216,6 +223,7 @@ func newController(
216223 schedulerInformer cligoinformersv1.SchedulerInformer ,
217224 mcopInformer mcopinformersv1.MachineConfigurationInformer ,
218225 osImageStreamInformer mcfginformersv1alpha1.OSImageStreamInformer ,
226+ infraInformer cligoinformersv1.InfrastructureInformer ,
219227 kubeClient clientset.Interface ,
220228 mcfgClient mcfgclientset.Interface ,
221229 updateDelay time.Duration ,
@@ -297,6 +305,9 @@ func newController(
297305 ctrl .mcopLister = mcopInformer .Lister ()
298306 ctrl .mcopListerSynced = mcopInformer .Informer ().HasSynced
299307
308+ ctrl .infraLister = infraInformer .Lister ()
309+ ctrl .infraListerSynced = infraInformer .Informer ().HasSynced
310+
300311 // Only initialize OSImageStream lister if feature gate is enabled
301312 if ctrl .osStreamsFgEnabled {
302313 ctrl .osImageStreamLister = osImageStreamInformer .Lister ()
@@ -314,6 +325,7 @@ func (ctrl *Controller) Run(workers int, stopCh <-chan struct{}) {
314325 syncers := []cache.InformerSynced {
315326 ctrl .ccListerSynced , ctrl .mcListerSynced , ctrl .mcpListerSynced , ctrl .moscListerSynced ,
316327 ctrl .mosbListerSynced , ctrl .nodeListerSynced , ctrl .schedulerListerSynced , ctrl .mcopListerSynced ,
328+ ctrl .infraListerSynced ,
317329 }
318330 // Only wait for the OSImageStream informer to sync if the feature is enabled
319331 if ctrl .osStreamsFgEnabled {
@@ -1951,8 +1963,8 @@ func (ctrl *Controller) deleteMachineConfiguration(_ any) {
19511963
19521964// syncBootImageSkewEnforcementMetric updates the mcc_boot_image_skew_enforcement_none metric
19531965// based on the current BootImageSkewEnforcementStatus mode in MachineConfiguration.
1954- // The metric is set to 1 when mode is "None", indicating that scaling operations may
1955- // not be successful.
1966+ // The metric is set to 1 when mode is "None" on non-SNO clusters , indicating that scaling
1967+ // operations may not be successful. On SNO clusters, None is the default and the alert is suppressed .
19561968func (ctrl * Controller ) syncBootImageSkewEnforcementMetric (obj any ) {
19571969
19581970 mcop , ok := obj .(* opv1.MachineConfiguration )
@@ -1962,6 +1974,17 @@ func (ctrl *Controller) syncBootImageSkewEnforcementMetric(obj any) {
19621974 }
19631975
19641976 if mcop .Status .BootImageSkewEnforcementStatus .Mode == opv1 .BootImageSkewEnforcementModeStatusNone {
1977+ infra , err := ctrl .infraLister .Get ("cluster" )
1978+ if err != nil {
1979+ klog .Warningf ("Failed to get infrastructure for skew enforcement metric: %v" , err )
1980+ ctrlcommon .MCCBootImageSkewEnforcementNone .Set (0 )
1981+ return
1982+ }
1983+ // On SNO clusters, None is the default; suppress the alert.
1984+ if infra .Status .ControlPlaneTopology == configv1 .SingleReplicaTopologyMode {
1985+ ctrlcommon .MCCBootImageSkewEnforcementNone .Set (0 )
1986+ return
1987+ }
19651988 ctrlcommon .MCCBootImageSkewEnforcementNone .Set (1 )
19661989 } else {
19671990 ctrlcommon .MCCBootImageSkewEnforcementNone .Set (0 )
0 commit comments