Skip to content

Commit

Permalink
fix: panic on shutdown
Browse files Browse the repository at this point in the history
Fixes #9017

Don't assume the config is there before trying to access it.

Signed-off-by: Andrey Smirnov <[email protected]>
  • Loading branch information
smira committed Jul 16, 2024
1 parent 01404ed commit d983e44
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -377,11 +377,13 @@ func (*Sequencer) Reset(r runtime.Runtime, in runtime.ResetOptions) []runtime.Ph

// Shutdown is the shutdown sequence.
func (*Sequencer) Shutdown(r runtime.Runtime, in *machineapi.ShutdownRequest) []runtime.Phase {
skipNodeRegistration := r.Config() != nil && r.Config().Machine() != nil && r.Config().Machine().Kubelet().SkipNodeRegistration()

phases := PhaseList{}.Append(
"storeShudown",
StoreShutdownEmergency,
).AppendWhen(
!in.GetForce() && !r.Config().Machine().Kubelet().SkipNodeRegistration(),
!in.GetForce() && !skipNodeRegistration,
"drain",
CordonAndDrainNode,
).Append(
Expand Down

0 comments on commit d983e44

Please sign in to comment.