update

package
v0.0.0-...-cc11b02 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: BSD-2-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package update defines the Status type, which classifies the result of a synchronization operation by the controller. This distinguishes forms of success or failure after an Add/Update/Delete notification for the resource types that the controller watches, and determeins furher actions such as error handling, logging and event generation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Status

type Status struct {
	Msg  string
	Type StatusType
}

Status encapsulates the result of a synchronization operation, including its type and an optional detail message (an error message for the error types).

func Make

func Make(t StatusType, format string, args ...interface{}) Status

Make is a convenience function to create a Status of the given type, setting the Msg to a formatted string.

func MakeFatal

func MakeFatal(format string, args ...interface{}) Status

MakeFatal creates a Fatal Status with a formatted string for the Msg.

func MakeIncomplete

func MakeIncomplete(format string, args ...interface{}) Status

MakeIncomplete creates an Incomplete Status with a formatted string for the Msg.

func MakeNoop

func MakeNoop(format string, args ...interface{}) Status

MakeNoop creates a Noop Status with a formatted string for the Msg.

func MakeRecoverable

func MakeRecoverable(format string, args ...interface{}) Status

MakeRecoverable creates a Recoverable Status with a formatted string for the Msg.

func MakeSuccess

func MakeSuccess(format string, args ...interface{}) Status

MakeSuccess creates a Success Status with a formatted string for the Msg.

func (Status) Error

func (status Status) Error() string

func (Status) IsError

func (status Status) IsError() bool

IsError returns true iff the Status has one of the error types: Fatal, Recoverable or Incomplete.

func (Status) Reason

func (status Status) Reason() string

Reason returns a string suitable as the reason string for an event after a sync returns. Identical to Reason() for the given type.

func (Status) String

func (status Status) String() string

type StatusType

type StatusType uint8

StatusType is the classifier for the result of a synchronization.

const (
	// Noop indicates that no change in the cluster was
	// necessary. The result is logged, but no further action is
	// taken.
	Noop StatusType = iota
	// Success indicates that a change in the cluster was
	// successfully executed. The result is logged, and an event
	// is generated for the resource that was synchronized.
	Success
	// Fatal indicates an unrecoverable error, which cannot be
	// compensated by retrying the same synchronization. For
	// example, an invalid configuration is unrecoverable, if it
	// can never become valid until it is changed. This result is
	// logged, a warning event is generated, and the operation is
	// never retried.
	Fatal
	// Recoverable indicates an error that might be compensated
	// with a retry. For example, network errors in the cluster
	// such as a timeouts may be temporary, and hence may succeed
	// on retry.  This result is logged, a warning event is
	// generated, and the sync operation is re-queued with a rate
	// limiting delay (likely an exponential backoff, as scheduled
	// by the client-go workqueue).
	Recoverable
	// Incomplete indicates that a cluster change is necessary,
	// but the controller does not currently have all of the
	// information that it requires. For example, a Service
	// configuration may have been added, but the Endpoints are
	// not yet known (the Service's Pods might still be starting
	// up). This result is logged, a warning event is generated,
	// and the sync operation is scheduled for retry after a brief
	// delay (default 5s), since the missing info commonly becomes
	// available within a brief time.
	Incomplete
)

func (StatusType) Reason

func (t StatusType) Reason() string

Reason returns a string suitable as the reason string for an event after a sync returns the given status type.

Success:     SyncSuccess
Fatal:       SyncFatalError
Recoverable: SyncRecoverableError
Incomplete:  SyncIncomplete

Not valid for the Noop type, since no event is generated for Noop.

func (StatusType) String

func (t StatusType) String() string

Jump to

Keyboard shortcuts

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