remediator

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	// Remediating returns true if workers are running and watchers are watching.
	Remediating() bool
	// Pause the Remediator by stopping the workers and waiting for them to be done.
	Pause()
	// Resume the Remediator by starting the workers.
	Resume()
	// NeedsUpdate returns true if the Remediator needs its watches to be updated
	// (typically due to some asynchronous error that occurred).
	NeedsUpdate() bool
	// AddWatches starts server-side watches based upon the given map of GVKs
	// which should be watched.
	AddWatches(context.Context, map[schema.GroupVersionKind]struct{}, string) status.MultiError
	// UpdateWatches starts and stops server-side watches based upon the given map
	// of GVKs which should be watched.
	UpdateWatches(context.Context, map[schema.GroupVersionKind]struct{}, string) status.MultiError
}

Interface is a fake-able subset of the interface Remediator implements that accepts a new set of declared configuration.

Placed here to make discovering the production implementation (above) easier.

type Remediator

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

Remediator knows how to keep the state of a Kubernetes cluster in sync with a set of declared resources. It processes a work queue of items, and ensures each matches the set of declarations passed on instantiation.

The exposed Queue operations are threadsafe - multiple callers may safely synchronously add and consume work items.

func New

func New(
	scope declared.Scope,
	syncName string,
	watcherFactory watch.WatcherFactory,
	mapper utilwatch.ResettableRESTMapper,
	applier syncerreconcile.Applier,
	conflictHandler conflict.Handler,
	fightHandler fight.Handler,
	crdController *controllers.CRDController,
	decls *declared.Resources,
	numWorkers int,
) (*Remediator, error)

New instantiates launches goroutines to make the state of the connected cluster match the declared resources.

It is safe for decls to be modified after they have been passed into the Remediator.

func (*Remediator) AddWatches added in v1.19.0

func (r *Remediator) AddWatches(ctx context.Context, gvks map[schema.GroupVersionKind]struct{}, commit string) status.MultiError

AddWatches implements Interface.

func (*Remediator) NeedsUpdate

func (r *Remediator) NeedsUpdate() bool

NeedsUpdate implements Interface.

func (*Remediator) Pause added in v1.15.1

func (r *Remediator) Pause()

Pause the Remediator by stopping the workers and waiting for them to be done.

func (*Remediator) Remediating added in v1.19.0

func (r *Remediator) Remediating() bool

Remediating returns true if workers are running and watchers are watching.

func (*Remediator) Resume added in v1.15.1

func (r *Remediator) Resume()

Resume the Remediator by starting the workers.

func (*Remediator) Start

func (r *Remediator) Start(ctx context.Context) <-chan struct{}

Start the Remediator's asynchronous reconcile workers. Returns a done channel that will be closed after the context is cancelled and all the workers have exited.

func (*Remediator) UpdateWatches

func (r *Remediator) UpdateWatches(ctx context.Context, gvks map[schema.GroupVersionKind]struct{}, commit string) status.MultiError

UpdateWatches implements Interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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