Skip to content

Commit 8ba4f20

Browse files
upgrade monitor: only set curret generation value in pinned image set reference in MCN when the value is valid
1 parent e44d380 commit 8ba4f20

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/upgrademonitor/upgrade_monitor.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,15 @@ func generateAndApplyMachineConfigNodes(
268268
if fg.Enabled(features.FeatureGatePinnedImages) {
269269
if imageSetApplyConfig == nil {
270270
for _, imageSet := range newMCNode.Status.PinnedImageSets {
271+
// By default, a PinnedImageSet reference must include the name of the PIS and the desired generation
271272
pisApplyConfig := &machineconfigurationv1.MachineConfigNodeStatusPinnedImageSetApplyConfiguration{
272273
DesiredGeneration: ptr.To(imageSet.DesiredGeneration),
273-
CurrentGeneration: ptr.To(imageSet.CurrentGeneration),
274274
Name: ptr.To(imageSet.Name),
275275
}
276+
// Only set `CurrentGeneration` value when we are currently on a valid generation (imageSet.CurrentGeneration value is non-0)
277+
if imageSet.CurrentGeneration != 0 {
278+
pisApplyConfig.CurrentGeneration = ptr.To(imageSet.CurrentGeneration)
279+
}
276280
// Only set `LastFailedGeneration` value when it is a non-default (non-0) value
277281
if imageSet.LastFailedGeneration != 0 {
278282
pisApplyConfig.LastFailedGeneration = ptr.To(imageSet.LastFailedGeneration)

0 commit comments

Comments
 (0)