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 <andrey.smirnov@talos-systems.com>
This commit is contained in:
Andrey Smirnov 2023-01-10 14:24:23 +04:00
parent 96629d5ba6
commit 29020cb9c7
No known key found for this signature in database
GPG Key ID: 7B26396447AB6DFD

View File

@ -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"
@ -363,6 +364,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