v1beta3

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package v1beta3 contains API Schema definitions for the autoscaling v1beta3 API group +kubebuilder:object:generate=true +groupName=autoscaling.mercari.com

Index

Constants

View Source
const TortoiseDefaultHPANamePrefix = "tortoise-hpa-"
View Source
const (
	VerticalPodAutoscalerRoleMonitor = "Monitor"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "autoscaling.mercari.com", Version: "v1beta3"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)
View Source
var ClientService *service

Functions

func TortoiseDefaultHPAName

func TortoiseDefaultHPAName(tortoiseName string) string

Types

type AutoscalingType

type AutoscalingType string

+kubebuilder:validation:Enum=Off;Horizontal;Vertical

const (
	AutoscalingTypeOff        AutoscalingType = "Off"
	AutoscalingTypeHorizontal AutoscalingType = "Horizontal"
	AutoscalingTypeVertical   AutoscalingType = "Vertical"
)

type Conditions

type Conditions struct {
	// TortoiseConditions is the condition of this tortoise.
	// +patchMergeKey=type
	// +patchStrategy=merge
	// +listType=map
	// +listMapKey=type
	// +optional
	TortoiseConditions []TortoiseCondition `json:"tortoiseConditions" protobuf:"bytes,1,name=tortoiseConditions"`
	// ContainerRecommendationFromVPA is the condition of container recommendation from VPA, which is observed last time.
	// +optional
	ContainerRecommendationFromVPA []ContainerRecommendationFromVPA `json:"containerRecommendationFromVPA,omitempty" protobuf:"bytes,2,opt,name=containerRecommendationFromVPA"`
	// ContainerResourceRequests has the ideal resource request for each container.
	// If the mode is Off, it should be the same value as the current resource request.
	// If the mode is Auto, it would basically be the same value as the recommendation.
	// (Tortoise sometimes doesn't immediately apply the recommendation value to the resource request for the sake of safety.)
	// +optional
	ContainerResourceRequests []ContainerResourceRequests `json:"containerResourceRequests,omitempty" protobuf:"bytes,3,opt,name=containerResourceRequests"`
}

func (*Conditions) DeepCopy

func (in *Conditions) DeepCopy() *Conditions

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

func (*Conditions) DeepCopyInto

func (in *Conditions) DeepCopyInto(out *Conditions)

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

type ContainerAutoscalingPolicy

type ContainerAutoscalingPolicy struct {
	// ContainerName is the name of target container.
	ContainerName string `json:"containerName" protobuf:"bytes,1,name=containerName"`
	// Policy specifies how each resource is scaled.
	// See .spec.AutoscalingPolicy for more defail.
	Policy map[v1.ResourceName]AutoscalingType `json:"policy,omitempty" protobuf:"bytes,2,opt,name=policy"`
}

func (*ContainerAutoscalingPolicy) DeepCopy

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

func (*ContainerAutoscalingPolicy) DeepCopyInto

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

type ContainerRecommendationFromVPA

type ContainerRecommendationFromVPA struct {
	// ContainerName is the name of target container.
	ContainerName string `json:"containerName" protobuf:"bytes,1,name=containerName"`
	// MaxRecommendation is the max recommendation value from VPA in a certain period (1 week).
	// Tortoise generates all recommendation based on this MaxRecommendation.
	MaxRecommendation map[v1.ResourceName]ResourceQuantity `json:"maxRecommendation" protobuf:"bytes,2,name=maxRecommendation"`
	// Recommendation is the recommendation value from VPA that the tortoise controller observed in the last reconciliation..
	Recommendation map[v1.ResourceName]ResourceQuantity `json:"recommendation" protobuf:"bytes,3,name=recommendation"`
}

func (*ContainerRecommendationFromVPA) DeepCopy

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

func (*ContainerRecommendationFromVPA) DeepCopyInto

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

type ContainerResourcePhase

type ContainerResourcePhase string
const (
	ContainerResourcePhaseGatheringData ContainerResourcePhase = "GatheringData"
	ContainerResourcePhaseWorking       ContainerResourcePhase = "Working"
	ContainerResourcePhaseOff           ContainerResourcePhase = "Off"
)

