framework

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToRecommendationInfos

func ConvertToRecommendationInfos(src interface{}, target interface{}) ([]byte, []byte, error)

func ObjectConversion

func ObjectConversion(object interface{}, target interface{}) error

func RetrievePodTemplate

func RetrievePodTemplate(ctx *RecommendationContext) error

func RetrievePods

func RetrievePods(ctx *RecommendationContext) error

func RetrieveScale

func RetrieveScale(ctx *RecommendationContext) error

Types

type Filter

type Filter interface {
	// The Filter will filter resource can`t be recommended via target recommender.
	Filter(ctx *RecommendationContext) error
}

Filter interface

type ObjectIdentity

type ObjectIdentity struct {
	Namespace  string
	APIVersion string
	Kind       string
	Name       string
	Labels     map[string]string
	Object     unstructured.Unstructured
}

func (ObjectIdentity) GetObjectReference

func (id ObjectIdentity) GetObjectReference() corev1.ObjectReference

type Observe

type Observe interface {
	Observe(ctx *RecommendationContext) error
}

Observe interface

type PostPrepare

type PostPrepare interface {
	PostProcessing(ctx *RecommendationContext) error
}

type PostRecommend

type PostRecommend interface {
	Policy(ctx *RecommendationContext) error
}

PostRecommend interface

type PrePrepare

type PrePrepare interface {
	CheckDataProviders(ctx *RecommendationContext) error
}

PrePrepare interface

type PreRecommend

type PreRecommend interface {
	PreRecommend(ctx *RecommendationContext) error
}

PreRecommend interface

type Prepare

type Prepare interface {
	CollectData(ctx *RecommendationContext) error
}

Prepare interface

type Recommend

type Recommend interface {
	Recommend(ctx *RecommendationContext) error
}

Recommend interface

type RecommendationContext

type RecommendationContext struct {
	Context context.Context
	// The kubernetes resource object reference of recommendation flow.
	Identity ObjectIdentity
	// Target Object
	Object client.Object
	// Time series data from data source.
	InputValues []*common.TimeSeries
	// Time series data 2 from data source.
	InputValues2 []*common.TimeSeries
	// Result series from prediction
	ResultValues []*common.TimeSeries
	// DataProviders contains data source of your recommendation flow.
	DataProviders map[providers.DataSourceType]providers.History
	// Recommendation store result of recommendation flow.
	Recommendation *v1alpha1.Recommendation
	// When cancel channel accept signal indicates that the context has been canceled. The recommendation should stop executing as soon as possible.
	// CancelCh <-chan struct{}
	// RecommendationRule for the context
	RecommendationRule *v1alpha1.RecommendationRule
	// metrics namer for datasource provider
	MetricNamer metricnaming.MetricNamer
	// Algorithm Config
	AlgorithmConfig *config.Config
	// Manager of predict algorithm
	PredictorMgr predictormgr.Manager
	// Pod template
	PodTemplate corev1.PodTemplateSpec
	// Client
	Client client.Client
	// RestMapper
	RestMapper meta.RESTMapper
	// ScalesGetter
	ScaleClient scale.ScalesGetter
	// Scale
	Scale *autoscalingapiv1.Scale
	// Pods in recommendation
	Pods []corev1.Pod
	// HPA Object
	HPA *autoscalingv2.HorizontalPodAutoscaler
	// HPA Object
	EHPA *autoscalingapi.EffectiveHorizontalPodAutoscaler
}

func NewRecommendationContext

func NewRecommendationContext(context context.Context, identity ObjectIdentity, recommendationRule *v1alpha1.RecommendationRule, predictorMgr predictormgr.Manager, dataProviders map[providers.DataSourceType]providers.History, recommendation *v1alpha1.Recommendation, client client.Client, scaleClient scale.ScalesGetter) RecommendationContext

func NewRecommendationContextForObserve added in v0.10.0

func NewRecommendationContextForObserve(recommendation *v1alpha1.Recommendation, restMapper meta.RESTMapper, scaleClient scale.ScalesGetter) RecommendationContext

func (RecommendationContext) String added in v0.9.0

func (ctx RecommendationContext) String() string

Jump to

Keyboard shortcuts

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