readiness

package
v0.0.0-...-48ed4f0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Expectations

type Expectations interface {
	Expect(o runtime.Object)
	CancelExpect(o runtime.Object)
	TryCancelExpect(o runtime.Object) bool
	ExpectationsDone()
	Observe(o runtime.Object)
	Satisfied() bool
	Populated() bool
}

Expectations tracks expectations for runtime.Objects. A set of Expect() calls are made, demarcated by ExpectationsDone(). Expectations are satisfied by calls to Observe(). Once all expectations are satisfied, Satisfied() will begin returning true.

type Lister

type Lister interface {
	List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error
}

Lister lists resources from a cache.

type Tracker

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

Tracker tracks readiness for templates, constraints and data.

func NewTracker

func NewTracker(lister Lister, mutationEnabled, externalDataEnabled, expansionEnabled bool) *Tracker

NewTracker creates a new Tracker and initializes the internal trackers.

func SetupTracker

func SetupTracker(mgr manager.Manager, mutationEnabled, externalDataEnabled, expansionEnabled bool) (*Tracker, error)

SetupTracker sets up a readiness tracker and registers it to run under control of the provided Manager object. NOTE: Must be called _before_ the manager is started.

func SetupTrackerNoReadyz

func SetupTrackerNoReadyz(mgr manager.Manager, mutationEnabled, externalDataEnabled, expansionEnabled bool) (*Tracker, error)

SetupTrackerNoReadyz sets up a readiness tracker and registers it to run under control of the provided Manager object without instantiating /readyz (used for testing).

func (*Tracker) CancelData

func (t *Tracker) CancelData(gvk schema.GroupVersionKind)

CancelData stops expecting data for the specified resource kind.

func (*Tracker) CancelTemplate

func (t *Tracker) CancelTemplate(ct *templates.ConstraintTemplate)

CancelTemplate stops expecting the provided ConstraintTemplate and associated Constraints.

func (*Tracker) CheckSatisfied

func (t *Tracker) CheckSatisfied(_ *http.Request) error

CheckSatisfied implements healthz.Checker to report readiness based on tracker status. Returns nil if all expectations have been satisfied, otherwise returns an error.

func (*Tracker) DisableStats

func (t *Tracker) DisableStats()

DisableStats disables the verbose logging routine for the readiness tracker.

func (*Tracker) EnableStats

func (t *Tracker) EnableStats()

EnableStats enables the verbose logging routine for the readiness tracker.

func (*Tracker) For

For returns Expectations for the requested resource kind.

func (*Tracker) ForData

func (t *Tracker) ForData(gvk schema.GroupVersionKind) Expectations

ForData returns Expectations for tracking data of the requested resource kind.

func (*Tracker) Populated

func (t *Tracker) Populated() bool

func (*Tracker) Run

func (t *Tracker) Run(ctx context.Context) error

Run runs the tracker and blocks until it completes. The provided context can be canceled to signal a shutdown request.

func (*Tracker) Satisfied

func (t *Tracker) Satisfied() bool

Satisfied returns true if all tracked expectations have been satisfied.

func (*Tracker) TryCancelTemplate

func (t *Tracker) TryCancelTemplate(ct *templates.ConstraintTemplate)

TryCancelTemplate will check the readiness retries left on a CT and cancel the expectation for that CT and its associated Constraints if no retries remain.

Jump to

Keyboard shortcuts

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