staticplus

package
v0.2.1-0...-d3ae3b1 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PolicyName is the symbol used to pull us in as a builtin policy.
	PolicyName = "static-plus"
	// PolicyDescription is a short description of this policy.
	PolicyDescription = "A simple policy supporting exclusive/pinned and shared allocations."
)
View Source
const (
	MinShares     = 2
	SharesPerCPU  = 1024
	MilliCPUToCPU = 1000

	// 100000 is equivalent to 100ms
	QuotaPeriod    = 100000
	MinQuotaPeriod = 1000
)

Functions for calculating CFS cpu.shares and cpu.cfs_quota_us.

Notes: These functions are almost verbatim taken from the kubelet
code (from k8s.io/kubernetes/pkg/kubelet/cm/helpers_linux.go).
Since these are exported there, we could try to import them, set the
related feature gates (kubefeatures.CPUCFSQuotaPeriod) for ourselves
into the desired positions (disabled most probably for now) and use
the imported code.

Variables

This section is empty.

Functions

func CreateStaticPlusPolicy

func CreateStaticPlusPolicy(opts *policy.BackendOptions) policy.Backend

CreateStaticPlusPolicy creates a new policy instance.

func MilliCPUToQuota

func MilliCPUToQuota(milliCPU int64, period int64) (quota int64)

MilliCPUToQuota converts milliCPU to CFS quota and period values.

func MilliCPUToShares

func MilliCPUToShares(milliCPU int) int64

MilliCPUToShares converts the milliCPU to CFS shares.

Types

type Allocations

type Allocations map[string]*Assignment

Allocations track all resources allocations by the static+ policy.

type Assignment

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

Assignment tracks resource assignments for a single container.

type CachedAllocations

type CachedAllocations interface {
	cache.Cachable
}

CachedAllocations implements Cache.Cachable boilerplate for Allocations.

Jump to

Keyboard shortcuts

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