Skip to content

Commit

Permalink
support AutoscalingTypeOff in AutoscalingPolicy (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanposhiho authored Oct 4, 2023
1 parent 076f925 commit 92523fd
Show file tree
Hide file tree
Showing 11 changed files with 1,132 additions and 86 deletions.
8 changes: 5 additions & 3 deletions api/v1beta1/tortoise_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ type ContainerResourcePolicy struct {
// AutoscalingPolicy specifies how each resource is scaled.
// If "Horizontal", the resource is horizontally scaled.
// If "Vertical", the resource is vertically scaled.
// Now, at least one container in Pod should be Horizontal.
// If "Off", tortoise doesn't scale at all based on that resource.
// At least one container in Pod should be Horizontal.
//
// The default value is "Horizontal" for cpu, and "Vertical" for memory.
// +optional
Expand All @@ -104,10 +105,11 @@ const (
AutoUpdateMode UpdateMode = "Auto"
)

// +kubebuilder:validation:Enum=Horizontal;Vertical
// +kubebuilder:validation:Enum=Off;Horizontal;Vertical
type AutoscalingType string

const (
AutoscalingTypeOff AutoscalingType = "Off"
AutoscalingTypeHorizontal AutoscalingType = "Horizontal"
AutoscalingTypeVertical AutoscalingType = "Vertical"
)
Expand Down Expand Up @@ -290,7 +292,7 @@ type TortoiseCondition struct {
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 among certain period (1 week).
// 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 latest recommendation value from VPA.
Expand Down
24 changes: 24 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions config/crd/bases/autoscaling.mercari.com_tortoises.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -404,14 +404,16 @@ spec:
autoscalingPolicy:
additionalProperties:
enum:
- "Off"
- Horizontal
- Vertical
type: string
description: "AutoscalingPolicy specifies how each resource
is scaled. If \"Horizontal\", the resource is horizontally
scaled. If \"Vertical\", the resource is vertically scaled.
Now, at least one container in Pod should be Horizontal. \n
The default value is \"Horizontal\" for cpu, and \"Vertical\"
If \"Off\", tortoise doesn't scale at all based on that resource.
At least one container in Pod should be Horizontal. \n The
default value is \"Horizontal\" for cpu, and \"Vertical\"
for memory."
type: object
containerName:
Expand Down Expand Up @@ -522,7 +524,7 @@ spec:
type: string
type: object
description: MaxRecommendation is the max recommendation
value from VPA among certain period (1 week). Tortoise
value from VPA in a certain period (1 week). Tortoise
generates all recommendation based on this MaxRecommendation.
type: object
recommendation:
Expand Down
Loading

0 comments on commit 92523fd

Please sign in to comment.