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 <andrey.smirnov@siderolabs.com>
(cherry picked from commit d983e44)
  • Loading branch information
smira committed Aug 6, 2024
1 parent 44827e4 commit 08fbf08
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -376,11 +376,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 08fbf08

Please sign in to comment.