v1alpha1

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package v1alpha1 is the v1alpha1 version of the crane API. +k8s:deepcopy-gen=package,register +groupName=prediction.crane.io

Index

Constants

View Source
const (
	// PredictionModeInstant means predicting a single point in the future, for example the maximum value for the next hour
	PredictionModeInstant = "instant"
	// PredictionModeRange means predicting a time series during a range of time in the future.
	PredictionModeRange = "range"
)
View Source
const GroupName = "prediction.crane.io"

GroupName specifies the group name used to register the objects.

Variables

View Source
var (
	// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
	SchemeBuilder runtime.SchemeBuilder

	// Depreciated: use Install instead
	AddToScheme = localSchemeBuilder.AddToScheme
	Install     = localSchemeBuilder.AddToScheme
)
View Source
var GroupVersion = v1.GroupVersion{Group: GroupName, Version: "v1alpha1"}

GroupVersion specifies the group and the version used to register the objects.

View Source
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}

SchemeGroupVersion is group version used to register these objects Deprecated: use GroupVersion instead.

Functions

func Resource

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group qualified GroupResource

Types

type Algorithm

type Algorithm struct {
	// AlgorithmType is the algorithm type, currently supports dsp and percentile.
	AlgorithmType AlgorithmType `json:"algorithmType,omitempty"`
	// +optional
	// DSP is an algorithm which use FFT to deal with time series, typically it is used to predict some periodic time series
	DSP *DSP `json:"dsp,omitempty"`
	// +optional
	// Percentile is an algorithm which use exponential time decay histogram, it can predict a reasonable value according your history time series
	Percentile *Percentile `json:"percentile,omitempty"`
}

Algorithm describe the algorithm params

func (*Algorithm) DeepCopy

func (in *Algorithm) DeepCopy() *Algorithm

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Algorithm.

func (*Algorithm) DeepCopyInto

func (in *Algorithm) DeepCopyInto(out *Algorithm)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type AlgorithmType

type AlgorithmType string
const (
	AlgorithmTypePercentile AlgorithmType = "percentile"
	AlgorithmTypeDSP        AlgorithmType = "dsp"
)

type ClusterNodePrediction

type ClusterNodePrediction struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   ClusterNodePredictionSpec   `json:"spec,omitempty"`
	Status ClusterNodePredictionStatus `json:"status,omitempty"`
}

ClusterNodePrediction must be created in crane root namespace as TimeSeriesPrediction is a namespaced object now

func (*ClusterNodePrediction) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterNodePrediction.

func (*ClusterNodePrediction) DeepCopyInto

func (in *ClusterNodePrediction) DeepCopyInto(out *ClusterNodePrediction)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ClusterNodePrediction) DeepCopyObject

func (in *ClusterNodePrediction) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type ClusterNodePredictionList

