idler

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProvideController

func ProvideController(arguments args.InjectArgs) (*controller.GenericController, error)

ProvideController provides a controller that will be run at startup. Kubebuilder will use codegeneration to automatically register this controller in the inject package

Types

type CoWIdler

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

CoWIdler is a copy-on-write abstraction over the idler object. It allows us to skip deepcopying unless we really need it.

func NewCoW

func NewCoW(original *idling.Idler) *CoWIdler

NewCow (🐮) creates a new copy-on-write wrapper around the given idler.

func (*CoWIdler) Full

func (c *CoWIdler) Full() *idling.Idler

Full returns the most-recently-updated idler object. It will copy the idler if necessary, and reset the CoW-ness.

func (*CoWIdler) ObjectMeta

func (c *CoWIdler) ObjectMeta() *metav1.ObjectMeta

ObjectMeta returns the object metadata of the idler. It should be considered read-only.

func (*CoWIdler) Spec

func (c *CoWIdler) Spec() *idling.IdlerSpec

Spec returns the spec of the idler. It should be considered read-only.

func (*CoWIdler) Status

func (c *CoWIdler) Status() *idling.IdlerStatus

Status returns the most-recently-updated status of the idler. It should be considered read-only.

func (*CoWIdler) UpdateIfNeeded

func (c *CoWIdler) UpdateIfNeeded(updateFunc func(u *idling.Idler) error) error

UpdateIfNeeded calls the given function if the CoW idler has been updated, and not otherwise dealt-with via Full.

func (*CoWIdler) Updated

func (c *CoWIdler) Updated() bool

Updated returns whether or not a copy has been made.

func (*CoWIdler) WritableStatus

func (c *CoWIdler) WritableStatus() *idling.IdlerStatus

WritableStatus returns a writable copy of the status. It will copy the current status.

func (*CoWIdler) WritableStatusIf

func (c *CoWIdler) WritableStatusIf(cond bool) *idling.IdlerStatus

WritableStatusIf returns a writable copy of the status if the given condition is true, and otherwise returns a read-only copy of the status.

type IdlerController

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

+informers:group=core,version=v1,kind=Endpoints +rbac:groups="",resources=endpoints,verbs=list;watch;get +rbac:groups="",resources=events,verbs=patch;create;update +rbac:groups=*,resources=*/scale,verbs=get;update +controller:group=idling,version=idling,kind=Idler,resource=idlers

func (*IdlerController) Reconcile

func (bc *IdlerController) Reconcile(k types.ReconcileKey) error

type IdlerExecutor

type IdlerExecutor struct {
	// EndpointsActive takes the name and namespace of a service,
	// and indicates whether or not it has endpoints
	EndpointsActive func(ep types.ReconcileKey) (bool, error)

	// ScaleClient fetches and updates scales for idling/unidling
	ScaleClient scale.ScalesGetter

	// UpdateIdler updates the given idler
	UpdateIdler func(idler *idling.Idler) error

	record.EventRecorder
}

IdlerExecutor performs the actual idling and unidling. It does not deal with watching or retrying -- that's left to the controller. It decouples routine controller logic from easily testible idler-specific logic.

func (*IdlerExecutor) EnsureIdle

func (bc *IdlerExecutor) EnsureIdle(cow *CoWIdler) []error

func (*IdlerExecutor) EnsureUnidle

func (bc *IdlerExecutor) EnsureUnidle(cow *CoWIdler) []error

func (*IdlerExecutor) PopulateInactiveServices

func (bc *IdlerExecutor) PopulateInactiveServices(u *CoWIdler) []error

populateInactiveServices updates the list of active/inactive services.

Jump to

Keyboard shortcuts

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