Skip to content

Commit e9c0b18

Browse files
Merge pull request #4983 from isabella-janssen/ocpbugs-54592
OCPBUGS-54592: Only populate `LastFailedGeneration` & `LastFailedGenerationError` on PIS failure
2 parents 574295e + 8262eda commit e9c0b18

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

pkg/upgrademonitor/upgrade_monitor.go

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -267,21 +267,18 @@ func generateAndApplyMachineConfigNodes(
267267
if fg.Enabled(features.FeatureGatePinnedImages) {
268268
if imageSetApplyConfig == nil {
269269
for _, imageSet := range newMCNode.Status.PinnedImageSets {
270-
if imageSet.LastFailedGeneration != 0 { // only set `LastFailedGeneration` value when it is a non-default (non-0) value
271-
statusApplyConfig = statusApplyConfig.WithPinnedImageSets(&machineconfigurationalphav1.MachineConfigNodeStatusPinnedImageSetApplyConfiguration{
272-
DesiredGeneration: ptr.To(imageSet.DesiredGeneration),
273-
CurrentGeneration: ptr.To(imageSet.CurrentGeneration),
274-
Name: ptr.To(imageSet.Name),
275-
LastFailedGeneration: ptr.To(imageSet.LastFailedGeneration),
276-
LastFailedGenerationError: ptr.To(imageSet.LastFailedGenerationError),
277-
})
278-
} else {
279-
statusApplyConfig = statusApplyConfig.WithPinnedImageSets(&machineconfigurationalphav1.MachineConfigNodeStatusPinnedImageSetApplyConfiguration{
280-
DesiredGeneration: ptr.To(imageSet.DesiredGeneration),
281-
CurrentGeneration: ptr.To(imageSet.CurrentGeneration),
282-
Name: ptr.To(imageSet.Name),
283-
})
270+
pisApplyConfig := &machineconfigurationalphav1.MachineConfigNodeStatusPinnedImageSetApplyConfiguration{
271+
DesiredGeneration: ptr.To(imageSet.DesiredGeneration),
272+
CurrentGeneration: ptr.To(imageSet.CurrentGeneration),
273+
Name: ptr.To(imageSet.Name),
284274
}
275+
// Only set `LastFailedGeneration` value when it is a non-default (non-0) value
276+
if imageSet.LastFailedGeneration != 0 {
277+
pisApplyConfig.LastFailedGeneration = ptr.To(imageSet.LastFailedGeneration)
278+
pisApplyConfig.LastFailedGenerationError = ptr.To(imageSet.LastFailedGenerationError)
279+
}
280+
281+
statusApplyConfig = statusApplyConfig.WithPinnedImageSets(pisApplyConfig)
285282
}
286283
} else if len(imageSetApplyConfig) > 0 {
287284
statusApplyConfig = statusApplyConfig.WithPinnedImageSets(imageSetApplyConfig...)

0 commit comments

Comments
 (0)