v1alpha1

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: Apache-2.0 Imports: 5 Imported by: 4

Documentation

Overview

Package v1alpha1 contains API Schema definitions for the autoscaling v1alpha1 API group +kubebuilder:object:generate=true +groupName=autoscaling.k8s.io

Index

Constants

View Source
const (
	// UpdateModeOff means that autoscaler never changes resources.
	UpdateModeOff string = "Off"
	// UpdateModeAuto means that autoscaler can update resources during the lifetime of the resource.
	UpdateModeAuto string = "Auto"
	// UpdateModeMaintenanceWindow means that HPA/VPA will only act during maintenance window.
	UpdateModeMaintenanceWindow string = "MaintenanceWindow"

	// UpdateModeDefault is the default update mode
	UpdateModeDefault = UpdateModeAuto
)
View Source
const (
	// VpaOnly - only vertical scaling
	VpaOnly int32 = 100
	// HpaOnly - only horizontal scaling
	HpaOnly int32 = 0
)

Variables

View Source
var (
	// GroupName is the group name use in this package
	GroupName = "autoscaling.k8s.io"

	// SchemeGroupVersionVpa is group version used to register these objects
	SchemeGroupVersionVpa = schema.GroupVersion{Group: GroupName, Version: "v1"}

	// SchemeGroupVersionHvpa is group version used to register these objects
	SchemeGroupVersionHvpa = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

BlockingReasons lists all the blocking reasons

Functions

This section is empty.

Types

type BlockedScaling

type BlockedScaling struct {
	Reason        BlockingReason `json:"reason,omitempty"`
	ScalingStatus `json:"scalingStatus,omitempty"`
}

BlockedScaling defines the details for blocked scaling

func (*BlockedScaling) DeepCopy

func (in *BlockedScaling) DeepCopy() *BlockedScaling

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

func (*BlockedScaling) DeepCopyInto

func (in *BlockedScaling) DeepCopyInto(out *BlockedScaling)

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

type BlockingReason

type BlockingReason string

BlockingReason defines the reason for blocking.

const (
	// BlockingReasonStabilizationWindow - HVPA is in stabilization window
	BlockingReasonStabilizationWindow BlockingReason = "StabilizationWindow"
	// BlockingReasonMaintenanceWindow - Resource is in maintenance window
	BlockingReasonMaintenanceWindow BlockingReason = "MaintenanceWindow"
	// BlockingReasonUpdatePolicy - Update policy doesn't support scaling
	BlockingReasonUpdatePolicy BlockingReason = "UpdatePolicy"
	// BlockingReasonWeight  - VpaWeight doesn't support scaling
	BlockingReasonWeight BlockingReason = "Weight"
	// BlockingReasonMinChange - Min change doesn't support scaling
	BlockingReasonMinChange BlockingReason = "MinChange"
)

type ChangeParams

type ChangeParams struct {
	// Value is the absolute value of the scaling
	// +optional
	Value *string `json:"value,omitempty"`
	// Percentage is the percentage of currently allocated value to be used for scaling
	// +optional
	Percentage *int32 `json:"percentage,omitempty"`
}

ChangeParams defines the parameters for scaling

func (*ChangeParams) DeepCopy

func (in *ChangeParams) DeepCopy() *ChangeParams

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

func (*ChangeParams) DeepCopyInto

func (in *ChangeParams) DeepCopyInto(out *ChangeParams)

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

type HpaSpec

type HpaSpec struct {
	// Selector is a label query that should match HPA.
	// Must match in order to be controlled.
	// If empty, defaulted to labels on HPA template.
	// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
	// +optional
	Selector *metav1.LabelSelector `json:"selector,omitempty"`

	// Deploy defines whether the HPA is deployed or not
	Deploy bool `json:"deploy,omitempty"`

	// ScaleUp defines the parameters for scale up
	ScaleUp ScaleType `json:"scaleUp,omitempty"`

	// ScaleDown defines the parameters for scale down
	ScaleDown ScaleType `json:"scaleDown,omitempty"`

	// Template is the object that describes the HPA that will be created.
	// +optional
	Template HpaTemplate `json:"template,omitempty"`
}

HpaSpec defines spec for HPA

func (*HpaSpec) DeepCopy

func (in *HpaSpec) DeepCopy() *HpaSpec

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

func (*HpaSpec) DeepCopyInto

func (in *HpaSpec) DeepCopyInto(out *HpaSpec)

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

type HpaStatus

type HpaStatus struct {
	CurrentReplicas int32 `json:"currentReplicas,omitempty"`
	DesiredReplicas int32 `json:"desiredReplicas,omitempty"`
}

HpaStatus defines the status of HPA

func (*HpaStatus) DeepCopy

func (in *HpaStatus) DeepCopy() *HpaStatus

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

func (*HpaStatus) DeepCopyInto

func (in *HpaStatus) DeepCopyInto(out *HpaStatus)

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

type HpaTemplate

type HpaTemplate struct {
	// Metadata of the pods created from this template.
	// +kubebuilder:validation:XPreserveUnknownFields
	// +optional
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// Spec defines the behavior of a HPA.
	// +optional
	Spec HpaTemplateSpec `json:"spec,omitempty"`
}

HpaTemplate defines the template for HPA

func (*HpaTemplate) DeepCopy

func (in *HpaTemplate) DeepCopy() *HpaTemplate

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

func (*HpaTemplate) DeepCopyInto

func (in *HpaTemplate) DeepCopyInto(out *HpaTemplate)

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

type HpaTemplateSpec

type HpaTemplateSpec struct {
	// minReplicas is the lower limit for the number of replicas to which the autoscaler can scale down.
	// It defaults to 1 pod.
	// +optional
	MinReplicas *int32 `json:"minReplicas,omitempty" protobuf:"varint,1,opt,name=minReplicas"`

	// maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up.
	// It cannot be less that minReplicas.
	MaxReplicas int32 `json:"maxReplicas" protobuf:"varint,2,opt,name=maxReplicas"`

	// metrics contains the specifications for which to use to calculate the
	// desired replica count (the maximum replica count across all metrics will
	// be used).  The desired replica count is calculated multiplying the
	// ratio between the target value and the current value by the current
	// number of pods.  Ergo, metrics used must decrease as the pod count is
	// increased, and vice-versa.  See the individual metric source types for
	// more information about how each type of metric must respond.
	// If not set, the default metric will be set to 80% average CPU utilization.
	// +optional
	Metrics []autoscaling.MetricSpec `json:"metrics,omitempty" protobuf:"bytes,3,rep,name=metrics"`
}

HpaTemplateSpec defines the spec for HPA

func (*HpaTemplateSpec) DeepCopy

func (in *HpaTemplateSpec) DeepCopy() *HpaTemplateSpec

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

func (*HpaTemplateSpec) DeepCopyInto

func (in *HpaTemplateSpec) DeepCopyInto(out *HpaTemplateSpec)

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

type Hvpa

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

	Spec   HvpaSpec   `json:"spec,omitempty"`
	Status HvpaStatus `json:"status,omitempty"`
}

