From c6fb80aa806e4a30e816b059f4ef6c4b341766b4 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Tue, 10 Jan 2023 14:24:23 +0400 Subject: [PATCH] fix: report fatal sequence errors as reboots When the sequence fails hard, Talos does automatic reboot, so reflect this in the machine status properly. Signed-off-by: Andrey Smirnov (cherry picked from commit 29020cb9c788d87a0457028ce73c8d297959116e) --- .../app/machined/pkg/controllers/runtime/machine_status.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/app/machined/pkg/controllers/runtime/machine_status.go b/internal/app/machined/pkg/controllers/runtime/machine_status.go index 84b01a10ad..c8a45af680 100644 --- a/internal/app/machined/pkg/controllers/runtime/machine_status.go +++ b/internal/app/machined/pkg/controllers/runtime/machine_status.go @@ -20,6 +20,7 @@ import ( k8sadapter "github.com/siderolabs/talos/internal/app/machined/pkg/adapters/k8s" v1alpha1runtime "github.com/siderolabs/talos/internal/app/machined/pkg/runtime" + "github.com/siderolabs/talos/pkg/machinery/api/common" machineapi "github.com/siderolabs/talos/pkg/machinery/api/machine" "github.com/siderolabs/talos/pkg/machinery/config/types/v1alpha1/machine" "github.com/siderolabs/talos/pkg/machinery/resources/config" @@ -361,6 +362,10 @@ func (ctrl *MachineStatusController) watchEvents() { newStage = runtime.MachineStageRebooting } case machineapi.SequenceEvent_NOOP: + if event.Error != nil && event.Error.Code == common.Code_FATAL { + // fatal errors lead to reboot + newStage = runtime.MachineStageRebooting + } case machineapi.SequenceEvent_STOP: if event.Sequence == v1alpha1runtime.SequenceBoot.String() && event.Error == nil { newStage = runtime.MachineStageRunning