type ClusterNodePredictionList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`

	Items []ClusterNodePrediction `json:"items"`
}

ClusterNodePredictionList is a list of TimeSeriesPrediction resources

func (*ClusterNodePredictionList) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterNodePredictionList.

func (*ClusterNodePredictionList) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ClusterNodePredictionList) DeepCopyObject

func (in *ClusterNodePredictionList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type ClusterNodePredictionSpec

type ClusterNodePredictionSpec struct {
	NodeSelector       map[string]string   `json:"nodeSelector,omitempty"`
	PredictionTemplate *PredictionTemplate `json:"template,omitempty"`
}

func (*ClusterNodePredictionSpec) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterNodePredictionSpec.

func (*ClusterNodePredictionSpec) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ClusterNodePredictionStatus

type ClusterNodePredictionStatus struct {
	DesiredNumberCreated int                `json:"desiredNumberCreated,omitempty"`
	CurrentNumberCreated int                `json:"currentNumberCreated,omitempty"`
	Conditions           []metav1.Condition `json:"conditions,omitempty"`
}

func (*ClusterNodePredictionStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterNodePredictionStatus.

func (*ClusterNodePredictionStatus) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type DSP

type DSP struct {
	// SampleInterval is the sampling interval of metrics.
	SampleInterval string `json:"sampleInterval,omitempty"`
	// HistoryLength describes how long back should be queried against provider to get historical metrics for prediction.
	HistoryLength string `json:"historyLength,omitempty"`
	// Estimator
	Estimators Estimators `json:"estimators,omitempty"`
}

func (*DSP) DeepCopy

func (in *DSP) DeepCopy() *DSP

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DSP.

func (*DSP) DeepCopyInto

func (in *DSP) DeepCopyInto(out *DSP)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Estimators

type Estimators struct {
	// +optional
	MaxValueEstimators []*MaxValueEstimator `json:"maxValue,omitempty"`
	// +optional
	FFTEstimators []*FFTEstimator `json:"fft,omitempty"`
}

func (*Estimators) DeepCopy

func (in *Estimators) DeepCopy() *Estimators

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Estimators.

func (*Estimators) DeepCopyInto

func (in *Estimators) DeepCopyInto(out *Estimators)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ExpressionQuery

type ExpressionQuery struct {
	// Expression is the query expression. For prometheus, it is promQL.
	Expression string `json:"expression,omitempty"`
}

ExpressionQuery

func (*ExpressionQuery) DeepCopy

func (in *ExpressionQuery) DeepCopy() *ExpressionQuery

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExpressionQuery.

func (*ExpressionQuery) DeepCopyInto

func (in *ExpressionQuery) DeepCopyInto(out *ExpressionQuery)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type FFTEstimator

type FFTEstimator struct {
	MarginFraction         string `json:"marginFraction,omitempty"`
	LowAmplitudeThreshold  string `json:"lowAmplitudeThreshold,omitempty"`
	HighFrequencyThreshold string `json:"highFrequencyThreshold,omitempty"`
	MinNumOfSpectrumItems  *int32 `json:"minNumOfSpectrumItems,omitempty"`
	MaxNumOfSpectrumItems  *int32 `json:"maxNumOfSpectrumItems,omitempty"`
}

func (*FFTEstimator) DeepCopy

func (in *FFTEstimator) DeepCopy() *FFTEstimator

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FFTEstimator.

func (*FFTEstimator) DeepCopyInto

func (in *FFTEstimator) DeepCopyInto(out *FFTEstimator)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type HistogramConfig

type HistogramConfig struct {
	MaxValue              string `json:"maxValue,omitempty"`
	Epsilon               string `json:"epsilon,omitempty"`
	HalfLife              string `json:"halfLife,omitempty"`
	BucketSize            string `json:"bucketSize,omitempty"`
	FirstBucketSize       string `json:"firstBucketSize,omitempty"`
	BucketSizeGrowthRatio string `json:"bucketSizeGrowthRatio,omitempty"`
}

func (*HistogramConfig) DeepCopy

func (in *HistogramConfig) DeepCopy() *HistogramConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HistogramConfig.

func (*HistogramConfig) DeepCopyInto

func (in *HistogramConfig) DeepCopyInto(out *HistogramConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Label

type Label struct {
	Name  string `json:"name,omitempty"`
	Value string `json:"value,omitempty"`
}

A Label is a Name and Value pair that provides additional information about the metric. It is metadata for the metric. For example, Kubernetes pod metrics always have 'namespace' label that represents which namespace it belongs to.

func (*Label) DeepCopy

func (in *Label) DeepCopy() *Label

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Label.

func (*Label) DeepCopyInto

func (in *Label) DeepCopyInto(out *Label)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MaxValueEstimator

type MaxValueEstimator struct {
	MarginFraction string `json:"marginFraction,omitempty"`
}

func (*MaxValueEstimator) DeepCopy

func (in *MaxValueEstimator) DeepCopy() *MaxValueEstimator

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MaxValueEstimator.

func (*MaxValueEstimator) DeepCopyInto

func (in *MaxValueEstimator) DeepCopyInto(out *MaxValueEstimator)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MetricQuery

type MetricQuery struct {
	// MetricName is the name of the metric.
	// +required
	// +kubebuilder:validation:Required
	MetricName string `json:"metricName,omitempty"`

	// QueryConditions is a query condition list.
	// + optional
	QueryConditions []QueryCondition `json:"labels,omitempty"`
}

MetricQuery

func (*MetricQuery) DeepCopy

func (in *MetricQuery) DeepCopy() *MetricQuery

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricQuery.

func (*MetricQuery) DeepCopyInto

func (in *MetricQuery) DeepCopyInto(out *MetricQuery)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MetricTimeSeries

type MetricTimeSeries struct {
	// A collection of Labels that are attached by monitoring system as metadata
	// for the metrics, which are known as dimensions.
	Labels []Label `json:"labels,omitempty"`
	// A collection of Samples in chronological order.
	Samples []Sample `json:"samples,omitempty"`
}

MetricTimeSeries is a stream of samples that belong to a metric with a set of labels

func (*MetricTimeSeries) DeepCopy

func (in *MetricTimeSeries) DeepCopy() *MetricTimeSeries

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricTimeSeries.

func (*MetricTimeSeries) DeepCopyInto

func (in *MetricTimeSeries) DeepCopyInto(out *MetricTimeSeries)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MetricTimeSeriesList

type MetricTimeSeriesList []*MetricTimeSeries

func (MetricTimeSeriesList) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricTimeSeriesList.

func (MetricTimeSeriesList) DeepCopyInto

func (in MetricTimeSeriesList) DeepCopyInto(out *MetricTimeSeriesList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MetricType

type MetricType string

MetricType is the type of metric

const (
	// ResourceQueryMetricType is kubernetes built in metric, only support cpu and memory now.
	ResourceQueryMetricType MetricType = "ResourceQuery"
	// MetricQueryMetricType is an selector style metric, it queried from a system which supports it.
	MetricQueryMetricType MetricType = "MetricQuery"
	// ExpressionQueryMetricType is an raw query style metric, it is queried from a system which supports it, such as prometheus
	ExpressionQueryMetricType MetricType = "ExpressionQuery"
)

type Operator

type Operator string
const (
	OperatorEqual         Operator = "="
	OperatorNotEqual      Operator = "!="
	OperatorRegexMatch    Operator = "=~"
	OperatorNotRegexMatch Operator = "!~"
	OperatorIn            Operator = "in"
)

type Percentile

type Percentile struct {
	Aggregated        bool            `json:"aggregated,omitempty"`
	HistoryLength     string          `json:"historyLength,omitempty"`
	SampleInterval    string          `json:"sampleInterval,omitempty"`
	Histogram         HistogramConfig `json:"histogram,omitempty"`
	MinSampleWeight   string          `json:"minSampleWeight,omitempty"`
	MarginFraction    string          `json:"marginFraction,omitempty"`
	Percentile        string          `json:"percentile,omitempty"`
	TargetUtilization string          `json:"targetUtilization,omitempty"`
}

func (*Percentile) DeepCopy

func (in *Percentile) DeepCopy() *Percentile

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Percentile.

func (*Percentile) DeepCopyInto

func (in *Percentile) DeepCopyInto(out *Percentile)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type PredictionConditionType

type PredictionConditionType string

PredictionConditionType is a valid value for TimeSeriesPredictionCondition.Type

const (
	// TimeSeriesPredictionConditionReady means the prediction data is available to consume
	TimeSeriesPredictionConditionReady PredictionConditionType = "Ready"
)

These are valid conditions of TimeSeriesPrediction.

type PredictionMetric

type PredictionMetric struct {
	// ResourceIdentifier is a resource to identify the metric, but now it is just an identifier now. reference otlp https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/sdk.md
	ResourceIdentifier string `json:"resourceIdentifier,omitempty"`
	// Type is the type of metric, now support ResourceQuery、MetricQuery、ExpressionQuery
	Type MetricType `json:"type,omitempty"`
	// +optional
	// ResourceQuery is a kubernetes built in metric, only support cpu, memory
	ResourceQuery *v1.ResourceName `json:"resourceQuery,omitempty"`
	// following QueryExpressions depend on your crane system data source configured when the system start.
	// if you use different sources with your system start params, it is not valid.
	// +optional
	// MetricQuery is a query against a metric with a set of conditions
	MetricQuery *MetricQuery `json:"metricQuery,omitempty"`
	// +optional
	// ExpressionQuery is a query with a DSL-style expression, such as prometheus promQL
	ExpressionQuery *ExpressionQuery `json:"expressionQuery,omitempty"`
	// Algorithm is the algorithm used by this prediction metric.
	Algorithm Algorithm `json:"algorithm,omitempty"`
}

PredictionMetric describe what metric of your time series prediction, how to query, use which algorithm to predict.

func (*PredictionMetric) DeepCopy

func (in *PredictionMetric) DeepCopy() *PredictionMetric

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PredictionMetric.

func (*PredictionMetric) DeepCopyInto

func (in *PredictionMetric) DeepCopyInto(out *PredictionMetric)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type PredictionMetricStatus

type PredictionMetricStatus struct {
	// ResourceIdentifier is a resource to identify the metric, but now it is just an identifier now.
	// such as cpu, memory
	ResourceIdentifier string `json:"resourceIdentifier,omitempty"`
	// Prediction is the predicted time series data of the metric
	Prediction []*MetricTimeSeries `json:"prediction,omitempty"`
	// Specifies whether the prediction is Ready.
	Ready bool `json:"ready"`
}

MetricPredictedData is predicted data of an metric, which denote a metric by ResourceIdentifier in the PredictionMetric

func (*PredictionMetricStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PredictionMetricStatus.

func (*PredictionMetricStatus) DeepCopyInto

func (in *PredictionMetricStatus) DeepCopyInto(out *PredictionMetricStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type PredictionMode

type PredictionMode string

PredictionMode represents the prediction time series mode.

type PredictionTemplate

type PredictionTemplate struct {
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              TimeSeriesPredictionSpec `json:"spec,omitempty"`
}

func (*PredictionTemplate) DeepCopy

func (in *PredictionTemplate) DeepCopy() *PredictionTemplate

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PredictionTemplate.

func (*PredictionTemplate) DeepCopyInto

func (in *PredictionTemplate) DeepCopyInto(out *PredictionTemplate)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type QueryCondition

type QueryCondition struct {
	// Key is the key of the query condition
	Key string `json:"key,omitempty"`
	// Operator
	Operator Operator `json:"operator,omitempty"`
	// Value is the query value list.
	Value []string `json:"value,omitempty"`
}

QueryCondition is a key, operator, value triple. E.g. 'namespace = default', 'role in [Admin, Developer]'

func (*QueryCondition) DeepCopy

func (in *QueryCondition) DeepCopy() *QueryCondition

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new QueryCondition.

func (*QueryCondition) DeepCopyInto

func (in *QueryCondition) DeepCopyInto(out *QueryCondition)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Sample

type Sample struct {
	Value     string `json:"value,omitempty"`
	Timestamp int64  `json:"timestamp,omitempty"`
}

Sample pairs a Value with a Timestamp.

func (*Sample) DeepCopy

func (in *Sample) DeepCopy() *Sample

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Sample.

func (*Sample) DeepCopyInto

func (in *Sample) DeepCopyInto(out *Sample)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type TimeSeriesPrediction

type TimeSeriesPrediction struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec TimeSeriesPredictionSpec `json:"spec,omitempty"`

	// +optional
	Status TimeSeriesPredictionStatus `json:"status,omitempty"`
}

TimeSeriesPrediction is a prediction for a time series.

func (*TimeSeriesPrediction) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TimeSeriesPrediction.

func (*TimeSeriesPrediction) DeepCopyInto

func (in *TimeSeriesPrediction) DeepCopyInto(out *TimeSeriesPrediction)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*TimeSeriesPrediction) DeepCopyObject

func (in *TimeSeriesPrediction) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type TimeSeriesPredictionList

type TimeSeriesPredictionList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`

	Items []TimeSeriesPrediction `json:"items"`
}