Hvpa is the Schema for the hvpas API +kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.targetSelector

func (*Hvpa) DeepCopy

func (in *Hvpa) DeepCopy() *Hvpa

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

func (*Hvpa) DeepCopyInto

func (in *Hvpa) DeepCopyInto(out *Hvpa)

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

func (*Hvpa) DeepCopyObject

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

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

type HvpaList

type HvpaList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Hvpa `json:"items"`
}

HvpaList contains a list of Hvpa +kubebuilder:object:root=true

func (*HvpaList) DeepCopy

func (in *HvpaList) DeepCopy() *HvpaList

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

func (*HvpaList) DeepCopyInto

func (in *HvpaList) DeepCopyInto(out *HvpaList)

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

func (*HvpaList) DeepCopyObject

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

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

type HvpaSpec

type HvpaSpec struct {
	// Replicas is the number of replicas of target resource
	Replicas *int32 `json:"replicas,omitempty"`

	// Hpa defines the spec of HPA
	Hpa HpaSpec `json:"hpa,omitempty"`

	// Vpa defines the spec of VPA
	Vpa VpaSpec `json:"vpa,omitempty"`

	// WeightBasedScalingIntervals defines the intervals of replica counts, and the weights for scaling a deployment vertically
	// If there are overlapping intervals, then the vpaWeight will be taken from the first matching interval
	WeightBasedScalingIntervals []WeightBasedScalingInterval `json:"weightBasedScalingIntervals,omitempty"`

	// TargetRef points to the controller managing the set of pods for the autoscaler to control
	TargetRef *autoscaling.CrossVersionObjectReference `json:"targetRef"`

	// MaintenanceTimeWindow contains information about the time window for maintenance operations.
	// +optional
	MaintenanceTimeWindow *MaintenanceTimeWindow `json:"maintenanceTimeWindow,omitempty"`
}

HvpaSpec defines the desired state of Hvpa

func (*HvpaSpec) DeepCopy

func (in *HvpaSpec) DeepCopy() *HvpaSpec

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

func (*HvpaSpec) DeepCopyInto

func (in *HvpaSpec) DeepCopyInto(out *HvpaSpec)

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

type HvpaStatus

