Skip to content

Commit a62ba6f

Browse files
undo changes
1 parent 151424a commit a62ba6f

File tree

2 files changed

+10
-50
lines changed

2 files changed

+10
-50
lines changed

pkg/controller/common/layered_node_state.go

Lines changed: 10 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,10 @@ func NewLayeredNodeState(n *corev1.Node) *LayeredNodeState {
3030
// determined by the pool. If in layered mode, the image annotations are also checked
3131
// checked against the OCL objects.
3232
func (l *LayeredNodeState) IsDone(mcp *mcfgv1.MachineConfigPool, layered bool, mosc *mcfgv1.MachineOSConfig, mosb *mcfgv1.MachineOSBuild) bool {
33-
// if layered {
34-
// klog.Errorf("in IsDone and layered")
35-
// return l.IsNodeDone() && l.IsDesiredMachineConfigEqualToPool(mcp) && l.IsDesiredEqualToBuild(mosc, mosb)
36-
// }
37-
// klog.Errorf("in IsDone and NOT layered")
38-
// return l.IsNodeDone() && l.IsDesiredMachineConfigEqualToPool(mcp)
39-
return l.IsNodeDone() && l.IsDesiredMachineConfigEqualToPool(mcp) && l.IsDesiredEqualToBuild(mosc, mosb)
33+
if layered {
34+
return l.IsNodeDone() && l.IsDesiredMachineConfigEqualToPool(mcp) && l.IsDesiredEqualToBuild(mosc, mosb)
35+
}
36+
return l.IsNodeDone() && l.IsDesiredMachineConfigEqualToPool(mcp)
4037
}
4138

4239
// The original behavior of getUnavailableMachines is: getUnavailableMachines
@@ -70,8 +67,7 @@ func (l *LayeredNodeState) IsUnavailableForUpdate() bool {
7067
// node's desired image annotation and compares the MachineConfig specified by the
7168
// MachineOSBuild to the one specified by the node's desired MachineConfig annotation.
7269
func (l *LayeredNodeState) IsDesiredEqualToBuild(mosc *mcfgv1.MachineOSConfig, mosb *mcfgv1.MachineOSBuild) bool {
73-
klog.Errorf("in IsDesiredEqualToBuild")
74-
return l.isDesiredImageEqualToMachineOSConfig(mosc) && l.isDesiredMachineConfigEqualToBuild(mosb)
70+
return (mosc != nil && l.isDesiredImageEqualToMachineOSConfig(mosc)) && (mosb != nil && l.isDesiredMachineConfigEqualToBuild(mosb))
7571
}
7672

7773
// Compares the desired image annotation on the node against the CurrentImagePullSpec
@@ -84,14 +80,7 @@ func (l *LayeredNodeState) isDesiredImageEqualToMachineOSConfig(mosc *mcfgv1.Mac
8480
// Compares the MachineConfig specified by the MachineConfigPool to the MachineConfig
8581
// specified by the node's desired MachineConfig annotation.
8682
func (l *LayeredNodeState) isDesiredMachineConfigEqualToBuild(mosb *mcfgv1.MachineOSBuild) bool {
87-
mosbName := ""
88-
// Handle case when MOSB is nil (image mode is being disabled)
89-
if mosb != nil {
90-
// TODO: check if this comes back as nil or empty string
91-
mosbName = mosb.Spec.MachineConfig.Name
92-
}
93-
94-
return l.node.Annotations[daemonconsts.DesiredMachineConfigAnnotationKey] == mosbName
83+
return l.node.Annotations[daemonconsts.DesiredMachineConfigAnnotationKey] == mosb.Spec.MachineConfig.Name
9584

9685
}
9786

@@ -104,9 +93,7 @@ func (l *LayeredNodeState) IsCurrentMachineConfigEqualToPool(mcp *mcfgv1.Machine
10493
// Compares the MachineConfig specified by the MachineConfigPool to the one
10594
// specified by the node's desired MachineConfig annotation.
10695
func (l *LayeredNodeState) IsDesiredMachineConfigEqualToPool(mcp *mcfgv1.MachineConfigPool) bool {
107-
ret := l.node.Annotations[daemonconsts.DesiredMachineConfigAnnotationKey] == mcp.Spec.Configuration.Name
108-
klog.Errorf("in IsDesiredMachineConfigEqualToPool, returning %v", ret)
109-
return ret
96+
return l.node.Annotations[daemonconsts.DesiredMachineConfigAnnotationKey] == mcp.Spec.Configuration.Name
11097
}
11198

11299
// Checks if both the current and desired image annotation are present on the node.
@@ -127,42 +114,23 @@ func (l *LayeredNodeState) IsCurrentImageAnnotationPresentOnNode() bool {
127114
// Compares the CurrentImagePullSpec specified by the MachineOSConfig object against the
128115
// image specified by the annotation passed in.
129116
func (l *LayeredNodeState) isImageAnnotationEqualToMachineOSConfig(anno string, mosc *mcfgv1.MachineOSConfig) bool {
130-
moscImage := ""
131-
132-
// // Handle case when MOSC is nil (image mode is being disabled)
133-
// if mosc != nil {
134-
// // TOOD: check if this comes back as nil or empty string
135-
// return moscName =
136-
// }
117+
moscs := NewMachineOSConfigState(mosc)
137118

138-
// Get the image annotation from the node
139119
val, ok := l.node.Annotations[anno]
140-
klog.Errorf("in isImageAnnotationEqualToMachineOSConfig, val: %v, ok: %v", val, ok)
141-
142-
// // Handle case when MOSC is nil (image mode is being disabled)
143-
// if mosc == nil {
144-
// // TOOD: check if this comes back as nil or empty string
145-
// return val == ""
146-
// }
147120

148121
// If a layered node does not have an image annotation and has a valid MOSC, then the image is being built
149122
if val == "" || !ok {
150-
klog.Errorf("in isImageAnnotationEqualToMachineOSConfig returning false cause val == '' or !ok")
151123
return false
152124
}
153125

154-
// Get the MachineOSConfigState
155-
moscs := NewMachineOSConfigState(mosc)
156-
klog.Errorf("in isImageAnnotationEqualToMachineOSConfig with moscs")
157-
158126
if moscs.HasOSImage() {
159127
// If the MOSC image has an image, the image annotation on the node can be directly compared.
160-
moscImage = moscs.GetOSImage()
128+
return moscs.GetOSImage() == val
161129
}
162130

163131
// If the MOSC does not have an image, but the node has an older image annotation, the image is still likely
164132
// being built.
165-
return moscImage == val
133+
return false
166134
}
167135

168136
// Sets the desired MachineConfig annotations from the MachineConfigPool.
@@ -208,26 +176,21 @@ func (l *LayeredNodeState) Node() *corev1.Node {
208176
// isNodeDone returns true if the current == desired and the MCD has marked done.
209177
func (l *LayeredNodeState) IsNodeDone() bool {
210178
if l.node.Annotations == nil {
211-
klog.Error("in IsNodeDone, returning false, 1")
212179
return false
213180
}
214181

215182
if !l.isNodeConfigDone() {
216-
klog.Error("in IsNodeDone, returning false, 2")
217183
return false
218184
}
219185

220186
if !l.isNodeImageDone() {
221-
klog.Error("in IsNodeDone, returning false, 3")
222187
return false
223188
}
224189

225190
if !l.isNodeMCDState(daemonconsts.MachineConfigDaemonStateDone) {
226-
klog.Error("in IsNodeDone, returning false, 4")
227191
return false
228192
}
229193

230-
klog.Error("in IsNodeDone, returning true")
231194
return true
232195
}
233196

pkg/controller/node/status.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ func (ctrl *Controller) calculateStatus(mcs []*mcfgv1.MachineConfigNode, cconfig
206206

207207
// this is # 1 priority, get the upgrade states actually reporting
208208
if degradedMachineCount+readyMachineCount+unavailableMachineCount+updatingMachineCount != int32(len(nodes)) {
209-
klog.Errorf("In degraded + ready + unavailable + updating != nodes...")
210209

211210
updatedMachines = getUpdatedMachines(pool, nodes, mosc, mosb, isLayeredPool)
212211
updatedMachineCount = int32(len(updatedMachines))
@@ -219,8 +218,6 @@ func (ctrl *Controller) calculateStatus(mcs []*mcfgv1.MachineConfigNode, cconfig
219218

220219
degradedMachines = getDegradedMachines(nodes)
221220
degradedMachineCount = int32(len(degradedMachines))
222-
} else {
223-
klog.Errorf("In degraded + ready + unavailable + updating == nodes... Not where we want to be.")
224221
}
225222

226223
for _, n := range degradedMachines {

0 commit comments

Comments
 (0)