errors

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package errors makes a set of error message handlers available for use by cloud miner.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MinerError

type MinerError struct {
	Reason  MinerStatusError
	Message string
}

MinerError is a more descriptive kind of error that represents an error condition that should be set in the Miner.Status. The "Reason" field is meant for short, enum-style constants meant to be interpreted by miners. The "Message" field is meant to be read by humans.

func CreateMiner

func CreateMiner(msg string, args ...any) *MinerError

CreateMiner creates a new error for when creating a Miner.

func DeleteMiner

func DeleteMiner(msg string, args ...any) *MinerError

DeleteMiner creates a new error for when deleting a Miner.

func InvalidMinerConfiguration

func InvalidMinerConfiguration(msg string, args ...any) *MinerError

InvalidMinerConfiguration creates a new error when a Miner has invalid configuration.

func UpdateMiner

func UpdateMiner(msg string, args ...any) *MinerError

UpdateMiner creates a new error for when updating a Miner.

func (*MinerError) Error

func (e *MinerError) Error() string

type MinerSetStatusError

type MinerSetStatusError string

MinerSetStatusError defines errors states for MinerSet objects.

const (
	// InvalidConfigurationMinerSetError represents
	// the combination of configuration in the MinerTemplateSpec
	// is not supported by this cluster. This is not a transient error, but
	// indicates a state that must be fixed before progress can be made.
	//
	// Example: the ProviderSpec specifies an instance type that doesn't exist.
	InvalidConfigurationMinerSetError MinerSetStatusError = "InvalidConfiguration"
)

func MinerSetStatusErrorPtr

func MinerSetStatusErrorPtr(v MinerSetStatusError) *MinerSetStatusError

MinerSetStatusErrorPtr converts a MinerSetStatusError to a pointer.

type MinerStatusError

type MinerStatusError string

MinerStatusError defines errors states for Miner objects.

const (
	// InvalidConfigurationMinerError represents that the combination
	// of configuration in the MinerSpec is not supported by this cluster.
	// This is not a transient error, but
	// indicates a state that must be fixed before progress can be made.
	//
	// Example: the ProviderSpec specifies an instance type that doesn't exist,.
	InvalidConfigurationMinerError MinerStatusError = "InvalidConfiguration"

	// UnsupportedChangeMinerError indicates that the MinerSpec 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
	// does not support changing the real world state to match the new
	// spec.
	//
	// Example: the responsible controller is not capable of changing the
	// container runtime from docker to rkt.
	UnsupportedChangeMinerError MinerStatusError = "UnsupportedChange"

	// InsufficientResourcesMinerError generally refers to exceeding one's quota in a cloud provider,
	// or running out of physical miners in an on-premise environment.
	InsufficientResourcesMinerError MinerStatusError = "InsufficientResources"

	// CreateMinerError indicates an error while trying to create a Node to match this
	// Miner. This may indicate a transient problem that will be fixed
	// automatically with time, such as a service outage, or a terminal
	// error during creation that doesn't match a more specific
	// MinerStatusError value.
	//
	// Example: timeout trying to connect to GCE.
	CreateMinerError MinerStatusError = "CreateError"

	// UpdateMinerError indicates an error while trying to update a Node that this
	// Miner represents. This may indicate a transient problem that will be
	// fixed automatically with time, such as a service outage,
	//
	// Example: error updating load balancers.
	UpdateMinerError MinerStatusError = "UpdateError"

	// DeleteMinerError indicates an error was encountered while trying to delete the Node that this
	// Miner represents. This could be a transient or terminal error, but
	// will only be observable if the provider's Miner controller has
	// added a finalizer to the object to more gracefully handle deletions.
	//
	// Example: cannot resolve EC2 IP address.
	DeleteMinerError MinerStatusError = "DeleteError"

	// JoinClusterTimeoutMinerError indicates that the miner did not join the cluster
	// as a new node within the expected timeframe after instance
	// creation at the provider succeeded
	//
	// Example use case: A controller that deletes Miners which do
	// not result in a Node joining the cluster within a given timeout
	// and that are managed by a MinerSet.
	JoinClusterTimeoutMinerError = "JoinClusterTimeoutError"
)

func MinerStatusErrorPtr

func MinerStatusErrorPtr(v MinerStatusError) *MinerStatusError

MinerStatusErrorPtr converts a MinerStatusError to a pointer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL