Skip to content

Commit

Permalink
scale up based on PreferredMaxReplicas only once 30mins (#348)
Browse files Browse the repository at this point in the history
* scale up based on PreferredmaxReplicas only once 30mins

* modify tests

* add the test case
  • Loading branch information
sanposhiho authored Feb 23, 2024
1 parent 5b748c2 commit c0d7f0e
Show file tree
Hide file tree
Showing 28 changed files with 435 additions and 65 deletions.
5 changes: 3 additions & 2 deletions api/v1beta3/tortoise_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,9 @@ type TortoiseConditionType string

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

type TortoiseCondition struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,23 @@ status:
cpu: "4"
memory: 4Gi
tortoiseConditions:
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: the current number of replicas is not bigger than the preferred max
replica number
reason: ScaledUpBasedOnPreferredMaxReplicas
status: "False"
type: ScaledUpBasedOnPreferredMaxReplicas
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: HPA target utilization is updated
reason: HPATargetUtilizationUpdated
status: "True"
type: HPATargetUtilizationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
type: FailedToReconcile
containerResourcePhases:
- containerName: app
resourcePhases:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,23 @@ status:
cpu: "3"
memory: 3Gi
tortoiseConditions:
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: the current number of replicas is not bigger than the preferred max
replica number
reason: ScaledUpBasedOnPreferredMaxReplicas
status: "False"
type: ScaledUpBasedOnPreferredMaxReplicas
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: HPA target utilization is updated
reason: HPATargetUtilizationUpdated
status: "True"
type: HPATargetUtilizationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
type: FailedToReconcile
containerResourcePhases:
- containerName: app
resourcePhases:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ status:
resource:
cpu: "3"
memory: 3Gi
tortoiseConditions: null
tortoiseConditions:
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
type: FailedToReconcile
containerResourcePhases:
- containerName: app
resourcePhases:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ status:
resource:
cpu: "3"
memory: 3Gi
tortoiseConditions: null
tortoiseConditions:
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
type: FailedToReconcile
containerResourcePhases:
- containerName: app
resourcePhases:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,23 @@ status:
cpu: "4"
memory: 3Gi
tortoiseConditions:
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: the current number of replicas is not bigger than the preferred max
replica number
reason: ScaledUpBasedOnPreferredMaxReplicas
status: "False"
type: ScaledUpBasedOnPreferredMaxReplicas
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: HPA target utilization is updated
reason: HPATargetUtilizationUpdated
status: "True"
type: HPATargetUtilizationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
type: FailedToReconcile
containerResourcePhases:
- containerName: app
resourcePhases:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ status:
resource:
cpu: "4"
memory: 4Gi
tortoiseConditions: null
tortoiseConditions:
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
type: FailedToReconcile
containerResourcePhases:
- containerName: app
resourcePhases:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ status:
resource:
cpu: "3"
memory: 3Gi
tortoiseConditions: null
tortoiseConditions:
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
type: FailedToReconcile
containerResourcePhases:
- containerName: app
resourcePhases:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ status:
reason: HPATargetUtilizationUpdated
status: "True"
type: HPATargetUtilizationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
type: FailedToReconcile
containerResourcePhases:
- containerName: app
resourcePhases:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ status:
reason: HPATargetUtilizationUpdated
status: "True"
type: HPATargetUtilizationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
type: FailedToReconcile
containerResourcePhases:
- containerName: app
resourcePhases:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,23 @@ status:
cpu: "4"
memory: 4Gi
tortoiseConditions:
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: the current number of replicas is not bigger than the preferred max
replica number
reason: ScaledUpBasedOnPreferredMaxReplicas
status: "False"
type: ScaledUpBasedOnPreferredMaxReplicas
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: HPA target utilization is updated
reason: HPATargetUtilizationUpdated
status: "True"
type: HPATargetUtilizationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
type: FailedToReconcile
containerResourcePhases:
- containerName: app
resourcePhases:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,23 @@ status:
cpu: 100m
memory: 11Mi
tortoiseConditions:
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: the current number of replicas is not bigger than the preferred max
replica number
reason: ScaledUpBasedOnPreferredMaxReplicas
status: "False"
type: ScaledUpBasedOnPreferredMaxReplicas
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: HPA target utilization is updated
reason: HPATargetUtilizationUpdated
status: "True"
type: HPATargetUtilizationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
type: FailedToReconcile
containerResourcePhases:
- containerName: app
resourcePhases:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,23 @@ status:
cpu: "4"
memory: 3Gi
tortoiseConditions:
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: the current number of replicas is not bigger than the preferred max
replica number
reason: ScaledUpBasedOnPreferredMaxReplicas
status: "False"
type: ScaledUpBasedOnPreferredMaxReplicas
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: HPA target utilization is updated
reason: HPATargetUtilizationUpdated
status: "True"
type: HPATargetUtilizationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
type: FailedToReconcile
containerResourcePhases:
- containerName: app
resourcePhases:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ status:
reason: HPATargetUtilizationUpdated
status: "True"
type: HPATargetUtilizationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
type: FailedToReconcile
containerResourcePhases:
- containerName: app
resourcePhases:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,18 @@ status:
resource:
cpu: "4"
memory: 4Gi
tortoiseConditions: null
tortoiseConditions:
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: the current number of replicas is not bigger than the preferred max
replica number
reason: ScaledUpBasedOnPreferredMaxReplicas
status: "False"
type: ScaledUpBasedOnPreferredMaxReplicas
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
type: FailedToReconcile
containerResourcePhases:
- containerName: app
resourcePhases:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ status:
reason: HPATargetUtilizationUpdated
status: "True"
type: HPATargetUtilizationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
type: FailedToReconcile
containerResourcePhases:
- containerName: app
resourcePhases:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ status:
reason: HPATargetUtilizationUpdated
status: "True"
type: HPATargetUtilizationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
type: FailedToReconcile
containerResourcePhases:
- containerName: app
resourcePhases:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,23 @@ status:
cpu: "4"
memory: 3Gi
tortoiseConditions:
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: the current number of replicas is not bigger than the preferred max
replica number
reason: ScaledUpBasedOnPreferredMaxReplicas
status: "False"
type: ScaledUpBasedOnPreferredMaxReplicas
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: HPA target utilization is updated
reason: HPATargetUtilizationUpdated
status: "True"
type: HPATargetUtilizationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
type: FailedToReconcile
containerResourcePhases:
- containerName: app
resourcePhases:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,18 @@ status:
resource:
cpu: "4"
memory: 4Gi
tortoiseConditions: null
tortoiseConditions:
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: the current number of replicas is not bigger than the preferred max
replica number
reason: ScaledUpBasedOnPreferredMaxReplicas
status: "False"
type: ScaledUpBasedOnPreferredMaxReplicas
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
type: FailedToReconcile
containerResourcePhases:
- containerName: app
resourcePhases:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,23 @@ status:
cpu: "3"
memory: 4Gi
tortoiseConditions:
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: the current number of replicas is not bigger than the preferred max
replica number
reason: ScaledUpBasedOnPreferredMaxReplicas
status: "False"
type: ScaledUpBasedOnPreferredMaxReplicas
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: HPA target utilization is updated
reason: HPATargetUtilizationUpdated
status: "True"
type: HPATargetUtilizationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
type: FailedToReconcile
containerResourcePhases:
- containerName: app
resourcePhases:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ status:
resource:
cpu: "4"
memory: 4Gi
tortoiseConditions: null
tortoiseConditions:
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
type: FailedToReconcile
containerResourcePhases:
- containerName: app
resourcePhases:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,23 @@ status:
cpu: "4"
memory: 3Gi
tortoiseConditions:
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: the current number of replicas is not bigger than the preferred max
replica number
reason: ScaledUpBasedOnPreferredMaxReplicas
status: "False"
type: ScaledUpBasedOnPreferredMaxReplicas
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: HPA target utilization is updated
reason: HPATargetUtilizationUpdated
status: "True"
type: HPATargetUtilizationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
type: FailedToReconcile
containerResourcePhases:
- containerName: app
resourcePhases:
Expand Down
Loading

0 comments on commit c0d7f0e

Please sign in to comment.