Documentation
¶
Overview ¶
Package boost contains logic for managing startup resource boosts
Index ¶
- Constants
- type Manager
- type StartupCPUBoost
- type StartupCPUBoostImpl
- func (b *StartupCPUBoostImpl) DeletePod(ctx context.Context, pod *corev1.Pod) error
- func (b *StartupCPUBoostImpl) DurationPolicies() map[string]duration.Policy
- func (b *StartupCPUBoostImpl) Matches(pod *corev1.Pod) bool
- func (b *StartupCPUBoostImpl) Name() string
- func (b *StartupCPUBoostImpl) Namespace() string
- func (b *StartupCPUBoostImpl) Pod(name string) (*corev1.Pod, bool)
- func (b *StartupCPUBoostImpl) ResourcePolicy(containerName string) (resource.ContainerPolicy, bool)
- func (b *StartupCPUBoostImpl) RevertResources(ctx context.Context, pod *corev1.Pod) error
- func (b *StartupCPUBoostImpl) Stats() StartupCPUBoostStats
- func (b *StartupCPUBoostImpl) UpdateFromSpec(ctx context.Context, boost *autoscaling.StartupCPUBoost) error
- func (b *StartupCPUBoostImpl) UpsertPod(ctx context.Context, pod *corev1.Pod) error
- func (b *StartupCPUBoostImpl) ValidatePolicy(ctx context.Context, name string) (violated []*corev1.Pod)
- type StartupCPUBoostStats
- type StartupCPUBoostStatsEvent
- type StartupCPUBoostStatsEventType
- type TimeTicker
Constants ¶
const ( DefaultManagerCheckInterval = time.Duration(5 * time.Second) DefaultMaxGoroutines = 10 )
const ( StartupCPUBoostStatsPodCreateEvent = 1 StartupCPUBoostStatsPodUpdateEvent = 2 StartupCPUBoostStatsPodDeleteEvent = 3 ResizeSubResourceName = "resize" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager interface { // AddRegularCPUBoost registers new regular startup cpu boost in a manager. AddRegularCPUBoost(ctx context.Context, boost StartupCPUBoost) error // DeleteRegularCPUBoost deletes a regular startup cpu boost from a manager. DeleteRegularCPUBoost(ctx context.Context, name, namespace string) // UpdateRegularCPUBoost updates a regular startup cpu boost in a manager. UpdateRegularCPUBoost(ctx context.Context, spec *autoscaling.StartupCPUBoost) error // GetRegularCPUBoost returns a regular startup cpu boost with a given name and namespace // if such is registered in a manager. GetRegularCPUBoost(ctx context.Context, name, namespace string) (StartupCPUBoost, bool) // GetCPUBoostForPod returns a startup cpu boost that matches a given pod if such is registered // in a manager. If multiple boost types matches, the most specific is returned. GetCPUBoostForPod(ctx context.Context, pod *corev1.Pod) (StartupCPUBoost, bool) // UpsertPod adds new or updates existing tracked POD to the manager and boosts. // If found, the matching cpu boost is returned. UpsertPod(ctx context.Context, pod *corev1.Pod) (StartupCPUBoost, error) // DeletePod deletes the tracked POD from the manager and boosts. // If found, the matching cpu boost is returned. DeletePod(ctx context.Context, pod *corev1.Pod) (StartupCPUBoost, error) // SetStartupCPUBoostReconciler sets the boost object reconciler for the manager. SetStartupCPUBoostReconciler(reconciler reconcile.Reconciler) // Start starts the manager time based check loop. Start(ctx context.Context) error // IsRunning returns true if manager has started its time based check loop. IsRunning(ctx context.Context) bool }
func NewManager ¶
func NewManagerWithTicker ¶ added in v0.0.2
func NewManagerWithTicker(client client.Client, ticker TimeTicker) Manager
type StartupCPUBoost ¶ added in v0.0.2
type StartupCPUBoost interface { // Name returns startup-cpu-boost name Name() string // Namespace returns startup-cpu-boost namespace Namespace() string // ResourcePolicy returns the resource policy for a given container ResourcePolicy(containerName string) (resource.ContainerPolicy, bool) // DurationPolicies returns configured duration policies DurationPolicies() map[string]duration.Policy // Pod returns a POD if tracked by startup-cpu-boost Pod(name string) (*corev1.Pod, bool) // UpsertPod inserts new or updates existing POD to startup-cpu-boost tracking UpsertPod(ctx context.Context, pod *corev1.Pod) error // DeletePod removes the POD from the startup-cpu-boost tracking DeletePod(ctx context.Context, pod *corev1.Pod) error // ValidatePolicy validates policy with a given name on all startup-cpu-boost PODs. ValidatePolicy(ctx context.Context, name string) []*corev1.Pod // RevertResources updates POD's container resource requests and limits to their original // values using the data from StartupCPUBoost annotation RevertResources(ctx context.Context, pod *corev1.Pod) error // Matches verifies if a boost selector matches the given POD Matches(pod *corev1.Pod) bool // Stats returns the StartupCPUBoost usage statistics Stats() StartupCPUBoostStats // UpdateFromSpec updates the StartupCPUBoost from the API spec UpdateFromSpec(ctx context.Context, boost *autoscaling.StartupCPUBoost) error }
StartupCPUBoost is an implementation of a StartupCPUBoost CRD
func NewStartupCPUBoost ¶ added in v0.0.2
func NewStartupCPUBoost(client client.Client, boost *autoscaling.StartupCPUBoost, legacyRevertMode bool) (StartupCPUBoost, error)
NewStartupCPUBoost constructs startup-cpu-boost implementation from a given API spec
type StartupCPUBoostImpl ¶ added in v0.0.2
StartupCPUBoostImpl is an implementation of a StartupCPUBoost CRD
func (*StartupCPUBoostImpl) DeletePod ¶ added in v0.0.2
DeletePod removes the POD from the startup-cpu-boost tracking
func (*StartupCPUBoostImpl) DurationPolicies ¶ added in v0.0.2
func (b *StartupCPUBoostImpl) DurationPolicies() map[string]duration.Policy
DurationPolicies returns configured duration policies
func (*StartupCPUBoostImpl) Matches ¶ added in v0.0.2
func (b *StartupCPUBoostImpl) Matches(pod *corev1.Pod) bool
Matches verifies if a boost selector matches the given POD
func (*StartupCPUBoostImpl) Name ¶ added in v0.0.2
func (b *StartupCPUBoostImpl) Name() string
Name returns startup-cpu-boost name
func (*StartupCPUBoostImpl) Namespace ¶ added in v0.0.2
func (b *StartupCPUBoostImpl) Namespace() string
Namespace returns startup-cpu-boost namespace
func (*StartupCPUBoostImpl) Pod ¶ added in v0.0.2
func (b *StartupCPUBoostImpl) Pod(name string) (*corev1.Pod, bool)
Pod returns a POD if tracked by startup-cpu-boost.
func (*StartupCPUBoostImpl) ResourcePolicy ¶ added in v0.1.0
func (b *StartupCPUBoostImpl) ResourcePolicy(containerName string) (resource.ContainerPolicy, bool)
ResourcePolicy returns the resource policy for a given container
func (*StartupCPUBoostImpl) RevertResources ¶ added in v0.0.2
RevertResources updates POD's container resource requests and limits to their original values using the data from StartupCPUBoost annotation
func (*StartupCPUBoostImpl) Stats ¶ added in v0.6.0
func (b *StartupCPUBoostImpl) Stats() StartupCPUBoostStats
Stats returns the StartupCPUBoost usage statistics
func (*StartupCPUBoostImpl) UpdateFromSpec ¶ added in v0.12.0
func (b *StartupCPUBoostImpl) UpdateFromSpec(ctx context.Context, boost *autoscaling.StartupCPUBoost) error
UpdateFromSpec updates the StartupCPUBoost from the API spec
func (*StartupCPUBoostImpl) UpsertPod ¶ added in v0.0.2
UpsertPod inserts new or updates existing POD to startup-cpu-boost tracking The update of existing POD triggers validation logic and may result in POD update
func (*StartupCPUBoostImpl) ValidatePolicy ¶ added in v0.0.2
func (b *StartupCPUBoostImpl) ValidatePolicy(ctx context.Context, name string) (violated []*corev1.Pod)
ValidatePolicy validates policy with a given name on all startup-cpu-boost PODs. The function returns slice of PODs that violated the policy.
type StartupCPUBoostStats ¶ added in v0.6.0
type StartupCPUBoostStats struct { // activeContainerBoosts is a number of a containers which CPU resources // were increased (boosted) and not yet reverted to their original values ActiveContainerBoosts int // totalContainerBoosts is a number of a containers which CPU resources // were increased (boosted) TotalContainerBoosts int }
StartupCPUBoostStats holds the StartupCPUBoost usage statistics
type StartupCPUBoostStatsEvent ¶ added in v0.6.0
type StartupCPUBoostStatsEvent struct { Type StartupCPUBoostStatsEventType Object interface{} }
type StartupCPUBoostStatsEventType ¶ added in v0.6.0
type StartupCPUBoostStatsEventType int32
type TimeTicker ¶ added in v0.0.2
Directories
¶
Path | Synopsis |
---|---|
Package duration contains implementation of resource boost duration policies
|
Package duration contains implementation of resource boost duration policies |
Package pod contains implementation of startup-cpu-boost POD manipulation functions
|
Package pod contains implementation of startup-cpu-boost POD manipulation functions |
Package resource contains implementation of resource boost duration policies
|
Package resource contains implementation of resource boost duration policies |