resource

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: Apache-2.0, BSD-2-Clause Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultSpecs = "" /* 191-byte string literal not displayed */

Variables

This section is empty.

Functions

func GetNormalizedResource added in v0.9.0

func GetNormalizedResource(cpu, mem *resource.Quantity, specs []Specification) (resource.Quantity, resource.Quantity)

func NewResourceRecommender

func NewResourceRecommender(recommender apis.Recommender, recommendationRule analysisv1alph1.RecommendationRule) (recommender.Recommender, error)

NewResourceRecommender create a new resource recommender.

Types

type PatchResource added in v0.8.0

type PatchResource struct {
	Spec PatchResourceSpec `json:"spec,omitempty"`
}

type PatchResourcePodSpec added in v0.8.0

type PatchResourcePodSpec struct {
	// +patchMergeKey=name
	// +patchStrategy=merge
	Containers []corev1.Container `json:"containers" patchStrategy:"merge" patchMergeKey:"name"`
}

type PatchResourcePodTemplateSpec added in v0.8.0

type PatchResourcePodTemplateSpec struct {
	Spec PatchResourcePodSpec `json:"spec,omitempty"`
}

type PatchResourceSpec added in v0.8.0

type PatchResourceSpec struct {
	Template PatchResourcePodTemplateSpec `json:"template"`
}

type ResourceRecommender

type ResourceRecommender struct {
	base.BaseRecommender
	CpuSampleInterval        string
	CpuRequestPercentile     string
	CpuRequestMarginFraction string
	CpuTargetUtilization     string
	CpuModelHistoryLength    string
	MemSampleInterval        string
	MemPercentile            string
	MemMarginFraction        string
	MemTargetUtilization     string
	MemHistoryLength         string
	OOMProtection            bool
	OOMHistoryLength         time.Duration
	OOMBumpRatio             float64
	Specification            bool
	SpecificationConfigs     []Specification
	CpuHistogramBucketSize   string
	CpuHistogramMaxValue     string
	MemHistogramBucketSize   string
	MemHistogramMaxValue     string
}

func (*ResourceRecommender) CheckDataProviders

func (rr *ResourceRecommender) CheckDataProviders(ctx *framework.RecommendationContext) error

CheckDataProviders in PrePrepare phase, will create data source provider via your recommendation config.

func (*ResourceRecommender) CollectData

func (*ResourceRecommender) Filter

Filter out k8s resources that are not supported by the recommender.

func (*ResourceRecommender) MemoryOOMProtection added in v0.9.0

func (rr *ResourceRecommender) MemoryOOMProtection(oomRecords []oom.OOMRecord, namespace string, workloadName string, containerName string) *resource.Quantity

func (*ResourceRecommender) Name

func (rr *ResourceRecommender) Name() string

func (*ResourceRecommender) Observe

Observe enhance the observability.

func (*ResourceRecommender) Policy

Policy add some logic for result of recommend phase.

func (*ResourceRecommender) PostProcessing

func (rr *ResourceRecommender) PostProcessing(ctx *framework.RecommendationContext) error

func (*ResourceRecommender) PreRecommend

func (*ResourceRecommender) Recommend

type Specification added in v0.9.0

type Specification struct {
	CPU    float64
	Memory float64
}

func GetResourceSpecifications added in v0.9.0

func GetResourceSpecifications(s string) ([]Specification, error)

Jump to

Keyboard shortcuts

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