watch

package
v1.14.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// RESTConfigTimeout sets the REST config timeout for the remediator to 1 hour.
	//
	// RESTConfigTimeout should be longer than 2*minWatchTimeout to respect
	// the watch timeout set by `ListOptions.TimeoutSeconds` in the watch
	// create requests.
	RESTConfigTimeout = time.Hour
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager accepts new resource lists that are parsed from Git and then updates declared resources and get GVKs.

func NewManager

func NewManager(scope declared.Scope, syncName string, cfg *rest.Config,
	q *queue.ObjectQueue, decls *declared.Resources, options *Options,
	addConflictErrorFunc func(status.ManagementConflictError),
	removeConflictErrorFunc func(status.ManagementConflictError)) (*Manager, error)

NewManager starts a new watch manager

func (*Manager) ManagementConflict

func (m *Manager) ManagementConflict() bool

ManagementConflict returns true if any watcher notices any management conflicts. This function is threadsafe.

func (*Manager) NeedsUpdate

func (m *Manager) NeedsUpdate() bool

NeedsUpdate returns true if the Manager's watches need to be updated. This function is threadsafe.

func (*Manager) UpdateWatches

func (m *Manager) UpdateWatches(ctx context.Context, gvkMap map[schema.GroupVersionKind]struct{}) status.MultiError

UpdateWatches accepts a map of GVKs that should be watched and takes the following actions:

  • stop watchers for any GroupVersionKind that is not present in the given map.
  • start watchers for any GroupVersionKind that is present in the given map and not present in the current watch map.

This function is threadsafe.

type Options

type Options struct {
	// Mapper is the RESTMapper to use for mapping GroupVersionKinds to Resources.
	Mapper meta.RESTMapper
	// contains filtered or unexported fields
}

Options contains options for creating a watch manager.

func DefaultOptions

func DefaultOptions(cfg *rest.Config) (*Options, error)

DefaultOptions return the default options: - create discovery RESTmapper from the passed rest.Config - use createWatcher to create watchers

type Runnable

type Runnable interface {
	Stop()
	Run(ctx context.Context) status.Error
	ManagementConflict() bool
	SetManagementConflict(object client.Object)
	ClearManagementConflict()
	// contains filtered or unexported methods
}

Runnable defines the custom watch interface.

func NewFiltered

func NewFiltered(_ context.Context, cfg watcherConfig) Runnable

NewFiltered returns a new filtered watch initialized with the given options.

Jump to

Keyboard shortcuts

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