From c89b66d75fcb560a90bd9b70dc4064a4c2f528de Mon Sep 17 00:00:00 2001 From: Mohamed Chiheb Ben Jemaa Date: Tue, 2 Apr 2024 14:06:37 +0200 Subject: [PATCH] Add BootstrapFailedMachineError error --- errors/consts.go | 8 ++++++++ errors/machines.go | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/errors/consts.go b/errors/consts.go index 93e920f982b4..258a2d4cc0b8 100644 --- a/errors/consts.go +++ b/errors/consts.go @@ -31,6 +31,14 @@ const ( // Example: the ProviderSpec specifies an instance type that doesn't exist,. InvalidConfigurationMachineError MachineStatusError = "InvalidConfiguration" + // BootstrapFailedMachineError indicates that the machine has been created, but + // the bootstrap process failed (e.g., Cloud init failed), + // This is not a transient error, but + // indicates a state that must be fixed before progress can be made. + // + // Example: the ControlPlaneEndpoint is wrong. + BootstrapFailedMachineError MachineStatusError = "BootstrapFailed" + // UnsupportedChangeMachineError indicates that the MachineSpec has been updated in a way that // is not supported for reconciliation on this cluster. The spec may be // completely valid from a configuration standpoint, but the controller diff --git a/errors/machines.go b/errors/machines.go index 4cb717fe080f..f7d0653a6ca0 100644 --- a/errors/machines.go +++ b/errors/machines.go @@ -45,6 +45,14 @@ func InvalidMachineConfiguration(msg string, args ...interface{}) *MachineError } } +// BootstrapFailed creates a new error when a bootstrap failed for Machine. +func BootstrapFailed(msg string, args ...interface{}) *MachineError { + return &MachineError{ + Reason: BootstrapFailedMachineError, + Message: fmt.Sprintf(msg, args...), + } +} + // CreateMachine creates a new error for when creating a Machine. func CreateMachine(msg string, args ...interface{}) *MachineError { return &MachineError{