intent

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: Apache-2.0, MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FallbackNodeAction = func() marker.NodeAction {
	n, _ := calculateNext(marker.NodeActionUnknown)
	return n
}()

FallbackNodeAction is the first recovery action that is reasonble to take from an unknown point.

Functions

func Equivalent

func Equivalent(i, j *Intent) bool

Equivalent compares intentional state to determine equivalency.

Types

type Input

type Input interface {
	marker.Container
	// GetName returns the Input's addressable Name.
	GetName() string
}

Input is a suitable container of data for interpreting an Intent from. This effectively is a subset of the kubernetes' v1.Node accessors, but is more succinct and scoped to the used accessors.

type Intent

type Intent struct {
	// NodeName is the Resource name that addresses it.
	NodeName string
	// Wanted is the currently instructed action on the node.
	Wanted marker.NodeAction
	// Active is the current action taken on the Node.
	Active marker.NodeAction
	// State is the current status or state of the Node reported, generally for
	// the Active action.
	State marker.NodeState
	// UpdateAvailable is the Node's status of having an update ready to apply.
	UpdateAvailable marker.NodeUpdate
}

Intent is the sole communicator of state progression and desired intentions for an Agent to act upon and to communicate its progress.

func Given

func Given(input Input) *Intent

Given determines the commuincated intent from a Node without projecting into its next steps.

func (*Intent) Actionable

func (i *Intent) Actionable() bool

Needed indicates that the intent is needing progress made on it.

func (Intent) Clone

func (i Intent) Clone() *Intent

Clone returns a copy of the Intent to mutate independently of the source instance.

func (*Intent) DegradedPath

func (i *Intent) DegradedPath() bool

DegradedPaths indicates that the intent will derail and step into an unknown step if it has not already.

func (*Intent) DisplayString

func (i *Intent) DisplayString() string

func (*Intent) Errored

func (i *Intent) Errored() bool

Errored indicates that the intention was not realized and failed in attempt to do so.

func (*Intent) GetAnnotations

func (i *Intent) GetAnnotations() map[string]string

GetAnnotations transposes the Intent into a map of Annotations suitable for adding to a Resource.

func (*Intent) GetLabels

func (i *Intent) GetLabels() map[string]string

GetLabels transposes the Intent into a map of Labels suitable for adding to a Resource.

func (*Intent) GetName

func (i *Intent) GetName() string

GetName returns the name of the Intent's target.

func (*Intent) HasUpdateAvailable

func (i *Intent) HasUpdateAvailable() bool

HasUpdateAvailable indicates the Node has flagged itself as needing an update.

func (*Intent) InProgress

func (i *Intent) InProgress() bool

InProgess reports true when the Intent is for a node that is actively making progress towards completing an update.

func (*Intent) Intrusive

func (i *Intent) Intrusive() bool

Intrusive indicates that the intention will be intrusive if realized.

func (*Intent) Projected

func (i *Intent) Projected() *Intent

Projected returns the n+1 step projection of a would-be Intent. It does not check whether or not the next step is correct given the current intent (ie: this will not error if the node has not actually completed a step).

func (*Intent) Realized

func (i *Intent) Realized() bool

Realized indicates that the Intent reached the intended state.

func (*Intent) Reset

func (i *Intent) Reset() *Intent

Reset brings the intent back to the start of the progression where the intent may be able to resolve issues and fall into a valid state.

func (*Intent) SetBeginUpdate

func (i *Intent) SetBeginUpdate() *Intent

func (*Intent) SetUpdateAvailable

func (i *Intent) SetUpdateAvailable(available bool) *Intent

SetUpdateAvailable modifies the intent to reflect the provided available state.

func (*Intent) Stuck

func (i *Intent) Stuck() bool

Stuck intents are those that cannot be realized or are terminal in their current state and should be unstuck. If terminal handling is needed, the caller should use Intent.Terminal() to detect this case.

func (*Intent) Terminal

func (i *Intent) Terminal() bool

Terminal indicates that the intent has reached a terminal point in the progression, the intent will not make progress in anyway without outside state action.

func (*Intent) Waiting

func (i *Intent) Waiting() bool

Waiting reports true when a Node is prepared and waiting to make further commanded progress towards completing an update. This doesn't however indicate whether or not the intent reached a waiting state successfully or not. Utilize other checks to assert a combinational check.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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