type ContainerResourcePhases

type ContainerResourcePhases struct {
	// ContainerName is the name of target container.
	ContainerName string `json:"containerName" protobuf:"bytes,1,name=containerName"`
	// ResourcePhases is the phase of each resource of this container.
	ResourcePhases map[v1.ResourceName]ResourcePhase `json:"resourcePhases" protobuf:"bytes,2,name=resourcePhases"`
}

func (*ContainerResourcePhases) DeepCopy

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

func (*ContainerResourcePhases) DeepCopyInto

func (in *ContainerResourcePhases) DeepCopyInto(out *ContainerResourcePhases)

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

type ContainerResourcePolicy

type ContainerResourcePolicy struct {
	// ContainerName is the name of target container.
	ContainerName string `json:"containerName" protobuf:"bytes,1,name=containerName"`
	// MinAllocatedResources is the minimum amount of resources which is given to the container.
	// Tortoise never set the resources request on the container less than MinAllocatedResources.
	// If nil, Tortoise uses the cluster wide default value, which can be configured via the admin config.
	//
	// If empty, tortoise may reduce the resource request to the value which is suggested from VPA.
	// Given the VPA suggests values based on the historical resource usage,
	// you have no choice but to use MinAllocatedResources to pre-scaling your Pods,
	// for example, when maybe your application change will result in consuming resources more than the past.
	// +optional
	MinAllocatedResources v1.ResourceList `json:"minAllocatedResources,omitempty" protobuf:"bytes,2,opt,name=minAllocatedResources"`

	// MaxAllocatedResources is the maximum amount of resources which is given to the container.
	// Tortoise never set the resources request on the container more than MaxAllocatedResources.
	// If nil, Tortoise uses the cluster wide default value, which can be configured via the admin config.
	// +optional
	MaxAllocatedResources v1.ResourceList `json:"maxAllocatedResources,omitempty" protobuf:"bytes,3,opt,name=maxAllocatedResources"`
}

func (*ContainerResourcePolicy) DeepCopy

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

func (*ContainerResourcePolicy) DeepCopyInto

func (in *ContainerResourcePolicy) DeepCopyInto(out *ContainerResourcePolicy)

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

type ContainerResourceRequests added in v0.2.8

type ContainerResourceRequests struct {
	// ContainerName is the name of target container.
	ContainerName string          `json:"containerName" protobuf:"bytes,1,name=containerName"`
	Resource      v1.ResourceList `json:"resource" protobuf:"bytes,2,name=resource"`
}

func (*ContainerResourceRequests) DeepCopy added in v0.2.8

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

func (*ContainerResourceRequests) DeepCopyInto added in v0.2.8

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

type CrossVersionObjectReference

type CrossVersionObjectReference struct {
	// kind is the kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
	Kind string `json:"kind" protobuf:"bytes,1,opt,name=kind"`

	// name is the name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
	Name string `json:"name" protobuf:"bytes,2,opt,name=name"`

	// apiVersion is the API version of the referent
	// +optional
	APIVersion string `json:"apiVersion,omitempty" protobuf:"bytes,3,opt,name=apiVersion"`
}

CrossVersionObjectReference contains enough information toet identify the referred resource.

func (*CrossVersionObjectReference) DeepCopy

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

func (*CrossVersionObjectReference) DeepCopyInto

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

type DeletionPolicy

type DeletionPolicy string

+kubebuilder:validation:Enum=DeleteAll;NoDelete

const (
	DeletionPolicyDeleteAll DeletionPolicy = "DeleteAll"
	DeletionPolicyNoDelete  DeletionPolicy = "NoDelete"
)

type HPATargetUtilizationRecommendationPerContainer

type HPATargetUtilizationRecommendationPerContainer struct {
	// ContainerName is the name of target container.
	ContainerName string `json:"containerName" protobuf:"bytes,1,name=containerName"`
	// TargetUtilization is the recommendation of targetUtilization of HPA.
	TargetUtilization map[v1.ResourceName]int32 `json:"targetUtilization" protobuf:"bytes,2,name=targetUtilization"`
}

