Skip to content

Commit fe479b8

Browse files
update desired image removal on ocl disable
1 parent c0b6461 commit fe479b8

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

pkg/controller/common/layered_node_state.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ func (l *LayeredNodeState) SetDesiredStateFromPool(mcp *mcfgv1.MachineConfigPool
141141
node := l.Node()
142142

143143
metav1.SetMetaDataAnnotation(&node.ObjectMeta, daemonconsts.DesiredMachineConfigAnnotationKey, mcp.Spec.Configuration.Name)
144-
// todo: check if a new desired config actually deletes an image anno
145144
delete(node.Annotations, daemonconsts.DesiredImageAnnotationKey)
146145

147146
l.node = node
@@ -321,16 +320,6 @@ func (l *LayeredNodeState) CheckNodeCandidacyForUpdate(layered bool, pool *mcfgv
321320
return true
322321
}
323322

324-
// Returns the desired config version annotation present on the node.
325-
func (l *LayeredNodeState) GetDesiredConfigAnnotation() string {
326-
return l.node.Annotations[daemonconsts.DesiredMachineConfigAnnotationKey]
327-
}
328-
329-
// Returns the desired image annotation present on the node.
330-
func (l *LayeredNodeState) GetDesiredImageAnnotation() string {
331-
return l.node.Annotations[daemonconsts.DesiredImageAnnotationKey]
332-
}
333-
334323
// GetDesiredAnnotationsFromMachineOSConfig gets the desired config version and desired image values from the associated MOSC and MOSB
335324
func (l *LayeredNodeState) GetDesiredAnnotationsFromMachineConfigPool(mcp *mcfgv1.MachineConfigPool) (desriedConfig string) {
336325
return mcp.Spec.Configuration.Name

pkg/controller/node/node_controller.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,12 +1289,13 @@ func (ctrl *Controller) updateCandidateNode(mosc *mcfgv1.MachineOSConfig, mosb *
12891289
}
12901290

12911291
lns := ctrlcommon.NewLayeredNodeState(oldNode)
1292-
desiredConfig := lns.GetDesiredConfigAnnotation()
1293-
desiredImage := lns.GetDesiredImageAnnotation()
1292+
desiredConfig := ""
1293+
desiredImage := ""
12941294
if !layered {
12951295
// TODO: see if this can be consolidated
12961296
lns.SetDesiredStateFromPool(pool)
1297-
// TODO: see what's up with the desired image annotation in this case...
1297+
// If pool is not layered, the desired image annotation is removed (see the `delete`
1298+
// call in `SetDesiredStateFromPool`), so only the desired config version must be set.
12981299
desiredConfig = lns.GetDesiredAnnotationsFromMachineConfigPool(pool)
12991300
} else {
13001301
// TODO: see if this can be consolidated

0 commit comments

Comments
 (0)