type HvpaStatus struct {
	// Replicas is the number of replicas of the target resource.
	Replicas *int32 `json:"replicas,omitempty"`
	// TargetSelector is the string form of the label selector of HPA. This is required for HPA to work with scale subresource.
	TargetSelector *string `json:"targetSelector,omitempty"`
	// Current HPA UpdatePolicy set in the spec
	HpaScaleUpUpdatePolicy *UpdatePolicy `json:"hpaScaleUpUpdatePolicy,omitempty"`
	// Current HPA UpdatePolicy set in the spec
	HpaScaleDownUpdatePolicy *UpdatePolicy `json:"hpaScaleDownUpdatePolicy,omitempty"`
	// Current VPA UpdatePolicy set in the spec
	VpaScaleUpUpdatePolicy *UpdatePolicy `json:"vpaScaleUpUpdatePolicy,omitempty"`
	// Current VPA UpdatePolicy set in the spec
	VpaScaleDownUpdatePolicy *UpdatePolicy `json:"vpaScaleDownUpdatePolicy,omitempty"`

	HpaWeight int32 `json:"hpaWeight,omitempty"`
	VpaWeight int32 `json:"vpaWeight,omitempty"`

	// Override scale up stabilization window
	OverrideScaleUpStabilization bool `json:"overrideScaleUpStabilization,omitempty"`

	LastBlockedScaling []*BlockedScaling `json:"lastBlockedScaling,omitempty"`
	LastScaling        ScalingStatus     `json:"lastScaling,omitempty"`

	// LastError has details of any errors that occurred
	LastError *LastError `json:"lastError,omitempty"`
}

HvpaStatus defines the observed state of Hvpa

func (*HvpaStatus) DeepCopy

func (in *HvpaStatus) DeepCopy() *HvpaStatus

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

func (*HvpaStatus) DeepCopyInto

func (in *HvpaStatus) DeepCopyInto(out *HvpaStatus)

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

type LastError

type LastError struct {
	// Description of the error
	Description string `json:"description,omitempty"`

	// Time at which the error occurred
	LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"`

	// LastOperation is the type of operation for which error occurred
	LastOperation string `json:"lastOperation,omitempty"`
}

LastError has detailed information of the error

func (*LastError) DeepCopy

func (in *LastError) DeepCopy() *LastError

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

func (*LastError) DeepCopyInto

func (in *LastError) DeepCopyInto(out *LastError)

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

type MaintenanceTimeWindow

type MaintenanceTimeWindow struct {
	// Begin is the beginning of the time window in the format HHMMSS+ZONE, e.g. "220000+0100".
	Begin string `json:"begin"`
	// End is the end of the time window in the format HHMMSS+ZONE, e.g. "220000+0100".
	End string `json:"end"`
}

MaintenanceTimeWindow contains information about the time window for maintenance operations.

func (*MaintenanceTimeWindow) DeepCopy

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

func (*MaintenanceTimeWindow) DeepCopyInto

func (in *MaintenanceTimeWindow) DeepCopyInto(out *MaintenanceTimeWindow)

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

type ScaleParams

type ScaleParams struct {
	// Scale parameters for CPU
	CPU ChangeParams `json:"cpu,omitempty"`
	// Scale parameters for memory
	Memory ChangeParams `json:"memory,omitempty"`
	// Scale patameters for replicas
	Replicas ChangeParams `json:"replicas,omitempty"`
}

ScaleParams defines the scaling parameters for the limits

func (*ScaleParams) DeepCopy

func (in *ScaleParams) DeepCopy() *ScaleParams

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

func (*ScaleParams) DeepCopyInto

func (in *ScaleParams) DeepCopyInto(out *ScaleParams)

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

type ScaleType

type ScaleType struct {
	// Describes the rules on when changes are applied.
	// If not specified, all fields in the `UpdatePolicy` are set to their
	// default values.
	// +optional
	UpdatePolicy UpdatePolicy `json:"updatePolicy,omitempty"`

	// MinChange is the minimum change in the resource on which HVPA acts
	// HVPA uses minimum of the Value and Percentage value
	MinChange ScaleParams `json:"minChange,omitempty"`

	// StabilizationDuration defines the minimum delay in minutes between 2 consecutive scale operations
	// Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h"
	StabilizationDuration *string `json:"stabilizationDuration,omitempty"`
}

ScaleType defines parameters for scaling

func (*ScaleType) DeepCopy

func (in *ScaleType) DeepCopy() *ScaleType

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

func (*ScaleType) DeepCopyInto

func (in *ScaleType) DeepCopyInto(out *ScaleType)

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

type ScalingStatus

type ScalingStatus struct {
	LastScaleTime *metav1.Time                        `json:"lastScaleTime,omitempty"`
	HpaStatus     HpaStatus                           `json:"hpaStatus,omitempty" protobuf:"bytes,1,opt,name=hpaStatus"`
	VpaStatus     vpa_api.VerticalPodAutoscalerStatus `json:"vpaStatus,omitempty" protobuf:"bytes,2,opt,name=vpaStatus"`
}