func (*HPATargetUtilizationRecommendationPerContainer) DeepCopy

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

func (*HPATargetUtilizationRecommendationPerContainer) DeepCopyInto

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

type HorizontalRecommendations

type HorizontalRecommendations struct {
	// +optional
	TargetUtilizations []HPATargetUtilizationRecommendationPerContainer `json:"targetUtilizations,omitempty" protobuf:"bytes,1,opt,name=targetUtilizations"`
	// MaxReplicas has the recommendation of maxReplicas.
	// It contains the recommendations for each time slot.
	// +optional
	MaxReplicas []ReplicasRecommendation `json:"maxReplicas,omitempty" protobuf:"bytes,2,opt,name=maxReplicas"`
	// MinReplicas has the recommendation of minReplicas.
	// It contains the recommendations for each time slot.
	// +optional
	MinReplicas []ReplicasRecommendation `json:"minReplicas,omitempty" protobuf:"bytes,3,opt,name=minReplicas"`
}

func (*HorizontalRecommendations) DeepCopy

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

func (*HorizontalRecommendations) DeepCopyInto

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

type Recommendations

type Recommendations struct {
	// +optional
	Horizontal HorizontalRecommendations `json:"horizontal,omitempty" protobuf:"bytes,1,opt,name=horizontal"`
	// +optional
	Vertical VerticalRecommendations `json:"vertical,omitempty" protobuf:"bytes,2,opt,name=vertical"`
}

func (*Recommendations) DeepCopy

func (in *Recommendations) DeepCopy() *Recommendations

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

func (*Recommendations) DeepCopyInto

func (in *Recommendations) DeepCopyInto(out *Recommendations)

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

type RecommendedContainerResources

type RecommendedContainerResources struct {
	// ContainerName is the name of target container.
	ContainerName string `json:"containerName" protobuf:"bytes,1,name=containerName"`
	// RecommendedResource is the recommendation calculated by the tortoise.
	//
	// If AutoscalingPolicy is vertical, it's the same value as the VPA suggests.
	// If AutoscalingPolicy is horizontal, it's basically the same value as the current resource request.
	// But, when the number of replicas are too small or too large,
	// tortoise may try to increase/decrease the amount of resources given to the container,
	// so that the number of replicas won't be very small or very large.
	RecommendedResource v1.ResourceList `json:"RecommendedResource" protobuf:"bytes,2,name=recommendedResource"`
}

func (*RecommendedContainerResources) DeepCopy

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

func (*RecommendedContainerResources) DeepCopyInto

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

type ReplicasRecommendation

type ReplicasRecommendation struct {
	// From represented in hour.
	From int `json:"from" protobuf:"variant,1,name=from"`
	// To represented in hour.
	To int `json:"to" protobuf:"variant,2,name=to"`
	// WeekDay is the day of the week.
	// If empty, it means it applies to all days of the week.
	WeekDay  *string `json:"weekday,omitempty" protobuf:"bytes,3,opt,name=weekday"`
	TimeZone string  `json:"timezone" protobuf:"bytes,4,name=timezone"`
	// Value is the recommendation value.
	// It's calculated every reconciliation,
	// and updated if the calculated recommendation value is more than the current recommendation value on tortoise.
	Value int32 `json:"value" protobuf:"variant,5,name=value"`
	// +optional
	UpdatedAt metav1.Time `json:"updatedAt,omitempty" protobuf:"bytes,6,opt,name=updatedAt"`
}

func (*ReplicasRecommendation) DeepCopy

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

func (*ReplicasRecommendation) DeepCopyInto

func (in *ReplicasRecommendation) DeepCopyInto(out *ReplicasRecommendation)

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

type ResourcePhase

type ResourcePhase struct {
	Phase ContainerResourcePhase `json:"phase" protobuf:"bytes,1,name=phase"`
	// lastTransitionTime is the last time the condition transitioned from
	// one status to another
	// +optional
	LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,2,opt,name=lastTransitionTime"`
}

func (*ResourcePhase) DeepCopy

func (in *ResourcePhase) DeepCopy() *ResourcePhase

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

func (*ResourcePhase) DeepCopyInto

