Skip to content

Commit 160acf5

Browse files
update desired image removal on ocl disable
1 parent 7d0a0dd commit 160acf5

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
@@ -143,7 +143,6 @@ func (l *LayeredNodeState) SetDesiredStateFromPool(mcp *mcfgv1.MachineConfigPool
143143
node := l.Node()
144144

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

149148
l.node = node
@@ -323,16 +322,6 @@ func (l *LayeredNodeState) CheckNodeCandidacyForUpdate(layered bool, pool *mcfgv
323322
return true
324323
}
325324

326-
// Returns the desired config version annotation present on the node.
327-
func (l *LayeredNodeState) GetDesiredConfigAnnotation() string {
328-
return l.node.Annotations[daemonconsts.DesiredMachineConfigAnnotationKey]
329-
}
330-
331-
// Returns the desired image annotation present on the node.
332-
func (l *LayeredNodeState) GetDesiredImageAnnotation() string {
333-
return l.node.Annotations[daemonconsts.DesiredImageAnnotationKey]
334-
}
335-
336325
// GetDesiredAnnotationsFromMachineOSConfig gets the desired config version and desired image values from the associated MOSC and MOSB
337326
func (l *LayeredNodeState) GetDesiredAnnotationsFromMachineConfigPool(mcp *mcfgv1.MachineConfigPool) (desriedConfig string) {
338327
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)