ScalingStatus defines the status of scaling

func (*ScalingStatus) DeepCopy

func (in *ScalingStatus) DeepCopy() *ScalingStatus

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

func (*ScalingStatus) DeepCopyInto

func (in *ScalingStatus) DeepCopyInto(out *ScalingStatus)

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

type UpdatePolicy

type UpdatePolicy struct {
	// Controls when autoscaler applies changes to the resources.
	// The default is 'Auto'.
	// +optional
	UpdateMode *string `json:"updateMode,omitempty" protobuf:"bytes,1,opt,name=updateMode"`
}

UpdatePolicy describes the rules on how changes are applied.

func (*UpdatePolicy) DeepCopy

func (in *UpdatePolicy) DeepCopy() *UpdatePolicy

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

func (*UpdatePolicy) DeepCopyInto

func (in *UpdatePolicy) DeepCopyInto(out *UpdatePolicy)

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

type VpaSpec

type VpaSpec struct {
	// Selector is a label query that should match VPA.
	// Must match in order to be controlled.
	// If empty, defaulted to labels on VPA template.
	// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
	// +optional
	Selector *metav1.LabelSelector `json:"selector,omitempty"`

	// Deploy defines whether the VPA is deployed or not
	Deploy bool `json:"deploy,omitempty"`

	// ScaleUp defines the parameters for scale up
	ScaleUp ScaleType `json:"scaleUp,omitempty"`

	// ScaleDown defines the parameters for scale down
	ScaleDown ScaleType `json:"scaleDown,omitempty"`

	// Template is the object that describes the VPA that will be created.
	// +optional
	Template VpaTemplate `json:"template,omitempty"`

	// LimitsRequestsGapScaleParams is the scaling thresholds for limits
	LimitsRequestsGapScaleParams ScaleParams `json:"limitsRequestsGapScaleParams,omitempty"`
}

VpaSpec defines spec for VPA

func (*VpaSpec) DeepCopy

func (in *VpaSpec) DeepCopy() *VpaSpec

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

func (*VpaSpec) DeepCopyInto

func (in *VpaSpec) DeepCopyInto(out *VpaSpec)

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

type VpaTemplate

type VpaTemplate struct {
	// Metadata of the pods created from this template.
	// +kubebuilder:validation:XPreserveUnknownFields
	// +optional
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// Spec defines the behavior of a VPA.
	// +optional
	Spec VpaTemplateSpec `json:"spec,omitempty"`
}

VpaTemplate defines the template for VPA

func (*VpaTemplate) DeepCopy

func (in *VpaTemplate) DeepCopy() *VpaTemplate

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

func (*VpaTemplate) DeepCopyInto

func (in *VpaTemplate) DeepCopyInto(out *VpaTemplate)

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

type VpaTemplateSpec

type VpaTemplateSpec struct {
	// Controls how the autoscaler computes recommended resources.
	// The resource policy may be used to set constraints on the recommendations
	// for individual containers. If not specified, the autoscaler computes recommended
	// resources for all containers in the pod, without additional constraints.
	// +optional
	ResourcePolicy *vpa_api.PodResourcePolicy `json:"resourcePolicy,omitempty" protobuf:"bytes,2,opt,name=resourcePolicy"`
}

VpaTemplateSpec defines the spec for VPA

func (*VpaTemplateSpec) DeepCopy

func (in *VpaTemplateSpec) DeepCopy() *VpaTemplateSpec

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

func (*VpaTemplateSpec) DeepCopyInto

func (in *VpaTemplateSpec) DeepCopyInto(out *VpaTemplateSpec)

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

type WeightBasedScalingInterval

type WeightBasedScalingInterval struct {
	// VpaWeight defines the weight (in percentage) to be given to VPA's recommendationd for the interval of number of replicas provided
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:validation:Maximum=100
	VpaWeight int32 `json:"vpaWeight,omitempty"`
	// StartReplicaCount is the number of replicas from which VpaWeight is applied to VPA scaling
	// If this field is not provided, it will default to minReplicas of HPA
	// +optional
	StartReplicaCount int32 `json:"startReplicaCount,omitempty"`
	// LastReplicaCount is the number of replicas till which VpaWeight is applied to VPA scaling
	// If this field is not provided, it will default to maxReplicas of HPA
	// +optional
	LastReplicaCount int32 `json:"lastReplicaCount,omitempty"`
}

WeightBasedScalingInterval defines the interval of replica counts in which VpaWeight is applied to VPA scaling

func (*WeightBasedScalingInterval) DeepCopy

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

func (*WeightBasedScalingInterval) 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