func (in *ResourcePhase) DeepCopyInto(out *ResourcePhase)

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

type ResourceQuantity

type ResourceQuantity struct {
	// +optional
	Quantity resource.Quantity `json:"quantity,omitempty" protobuf:"bytes,1,opt,name=quantity"`
	// +optional
	UpdatedAt metav1.Time `json:"updatedAt,omitempty" protobuf:"bytes,2,opt,name=updatedAt"`
}

func (*ResourceQuantity) DeepCopy

func (in *ResourceQuantity) DeepCopy() *ResourceQuantity

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

func (*ResourceQuantity) DeepCopyInto

func (in *ResourceQuantity) DeepCopyInto(out *ResourceQuantity)

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

type TargetRefs

type TargetRefs struct {
	// ScaleTargetRef is the target of scaling.
	// It should be the same as the target of HPA.
	ScaleTargetRef CrossVersionObjectReference `json:"scaleTargetRef" protobuf:"bytes,1,name=scaleTargetRef"`
	// HorizontalPodAutoscalerName is the name of the target HPA.
	// You can specify existing HPA only, otherwise Tortoise errors out.
	//
	// The target of this HPA should be the same as the ScaleTargetRef above.
	// The target HPA should have the ContainerResource type metric that refers to the container resource utilization.
	// If HPA has Resource type metrics,
	// Tortoise just removes them because they'd be conflict with ContainerResource type metrics managed by Tortoise.
	// If HPA has metrics other than Resource or ContainerResource, Tortoise just keeps them unless the administrator uses the HPAExternalMetricExclusionRegex feature.
	// HPAExternalMetricExclusionRegex feature: https://github.com/mercari/tortoise/blob/main/docs/admin-guide.md#hpaexternalmetricexclusionregex
	//
	// Please check out the document for more detail: https://github.com/mercari/tortoise/blob/master/docs/horizontal.md#attach-your-hpa
	//
	// Also, if your Tortoise is in the Auto mode, you should not edit the target resource utilization in HPA directly.
	// Even if you edit your HPA in that case, tortoise will overwrite the HPA with the metrics/values.
	//
	// You may also want to see the document in .spec.autoscalingPolicy to understand how tortoise with this field decides the autoscaling policy.
	//
	// This is an optional field, and if you don't specify this field, tortoise will create a new default HPA named `tortoise-hpa-{tortoise name}`.
	// +optional
	HorizontalPodAutoscalerName *string `json:"horizontalPodAutoscalerName,omitempty" protobuf:"bytes,2,opt,name=horizontalPodAutoscalerName"`
}

func (*TargetRefs) DeepCopy

func (in *TargetRefs) DeepCopy() *TargetRefs

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

func (*TargetRefs) DeepCopyInto

func (in *TargetRefs) DeepCopyInto(out *TargetRefs)

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

type TargetStatusVerticalPodAutoscaler

type TargetStatusVerticalPodAutoscaler struct {
	Name string                    `json:"name" protobuf:"bytes,1,name=name"`
	Role VerticalPodAutoscalerRole `json:"role" protobuf:"bytes,2,name=role"`
}

func (*TargetStatusVerticalPodAutoscaler) DeepCopy

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

func (*TargetStatusVerticalPodAutoscaler) DeepCopyInto

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

type TargetsStatus

type TargetsStatus struct {
	// +optional
	HorizontalPodAutoscaler string                              `json:"horizontalPodAutoscaler" protobuf:"bytes,1,opt,name=horizontalPodAutoscaler"`
	ScaleTargetRef          CrossVersionObjectReference         `json:"scaleTargetRef" protobuf:"bytes,2,name=scaleTargetRef"`
	VerticalPodAutoscalers  []TargetStatusVerticalPodAutoscaler `json:"verticalPodAutoscalers" protobuf:"bytes,3,name=verticalPodAutoscalers"`
}

func (*TargetsStatus) DeepCopy

func (in *TargetsStatus) DeepCopy() *TargetsStatus

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

func (*TargetsStatus) DeepCopyInto

func (in *TargetsStatus) DeepCopyInto(out *TargetsStatus)

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

