remediator

package
v1.17.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: Apache-2.0 Imports: 14 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 {
	// 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
	// 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{}) status.MultiError
	// ManagementConflict returns true if one of the watchers noticed a management conflict.
	ManagementConflict() bool
	// ConflictErrors returns the errors the remediator encounters.
	ConflictErrors() []status.ManagementConflictError
	// FightErrors returns the fight errors (KNV2005) the remediator encounters.
	FightErrors() []status.Error
}

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, cfg *rest.Config, applier syncerreconcile.Applier, 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) ConflictErrors

func (r *Remediator) ConflictErrors() []status.ManagementConflictError

ConflictErrors implements Interface.

func (*Remediator) FightErrors added in v1.15.1

func (r *Remediator) FightErrors() []status.Error

FightErrors implements Interface.

func (*Remediator) ManagementConflict

func (r *Remediator) ManagementConflict() bool

ManagementConflict 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) 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{}) 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