Skip to content

Commit 52f1679

Browse files
Fix machineset update status nil pointer deref
This change updates the error log to rely on the machineSetCopy, rather than the machineSet passed to be updated. This is because the machineSet may be nil if the update fails, due to the get at the end of updateMachineSetStatus.
1 parent 3872d9d commit 52f1679

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/controller/machineset/controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ func (r *ReconcileMachineSet) Reconcile(ctx context.Context, request reconcile.R
190190

191191
machineSet, err := updateMachineSetStatus(r.Client, machineSet, machineSetCopy.Status)
192192
if err != nil {
193-
klog.Errorf("%v: error updating status: %v", machineSet.Name, err)
193+
klog.Errorf("%v: error updating status: %v", machineSetCopy.Name, err)
194194
}
195195

196196
klog.Infof("%v: machine set is paused, taking no further action", machineSet.Name)
@@ -214,7 +214,7 @@ func (r *ReconcileMachineSet) Reconcile(ctx context.Context, request reconcile.R
214214
))
215215
machineSet, err := updateMachineSetStatus(r.Client, machineSet, machineSetCopy.Status)
216216
if err != nil {
217-
klog.Errorf("%v: error updating status: %v", machineSet.Name, err)
217+
klog.Errorf("%v: error updating status: %v", machineSetCopy.Name, err)
218218
}
219219
klog.Infof("%v: setting paused to false and continuing reconcile", machineSet.Name)
220220
}

0 commit comments

Comments
 (0)