event

package
v0.20.5 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: Apache-2.0 Imports: 4 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResourceStatusEqual added in v0.8.0

func ResourceStatusEqual(or1, or2 *ResourceStatus) bool

ResourceStatusEqual checks if two instances of ResourceStatus are the same. This is used to determine whether status has changed for a particular resource. Important to note that this does not check all fields, but only the ones that are considered part of the status for a resource. So if the status or the message of an ResourceStatus (or any of its generated ResourceStatuses) have changed, this will return true. Changes to the state of the resource itself that doesn't impact status are not considered.

Types

type Event

type Event struct {
	// EventType defines the type of event.
	EventType EventType

	// Resource is only available for ResourceUpdateEvents. It includes information about the resource,
	// including the resource status, any errors and the resource itself (as an unstructured).
	Resource *ResourceStatus

	// Error is only available for ErrorEvents. It contains the error that caused the engine to
	// give up.
	Error error
}

Event defines that type that is passed back through the event channel to notify the caller of changes as resources are being polled.

type EventType

type EventType int

EventType is the type that describes the type of an Event that is passed back to the caller as resources in the cluster are being polled.

const (
	// ResourceUpdateEvent describes events related to a change in the status of one of the polled resources.
	ResourceUpdateEvent EventType = iota
	// CompletedEvent signals that all resources have been reconciled and the engine has completed its work. The
	// event channel will be closed after this event.
	CompletedEvent
	// ErrorEvent signals that the engine has encountered an error that it can not recover from. The engine
	// is shutting down and the event channel will be closed after this event.
	ErrorEvent
)

func (EventType) String

func (i EventType) String() string

type ResourceStatus

type ResourceStatus struct {
	// Identifier contains the information necessary to locate the
	// resource within a cluster.
	Identifier object.ObjMetadata

	// Status is the computed status for this resource.
	Status status.Status

	// Resource contains the actual manifest for the resource that
	// was fetched from the cluster and used to compute status.
	Resource *unstructured.Unstructured

	// Errors contains the error if something went wrong during the
	// process of fetching the resource and computing the status.
	Error error

	// Message is text describing the status of the resource.
	Message string

	// GeneratedResources is a slice of ResourceStatus that
	// contains information and status for any generated resources
	// of the current resource.
	GeneratedResources ResourceStatuses
}

ResourceStatus contains information about a resource after we have fetched it from the cluster and computed status.

type ResourceStatuses

type ResourceStatuses []*ResourceStatus

func (ResourceStatuses) Len

func (g ResourceStatuses) Len() int

func (ResourceStatuses) Less

func (g ResourceStatuses) Less(i, j int) bool

func (ResourceStatuses) Swap

func (g ResourceStatuses) Swap(i, j int)

Jump to

Keyboard shortcuts

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