Documentation ¶
Index ¶
- func ProvideController(arguments args.InjectArgs) (*controller.GenericController, error)
- type CoWIdler
- func (c *CoWIdler) Full() *idling.Idler
- func (c *CoWIdler) ObjectMeta() *metav1.ObjectMeta
- func (c *CoWIdler) Spec() *idling.IdlerSpec
- func (c *CoWIdler) Status() *idling.IdlerStatus
- func (c *CoWIdler) UpdateIfNeeded(updateFunc func(u *idling.Idler) error) error
- func (c *CoWIdler) Updated() bool
- func (c *CoWIdler) WritableStatus() *idling.IdlerStatus
- func (c *CoWIdler) WritableStatusIf(cond bool) *idling.IdlerStatus
- type IdlerController
- type IdlerExecutor
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 (*CoWIdler) Full ¶
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) 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 ¶
UpdateIfNeeded calls the given function if the CoW idler has been updated, and not otherwise dealt-with via Full.
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.