type Tortoise

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

	Spec   TortoiseSpec   `json:"spec,omitempty"`
	Status TortoiseStatus `json:"status,omitempty"`
}

Tortoise is the Schema for the tortoises API

func (*Tortoise) DeepCopy

func (in *Tortoise) DeepCopy() *Tortoise

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

func (*Tortoise) DeepCopyInto

func (in *Tortoise) DeepCopyInto(out *Tortoise)

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

func (*Tortoise) DeepCopyObject

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

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

func (*Tortoise) Default

func (r *Tortoise) Default()

Default implements webhook.Defaulter so a webhook will be registered for the type

func (*Tortoise) Hub

func (*Tortoise) Hub()

Hub marks this type as a conversion hub.

func (*Tortoise) SetupWebhookWithManager

func (r *Tortoise) SetupWebhookWithManager(mgr ctrl.Manager) error

func (*Tortoise) ValidateCreate

func (r *Tortoise) ValidateCreate() (admission.Warnings, error)

ValidateCreate implements webhook.Validator so a webhook will be registered for the type

func (*Tortoise) ValidateDelete

func (r *Tortoise) ValidateDelete() (admission.Warnings, error)

ValidateDelete implements webhook.Validator so a webhook will be registered for the type TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.

func (*Tortoise) ValidateUpdate

func (r *Tortoise) ValidateUpdate(old runtime.Object) (admission.Warnings, error)

ValidateUpdate implements webhook.Validator so a webhook will be registered for the type

type TortoiseCondition

type TortoiseCondition struct {
	// Type is the type of the condition.
	Type TortoiseConditionType `json:"type" protobuf:"bytes,1,name=type"`
	// Status is the status of the condition. (True, False, Unknown)
	Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,name=status"`
	// The last time this condition was updated.
	LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty" protobuf:"bytes,6,opt,name=lastUpdateTime"`
	// lastTransitionTime is the last time the condition transitioned from
	// one status to another
	// +optional
	LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"`
	// reason is the reason for the condition's last transition.
	// +optional
	Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
	// message is a human-readable explanation containing details about
	// the transition
	// +optional
	Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
}

func (*TortoiseCondition) DeepCopy

func (in *TortoiseCondition) DeepCopy() *TortoiseCondition

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

func (*TortoiseCondition) DeepCopyInto

func (in *TortoiseCondition) DeepCopyInto(out *TortoiseCondition)

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

type TortoiseConditionType

type TortoiseConditionType string

TortoiseConditionType are the valid conditions of a Tortoise.

const (
	// TortoiseConditionTypeFailedToReconcile means tortoise failed to reconcile due to some reasons.
	TortoiseConditionTypeFailedToReconcile                   TortoiseConditionType = "FailedToReconcile"
	TortoiseConditionTypeHPATargetUtilizationUpdated         TortoiseConditionType = "HPATargetUtilizationUpdated"
	TortoiseConditionTypeVerticalRecommendationUpdated       TortoiseConditionType = "VerticalRecommendationUpdated"
	TortoiseConditionTypeScaledUpBasedOnPreferredMaxReplicas TortoiseConditionType = "ScaledUpBasedOnPreferredMaxReplicas"
)

type TortoiseList

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

TortoiseList contains a list of Tortoise

func (*TortoiseList) DeepCopy

func (in *TortoiseList) DeepCopy() *TortoiseList

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

func (*TortoiseList) DeepCopyInto

func (in *TortoiseList) DeepCopyInto(out *TortoiseList)

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

func (*TortoiseList) DeepCopyObject

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

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

type TortoisePhase

