poller

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

poller package contains the implementation of status poller for monitoring a set of resources on the remote server and posting their updates in a channel

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomStatusCheckers

type CustomStatusCheckers map[schema.GroupKind]StatusCheckerFunc

CustomStatusCheckers contains a mapping of GroupKind to StatusCheckerFunc for adding custom status parsing for custom resources that don't follow the basic encoded ones.

type FakePoller

type FakePoller struct{}

FakePoller is used to test correct behaviour of code that will work with events sent from a StatusPoller

func (*FakePoller) Start

func (p *FakePoller) Start(ctx context.Context, objs []*unstructured.Unstructured) <-chan event.Event

Start implement StatusPoller, but it will use the objs to generate the relevant statuses to return to the channel

type Result

type Result struct {
	Status  Status
	Message string
}

type Status

type Status int
const (
	StatusInProgress Status = iota
	StatusFailed
	StatusTerminating
	StatusCurrent
)

func (Status) String

func (i Status) String() string

type StatusCheckerFunc

type StatusCheckerFunc func(*unstructured.Unstructured) (*Result, error)

StatusCheckerFunc is a function that return a status Result or error for the given uUnstructured object.

type StatusPoller

type StatusPoller interface {
	// Start will start polling the remote api-server for getting updates to the passed resources
	Start(context.Context, []*unstructured.Unstructured) <-chan event.Event
}

func NewDefaultStatusPoller

func NewDefaultStatusPoller(client dynamic.Interface, mapper meta.RESTMapper, statusCheckers CustomStatusCheckers) StatusPoller

NewDefaultStatusPoller return a default implementation of StatusPoller that will connect to the remote api-server and elaborate the current status of the requested resources

Jump to

Keyboard shortcuts

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