boost

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package boost contains logic for managing startup resource boosts

Index

Constants

View Source
const (
	DefaultManagerCheckInterval = time.Duration(5 * time.Second)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager interface {
	AddStartupCPUBoost(ctx context.Context, boost StartupCPUBoost) error
	RemoveStartupCPUBoost(ctx context.Context, namespace, name string)
	StartupCPUBoostForPod(ctx context.Context, pod *corev1.Pod) (StartupCPUBoost, bool)
	StartupCPUBoost(namespace, name string) (StartupCPUBoost, bool)
	Start(ctx context.Context) error
}

func NewManager

func NewManager(client client.Client) Manager

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() string
	Namespace() string
	ResourcePolicy(containerName string) (resource.ContainerPolicy, bool)
	DurationPolicies() map[string]duration.Policy
	Pod(name string) (*corev1.Pod, bool)
	UpsertPod(ctx context.Context, pod *corev1.Pod) error
	DeletePod(ctx context.Context, pod *corev1.Pod) error
	ValidatePolicy(ctx context.Context, name string) []*corev1.Pod
	RevertResources(ctx context.Context, pod *corev1.Pod) error
	Matches(pod *corev1.Pod) bool
}

StartupCPUBoost is an implementation of a StartupCPUBoost CRD

func NewStartupCPUBoost added in v0.0.2

func NewStartupCPUBoost(client client.Client, boost *autoscaling.StartupCPUBoost) (StartupCPUBoost, error)

NewStartupCPUBoost constructs startup-cpu-boost implementation from a given API spec

type StartupCPUBoostImpl added in v0.0.2

type StartupCPUBoostImpl struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

StartupCPUBoostImpl is an implementation of a StartupCPUBoost CRD

func (*StartupCPUBoostImpl) DeletePod added in v0.0.2

func (b *StartupCPUBoostImpl) DeletePod(ctx context.Context, pod *corev1.Pod) error

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

func (b *StartupCPUBoostImpl) RevertResources(ctx context.Context, pod *corev1.Pod) error

RevertResources updates POD's container resource requests and limits to their original values using the data from StartupCPUBoost annotation

func (*StartupCPUBoostImpl) UpsertPod added in v0.0.2

func (b *StartupCPUBoostImpl) UpsertPod(ctx context.Context, pod *corev1.Pod) error

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 TimeTicker added in v0.0.2

type TimeTicker interface {
	Tick() <-chan time.Time
	Stop()
}

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

Jump to

Keyboard shortcuts

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