Documentation ¶
Index ¶
- Constants
- func NewCPUPressureEvictionPlugin(strategy CPUPressureEviction, emitter metrics.MetricEmitter) skeleton.EvictionPlugin
- func SetGetPodPoolMapFunc(f GetPodPoolMapFunc)
- type CPUPressureEviction
- type CPUPressureEvictionPluginWrapper
- type CPUPressureLoadEviction
- func (p *CPUPressureLoadEviction) GetEvictPods(_ context.Context, _ *pluginapi.GetEvictPodsRequest) (*pluginapi.GetEvictPodsResponse, error)
- func (p *CPUPressureLoadEviction) GetTopEvictionPods(_ context.Context, request *pluginapi.GetTopEvictionPodsRequest) (*pluginapi.GetTopEvictionPodsResponse, error)
- func (p *CPUPressureLoadEviction) Name() string
- func (p *CPUPressureLoadEviction) Start(ctx context.Context) (err error)
- func (p *CPUPressureLoadEviction) ThresholdMet(_ context.Context, _ *pluginapi.Empty) (*pluginapi.ThresholdMetResponse, error)
- type CPUPressureSuppression
- func (p *CPUPressureSuppression) GetEvictPods(_ context.Context, request *pluginapi.GetEvictPodsRequest) (*pluginapi.GetEvictPodsResponse, error)
- func (p *CPUPressureSuppression) GetTopEvictionPods(_ context.Context, _ *pluginapi.GetTopEvictionPodsRequest) (*pluginapi.GetTopEvictionPodsResponse, error)
- func (p *CPUPressureSuppression) Name() string
- func (p *CPUPressureSuppression) Start(context.Context) error
- func (p *CPUPressureSuppression) ThresholdMet(_ context.Context, _ *pluginapi.Empty) (*pluginapi.ThresholdMetResponse, error)
- type ContainerOwnerPoolInfo
- type DummyCPUPressureEviction
- func (d *DummyCPUPressureEviction) GetEvictPods(_ context.Context, _ *pluginapi.GetEvictPodsRequest) (*pluginapi.GetEvictPodsResponse, error)
- func (d *DummyCPUPressureEviction) GetTopEvictionPods(_ context.Context, _ *pluginapi.GetTopEvictionPodsRequest) (*pluginapi.GetTopEvictionPodsResponse, error)
- func (d *DummyCPUPressureEviction) Name() string
- func (d *DummyCPUPressureEviction) Start(_ context.Context) (err error)
- func (d *DummyCPUPressureEviction) ThresholdMet(_ context.Context, _ *pluginapi.Empty) (*pluginapi.ThresholdMetResponse, error)
- type Entries
- type GetPodPoolMapFunc
- type MetricInfo
- type MetricRing
- type MetricSnapshot
- type PodPoolMap
- type PoolMetricCollectHandler
- type SubEntries
Constants ¶
View Source
const (
EvictionNameDummy = "cpu-pressure-dummy"
)
View Source
const EvictionNameLoad = "cpu-pressure-load-plugin"
View Source
const EvictionNameSuppression = "cpu-pressure-suppression-plugin"
Variables ¶
This section is empty.
Functions ¶
func NewCPUPressureEvictionPlugin ¶ added in v0.4.0
func NewCPUPressureEvictionPlugin(strategy CPUPressureEviction, emitter metrics.MetricEmitter) skeleton.EvictionPlugin
func SetGetPodPoolMapFunc ¶ added in v0.3.0
func SetGetPodPoolMapFunc(f GetPodPoolMapFunc)
SetGetPodPoolMapFunc provides a hook to change the implementation of GetPodPoolMapFunc
Types ¶
type CPUPressureEviction ¶
type CPUPressureEviction interface { Start(context.Context) (err error) Name() string GetEvictPods(context.Context, *pluginapi.GetEvictPodsRequest) (*pluginapi.GetEvictPodsResponse, error) ThresholdMet(context.Context, *pluginapi.Empty) (*pluginapi.ThresholdMetResponse, error) GetTopEvictionPods(context.Context, *pluginapi.GetTopEvictionPodsRequest) (*pluginapi.GetTopEvictionPodsResponse, error) }
func NewCPUPressureLoadEviction ¶ added in v0.3.0
func NewCPUPressureLoadEviction(emitter metrics.MetricEmitter, metaServer *metaserver.MetaServer, conf *config.Configuration, readonlyState state.ReadonlyState, ) (CPUPressureEviction, error)
func NewCPUPressureSuppressionEviction ¶
func NewCPUPressureSuppressionEviction(_ metrics.MetricEmitter, metaServer *metaserver.MetaServer, conf *config.Configuration, state state.ReadonlyState, ) (CPUPressureEviction, error)
type CPUPressureEvictionPluginWrapper ¶ added in v0.4.0
type CPUPressureEvictionPluginWrapper struct { CPUPressureEviction sync.Mutex // contains filtered or unexported fields }
func (*CPUPressureEvictionPluginWrapper) GetToken ¶ added in v0.4.0
func (p *CPUPressureEvictionPluginWrapper) GetToken(_ context.Context, _ *pluginapi.Empty) (*pluginapi.GetTokenResponse, error)
GetToken TODO implementation
func (*CPUPressureEvictionPluginWrapper) Start ¶ added in v0.4.0
func (p *CPUPressureEvictionPluginWrapper) Start() (err error)
func (*CPUPressureEvictionPluginWrapper) Stop ¶ added in v0.4.0
func (p *CPUPressureEvictionPluginWrapper) Stop() error
type CPUPressureLoadEviction ¶
func (*CPUPressureLoadEviction) GetEvictPods ¶ added in v0.4.0
func (p *CPUPressureLoadEviction) GetEvictPods(_ context.Context, _ *pluginapi.GetEvictPodsRequest) (*pluginapi.GetEvictPodsResponse, error)
func (*CPUPressureLoadEviction) GetTopEvictionPods ¶
func (p *CPUPressureLoadEviction) GetTopEvictionPods(_ context.Context, request *pluginapi.GetTopEvictionPodsRequest, ) (*pluginapi.GetTopEvictionPodsResponse, error)
func (*CPUPressureLoadEviction) Name ¶
func (p *CPUPressureLoadEviction) Name() string
func (*CPUPressureLoadEviction) Start ¶
func (p *CPUPressureLoadEviction) Start(ctx context.Context) (err error)
func (*CPUPressureLoadEviction) ThresholdMet ¶
func (p *CPUPressureLoadEviction) ThresholdMet(_ context.Context, _ *pluginapi.Empty, ) (*pluginapi.ThresholdMetResponse, error)
type CPUPressureSuppression ¶
type CPUPressureSuppression struct {
// contains filtered or unexported fields
}
func (*CPUPressureSuppression) GetEvictPods ¶
func (p *CPUPressureSuppression) GetEvictPods(_ context.Context, request *pluginapi.GetEvictPodsRequest) (*pluginapi.GetEvictPodsResponse, error)
func (*CPUPressureSuppression) GetTopEvictionPods ¶ added in v0.4.0
func (p *CPUPressureSuppression) GetTopEvictionPods(_ context.Context, _ *pluginapi.GetTopEvictionPodsRequest) (*pluginapi.GetTopEvictionPodsResponse, error)
func (*CPUPressureSuppression) Name ¶
func (p *CPUPressureSuppression) Name() string
func (*CPUPressureSuppression) Start ¶
func (p *CPUPressureSuppression) Start(context.Context) error
func (*CPUPressureSuppression) ThresholdMet ¶ added in v0.4.0
func (p *CPUPressureSuppression) ThresholdMet(_ context.Context, _ *pluginapi.Empty) (*pluginapi.ThresholdMetResponse, error)
type ContainerOwnerPoolInfo ¶ added in v0.3.0
type DummyCPUPressureEviction ¶ added in v0.4.0
type DummyCPUPressureEviction struct{}
func (*DummyCPUPressureEviction) GetEvictPods ¶ added in v0.4.0
func (d *DummyCPUPressureEviction) GetEvictPods(_ context.Context, _ *pluginapi.GetEvictPodsRequest) (*pluginapi.GetEvictPodsResponse, error)
func (*DummyCPUPressureEviction) GetTopEvictionPods ¶ added in v0.4.0
func (d *DummyCPUPressureEviction) GetTopEvictionPods(_ context.Context, _ *pluginapi.GetTopEvictionPodsRequest) (*pluginapi.GetTopEvictionPodsResponse, error)
func (*DummyCPUPressureEviction) Name ¶ added in v0.4.0
func (d *DummyCPUPressureEviction) Name() string
func (*DummyCPUPressureEviction) Start ¶ added in v0.4.0
func (d *DummyCPUPressureEviction) Start(_ context.Context) (err error)
func (*DummyCPUPressureEviction) ThresholdMet ¶ added in v0.4.0
func (d *DummyCPUPressureEviction) ThresholdMet(_ context.Context, _ *pluginapi.Empty) (*pluginapi.ThresholdMetResponse, error)
type GetPodPoolMapFunc ¶ added in v0.3.0
type GetPodPoolMapFunc func(pod.PodFetcher, state.ReadonlyState) PodPoolMap
GetPodPoolMapFunc returns a map keyed by pod UID, the value is a map keyed by container name and its value is the container info with owner pool.
var DefaultGetPodPoolMapFunc GetPodPoolMapFunc = func(fetcher pod.PodFetcher, readonlyState state.ReadonlyState) PodPoolMap { result := make(PodPoolMap) for podUID, entry := range readonlyState.GetPodEntries() { for containerName, containerEntry := range entry { if entry.IsPoolEntry() { result.PutContainerOwnerPoolInfo(podUID, containerName, podUID, containerEntry.AllocationResult.Size(), true) continue } if containerEntry == nil { continue } else if containerEntry.OwnerPoolName == "" { general.Infof("skip get pool name for pod: %s, "+ "container: %s with owner pool name: %s", podUID, containerName, containerEntry.OwnerPoolName) continue } result.PutContainerOwnerPoolInfo(podUID, containerName, containerEntry.OwnerPoolName, containerEntry.AllocationResult.Size(), false) } } return result }
type MetricInfo ¶
type MetricRing ¶
type MetricRing struct { MaxLen int Queue []*MetricSnapshot CurrentIndex int sync.RWMutex }
func CreateMetricRing ¶
func CreateMetricRing(size int) *MetricRing
func (*MetricRing) Count ¶
func (ring *MetricRing) Count() (softOverCount, hardOverCount int)
func (*MetricRing) Push ¶
func (ring *MetricRing) Push(snapShot *MetricSnapshot)
func (*MetricRing) Sum ¶
func (ring *MetricRing) Sum() float64
type MetricSnapshot ¶
type MetricSnapshot struct { Info MetricInfo Time int64 }
type PodPoolMap ¶ added in v0.3.0
type PodPoolMap map[string]map[string]*ContainerOwnerPoolInfo
PodPoolMap is a map keyed by pod UID, the value is a map keyed by container name and its value is the container info with owner pool.
func (PodPoolMap) PutContainerOwnerPoolInfo ¶ added in v0.3.0
type SubEntries ¶
type SubEntries map[string]*MetricRing
SubEntries is keyed by container name or empty string (for pool)
func (SubEntries) IsPoolEntry ¶
func (se SubEntries) IsPoolEntry() bool
Click to show internal directories.
Click to hide internal directories.