type TortoisePhase string
const (
	// TortoisePhaseInitializing means tortoise is just created and initializing some components (HPA and VPA),
	// and wait for those components to be ready.
	// Possible flow: (none) → Initializing
	TortoisePhaseInitializing TortoisePhase = "Initializing"
	// TortoisePhaseGatheringData means tortoise is now gathering data for MinReplicas/MaxReplicas
	// and cannot make the accurate recommendations.
	// Possible flow: Initializing → GatheringData
	TortoisePhaseGatheringData TortoisePhase = "GatheringData"
	// TortoisePhaseWorking means tortoise is making the recommendations,
	// and applying the recommendation values.
	// Possible flow:
	//  - GatheringData → Working (when all the data is ready)
	//  - PartlyWorking → Working (when all the data is ready)
	//  - BackToNormal → Working (minReplica goes back to the normal number)
	TortoisePhaseWorking TortoisePhase = "Working"
	// TortoisePhasePartlyWorking means tortoise has maxReplicas and minReplicas recommendations ready,
	// and applying the recommendation values.
	// But, some of the resources are not scaled due to some reasons. (probably still gathering data)
	// Possible flow:
	//  - GatheringData → PartlyWorking (only some of resources are ready)
	//  - Working → PartlyWorking (autoscaling policy is changed)
	TortoisePhasePartlyWorking TortoisePhase = "PartlyWorking"
	// TortoisePhaseEmergency means tortoise is in the emergency mode.
	//
	// Possible flow:
	//  - Working → Emergency
	TortoisePhaseEmergency TortoisePhase = "Emergency"
	// TortoisePhaseBackToNormal means tortoise was in the emergency mode, and now it's coming back to the normal operation.
	// During TortoisePhaseBackToNormal, the number of replicas of workloads are gradually reduced to the usual value.
	//  - Emergency → BackToNormal
	TortoisePhaseBackToNormal TortoisePhase = "BackToNormal"
)

type TortoiseSpec

type TortoiseSpec struct {
	// TargetRefs has reference to involved resources.
	TargetRefs TargetRefs `json:"targetRefs" protobuf:"bytes,1,name=targetRefs"`
	// UpdateMode is how tortoise update resources.
	// If "Off", tortoise generates the recommendations in .Status, but doesn't apply it actually.
	// If "Auto", tortoise generates the recommendations in .Status, and apply it to resources.
	// If "Emergency", tortoise generates the recommendations in .Status as usual, but increase replica number high enough value.
	// "Emergency" is useful when something unexpected happens in workloads, and you want to scale up the workload with high enough resources.
	// See https://github.com/mercari/tortoise/blob/main/docs/emergency.md to know more about emergency mode.
	//
	// "Off" is the default value.
	// +optional
	UpdateMode UpdateMode `json:"updateMode,omitempty" protobuf:"bytes,2,opt,name=updateMode"`
	// ResourcePolicy contains the policy how each resource is updated.
	// +optional
	ResourcePolicy []ContainerResourcePolicy `json:"resourcePolicy,omitempty" protobuf:"bytes,3,opt,name=resourcePolicy"`
	// DeletionPolicy is the policy how the controller deletes associated HPA and VPA when tortoise is removed.
	// If "DeleteAll", tortoise deletes all associated HPA and VPA, created by tortoise. If the associated HPA is not created by tortoise,
	// which is associated by spec.targetRefs.horizontalPodAutoscalerName, tortoise never delete the HPA.
	// If "NoDelete", tortoise doesn't delete any associated HPA and VPA.
	//
	// "NoDelete" is the default value.
	// +optional
	DeletionPolicy DeletionPolicy `json:"deletionPolicy,omitempty" protobuf:"bytes,4,opt,name=deletionPolicy"`
	// AutoscalingPolicy is an optional field for specifying the scaling approach for each resource within each container.
	//
	// There are two primary options for configuring resource scaling within containers:
	// 1. Allow Tortoise to automatically determine the appropriate autoscaling policy for each resource.
	// 2. Manually define the autoscaling policy for each resource.
	//
	// For the first option, simply leave this field unset. In this case, Tortoise will adjust the autoscaling policies using the following rules:
	// - If .spec.TargetRefs.HorizontalPodAutoscalerName is not provided, the policies default to "Horizontal" for CPU and "Vertical" for memory across all containers.
	// - If .spec.TargetRefs.HorizontalPodAutoscalerName is specified, resources governed by the referenced Horizontal Pod Autoscaler will use a "Horizontal" policy,
	//   while those not managed by the HPA will use a "Vertical" policy.
	//   Note that Tortoise supports only the ContainerResource metric type for HPAs; other metric types will be disregarded.
	//   Additionally, if a ContainerResource metric is later added to an HPA associated with Tortoise,
	//   Tortoise will automatically update relevant resources to utilize a "Horizontal" policy.
	// - if a container doesn't have the resource request, that container's autoscaling policy is always set to "Off"
	//   because tortoise cannot generate any recommendation without the resource request.
	//
	// With the second option, you must manually specify the AutoscalingPolicy for the resources of each container within this field.
	// If policies are defined for some but not all containers or resources, Tortoise will assign a default "Off" policy to unspecified resources.
	// Be aware that when new containers are introduced to the workload, the AutoscalingPolicy configuration must be manually updated,
	// as Tortoise will default to an "Off" policy for resources within the new container, preventing scaling.
	//
	// The AutoscalingPolicy field is mutable; you can modify it at any time, whether from an empty state to populated or vice versa.
	// +optional
	AutoscalingPolicy []ContainerAutoscalingPolicy `json:"autoscalingPolicy,omitempty" protobuf:"bytes,5,opt,name=autoscalingPolicy"`
	// MaxReplicas is the maximum number of MaxReplicas that Tortoise will give to HPA.
	// If nil, Tortoise uses the cluster wide default value, which can be configured via the admin config.
	// +optional
	MaxReplicas *int32 `json:"maxReplicas,omitempty" protobuf:"bytes,6,opt,name=maxReplicas"`
}