TimeSeriesPredictionList is a list of NodePrediction resources

func (*TimeSeriesPredictionList) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TimeSeriesPredictionList.

func (*TimeSeriesPredictionList) DeepCopyInto

func (in *TimeSeriesPredictionList) DeepCopyInto(out *TimeSeriesPredictionList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*TimeSeriesPredictionList) DeepCopyObject

func (in *TimeSeriesPredictionList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type TimeSeriesPredictionSpec

type TimeSeriesPredictionSpec struct {
	// PredictionMetrics is an array of PredictionMetric
	PredictionMetrics []PredictionMetric `json:"predictionMetrics,omitempty"`
	// Target is the target referent of time series prediction. each TimeSeriesPrediction associate with just only one target ref.
	// all metrics in PredictionMetricConfigurations is about the TargetRef
	TargetRef v1.ObjectReference `json:"targetRef,omitempty"`
	// PredictionWindowSeconds is a time window in seconds, indicating how long to predict in the future.
	PredictionWindowSeconds int32 `json:"predictionWindowSeconds,omitempty"`
}

TimeSeriesPredictionSpec is a description of a TimeSeriesPrediction.

func (*TimeSeriesPredictionSpec) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TimeSeriesPredictionSpec.

func (*TimeSeriesPredictionSpec) DeepCopyInto

func (in *TimeSeriesPredictionSpec) DeepCopyInto(out *TimeSeriesPredictionSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type TimeSeriesPredictionStatus

type TimeSeriesPredictionStatus struct {
	// PredictionMetrics is an array of PredictionMetricStatus of all PredictionMetrics, PredictionMetricStatus include predicted time series data
	PredictionMetrics []PredictionMetricStatus `json:"predictionMetrics,omitempty"`
	// Conditions is the condition of TimeSeriesPrediction
	Conditions []metav1.Condition `json:"conditions,omitempty"`
}

TimeSeriesPredictionStatus is the status of a TimeSeriesPrediction.

func (*TimeSeriesPredictionStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TimeSeriesPredictionStatus.

func (*TimeSeriesPredictionStatus) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

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