Skip to content

Commit

Permalink
Add scaleUp & scaleDown diffPercentage fields to autoscaler (#1092)
Browse files Browse the repository at this point in the history
Signed-off-by: Arnob kumar saha <arnob@appscode.com>
  • Loading branch information
ArnobKumarSaha authored Dec 26, 2023
1 parent 0922ff1 commit 750f638
Show file tree
Hide file tree
Showing 30 changed files with 248 additions and 110 deletions.
2 changes: 1 addition & 1 deletion apis/autoscaling/v1alpha1/elasticsearch_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ type ElasticsearchAutoscalerSpec struct {

type ElasticsearchComputeAutoscalerSpec struct {
// +optional
NodeTopologyRef *core.LocalObjectReference `json:"nodeTopologyRef,omitempty"`
NodeTopology *NodeTopology `json:"nodeTopology,omitempty"`

Node *ComputeAutoscalerSpec `json:"node,omitempty"`
Master *ComputeAutoscalerSpec `json:"master,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion apis/autoscaling/v1alpha1/mariadb_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ type MariaDBAutoscalerSpec struct {

type MariaDBComputeAutoscalerSpec struct {
// +optional
NodeTopologyRef *core.LocalObjectReference `json:"nodeTopologyRef,omitempty"`
NodeTopology *NodeTopology `json:"nodeTopology,omitempty"`

MariaDB *ComputeAutoscalerSpec `json:"mariadb,omitempty"`
}
Expand Down
2 changes: 1 addition & 1 deletion apis/autoscaling/v1alpha1/mongodb_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ type MongoDBAutoscalerSpec struct {

type MongoDBComputeAutoscalerSpec struct {
// +optional
NodeTopologyRef *core.LocalObjectReference `json:"nodeTopologyRef,omitempty"`
NodeTopology *NodeTopology `json:"nodeTopology,omitempty"`

Standalone *ComputeAutoscalerSpec `json:"standalone,omitempty"`
ReplicaSet *ComputeAutoscalerSpec `json:"replicaSet,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion apis/autoscaling/v1alpha1/mysql_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ type MySQLAutoscalerSpec struct {

type MySQLComputeAutoscalerSpec struct {
// +optional
NodeTopologyRef *core.LocalObjectReference `json:"nodeTopologyRef,omitempty"`
NodeTopology *NodeTopology `json:"nodeTopology,omitempty"`

MySQL *ComputeAutoscalerSpec `json:"mysql,omitempty"`
}
Expand Down
88 changes: 61 additions & 27 deletions apis/autoscaling/v1alpha1/openapi_generated.go

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

2 changes: 1 addition & 1 deletion apis/autoscaling/v1alpha1/perconaxtradb_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ type PerconaXtraDBAutoscalerSpec struct {

type PerconaXtraDBComputeAutoscalerSpec struct {
// +optional
NodeTopologyRef *core.LocalObjectReference `json:"nodeTopologyRef,omitempty"`
NodeTopology *NodeTopology `json:"nodeTopology,omitempty"`

PerconaXtraDB *ComputeAutoscalerSpec `json:"perconaxtradb,omitempty"`
}
Expand Down
2 changes: 1 addition & 1 deletion apis/autoscaling/v1alpha1/postgres_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ type PostgresAutoscalerSpec struct {

type PostgresComputeAutoscalerSpec struct {
// +optional
NodeTopologyRef *core.LocalObjectReference `json:"nodeTopologyRef,omitempty"`
NodeTopology *NodeTopology `json:"nodeTopology,omitempty"`

Postgres *ComputeAutoscalerSpec `json:"postgres,omitempty"`
}
Expand Down
2 changes: 1 addition & 1 deletion apis/autoscaling/v1alpha1/proxysql_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type ProxySQLAutoscalerSpec struct {

type ProxySQLComputeAutoscalerSpec struct {
// +optional
NodeTopologyRef *core.LocalObjectReference `json:"nodeTopologyRef,omitempty"`
NodeTopology *NodeTopology `json:"nodeTopology,omitempty"`

ProxySQL *ComputeAutoscalerSpec `json:"proxysql,omitempty"`
}
Expand Down
2 changes: 1 addition & 1 deletion apis/autoscaling/v1alpha1/redis_sentinel_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type RedisSentinelAutoscalerSpec struct {

type RedisSentinelComputeAutoscalerSpec struct {
// +optional
NodeTopologyRef *core.LocalObjectReference `json:"nodeTopologyRef,omitempty"`
NodeTopology *NodeTopology `json:"nodeTopology,omitempty"`

Sentinel *ComputeAutoscalerSpec `json:"sentinel,omitempty"`
}
Expand Down
2 changes: 1 addition & 1 deletion apis/autoscaling/v1alpha1/redis_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ type RedisAutoscalerSpec struct {

type RedisComputeAutoscalerSpec struct {
// +optional
NodeTopologyRef *core.LocalObjectReference `json:"nodeTopologyRef,omitempty"`
NodeTopology *NodeTopology `json:"nodeTopology,omitempty"`

Standalone *ComputeAutoscalerSpec `json:"standalone,omitempty"`
Cluster *ComputeAutoscalerSpec `json:"cluster,omitempty"`
Expand Down
15 changes: 15 additions & 0 deletions apis/autoscaling/v1alpha1/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@ import (
kmapi "kmodules.xyz/client-go/api/v1"
)

type NodeTopology struct {
// Name of the NodeTopology object
Name string `json:"name,omitempty"`
// ScaleUpDiffPercentage describes in which difference (between recommended resource and the capacity of the nodePool) the opsReq should be triggered while scaling up
// Defaults to 15
// +optional
// +kubebuilder:default=15
ScaleUpDiffPercentage *int32 `json:"scaleUpDiffPercentage"`
// ScaleDownDiffPercentage describes in which difference (between recommended resource and the capacity of the nodePool) the opsReq should be triggered while scaling down
// Defaults to 25
// +optional
// +kubebuilder:default=25
ScaleDownDiffPercentage *int32 `json:"scaleDownDiffPercentage"`
}

// ContainerControlledValues controls which resource value should be autoscaled.
// +kubebuilder:validation:Enum=RequestsAndLimits;RequestsOnly
type ContainerControlledValues string
Expand Down
Loading

0 comments on commit 750f638

Please sign in to comment.