TortoiseSpec defines the desired state of Tortoise

func (*TortoiseSpec) DeepCopy

func (in *TortoiseSpec) DeepCopy() *TortoiseSpec

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

func (*TortoiseSpec) DeepCopyInto

func (in *TortoiseSpec) DeepCopyInto(out *TortoiseSpec)

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

type TortoiseStatus

type TortoiseStatus struct {
	TortoisePhase           TortoisePhase             `json:"tortoisePhase" protobuf:"bytes,1,name=tortoisePhase"`
	Conditions              Conditions                `json:"conditions" protobuf:"bytes,2,name=conditions"`
	Recommendations         Recommendations           `json:"recommendations" protobuf:"bytes,3,name=recommendations"`
	Targets                 TargetsStatus             `json:"targets" protobuf:"bytes,4,name=targets"`
	ContainerResourcePhases []ContainerResourcePhases `json:"containerResourcePhases" protobuf:"bytes,5,name=containerResourcePhases"`
	// AutoscalingPolicy contains the policy how this tortoise actually scales each resource.
	// It should basically be the same as .spec.autoscalingPolicy.
	// But, if .spec.autoscalingPolicy is empty, tortoise manages/generates
	// the policies generated based on HPA and the target deployment.
	AutoscalingPolicy []ContainerAutoscalingPolicy `json:"autoscalingPolicy,omitempty" protobuf:"bytes,6,opt,name=autoscalingPolicy"`
}

TortoiseStatus defines the observed state of Tortoise

func (*TortoiseStatus) DeepCopy

func (in *TortoiseStatus) DeepCopy() *TortoiseStatus

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

func (*TortoiseStatus) DeepCopyInto

func (in *TortoiseStatus) DeepCopyInto(out *TortoiseStatus)

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

type UpdateMode

type UpdateMode string

+kubebuilder:validation:Enum=Off;Auto;Emergency

const (
	UpdateModeOff       UpdateMode = "Off"
	UpdateModeEmergency UpdateMode = "Emergency"
	UpdateModeAuto      UpdateMode = "Auto"
)

type VerticalPodAutoscalerRole

type VerticalPodAutoscalerRole string

+kubebuilder:validation:Enum=Updater;Monitor

type VerticalRecommendations

type VerticalRecommendations struct {
	// ContainerResourceRecommendation has the recommendation of container resource request.
	// +optional
	ContainerResourceRecommendation []RecommendedContainerResources `json:"containerResourceRecommendation" protobuf:"bytes,1,opt,name=containerResourceRecommendation"`
}

func (*VerticalRecommendations) DeepCopy

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

func (*VerticalRecommendations) DeepCopyInto

func (in *VerticalRecommendations) DeepCopyInto(out *VerticalRecommendations)

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