Skip to content

Commit

Permalink
implement TortoiseHPATargetUtilizationUpdateInterval and HPATargetUti…
Browse files Browse the repository at this point in the history
…lizationUpdated condition (#177)
  • Loading branch information
sanposhiho authored Oct 12, 2023
1 parent e5ef93a commit d40832b
Show file tree
Hide file tree
Showing 41 changed files with 554 additions and 105 deletions.
2 changes: 1 addition & 1 deletion api/autoscaling/v2/webhook_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ var _ = BeforeSuite(func() {
eventRecorder := mgr.GetEventRecorderFor("tortoise-controller")
tortoiseService, err := tortoise.New(mgr.GetClient(), eventRecorder, config.RangeOfMinMaxReplicasRecommendationHours, config.TimeZone, config.TortoiseUpdateInterval, config.MinMaxReplicasRecommendationType)
Expect(err).NotTo(HaveOccurred())
hpaService := hpa.New(mgr.GetClient(), eventRecorder, config.ReplicaReductionFactor, config.UpperTargetResourceUtilization, 100)
hpaService := hpa.New(mgr.GetClient(), eventRecorder, config.ReplicaReductionFactor, config.UpperTargetResourceUtilization, 100, time.Hour)
Expect(err).NotTo(HaveOccurred())

hpaWebhook := New(tortoiseService, hpaService)
Expand Down
3 changes: 2 additions & 1 deletion api/v1beta2/tortoise_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ type TortoiseConditionType string

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

type TortoiseCondition struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ status:
memory:
quantity: "0"
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ status:
memory:
quantity: "0"
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ spec:
name: mercari-app
status:
conditions:
tortoiseConditions:
- message: "HPA target utilization is updated"
reason: HPATargetUtilizationUpdated
status: "True"
type: HPATargetUtilizationUpdated
containerRecommendationFromVPA:
- containerName: app
maxRecommendation:
Expand Down Expand Up @@ -49,7 +54,6 @@ status:
memory:
quantity: 3Gi
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ status:
memory:
quantity: "0"
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ spec:
name: mercari-app
status:
conditions:
tortoiseConditions:
- message: "HPA target utilization is updated"
reason: HPATargetUtilizationUpdated
status: "True"
type: HPATargetUtilizationUpdated
containerRecommendationFromVPA:
- containerName: app
maxRecommendation:
Expand Down Expand Up @@ -49,7 +54,6 @@ status:
memory:
quantity: 3Gi
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ status:
memory:
quantity: 3Gi
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ status:
memory:
quantity: 3Gi
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ status:
memory:
quantity: "0"
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ status:
memory:
quantity: 3Gi
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ status:
memory:
quantity: "0"
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ status:
memory:
quantity: 3Gi
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ status:
memory:
quantity: "0"
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ spec:
updateMode: Emergency
status:
conditions:
tortoiseConditions:
- message: "HPA target utilization is updated"
reason: HPATargetUtilizationUpdated
status: "True"
type: HPATargetUtilizationUpdated
containerRecommendationFromVPA:
- containerName: app
maxRecommendation:
Expand Down Expand Up @@ -50,7 +55,6 @@ status:
memory:
quantity: 3Gi
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ status:
memory:
quantity: "0"
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ spec:
name: mercari-app
status:
conditions:
tortoiseConditions:
- message: "HPA target utilization is updated"
reason: HPATargetUtilizationUpdated
status: "True"
type: HPATargetUtilizationUpdated
containerRecommendationFromVPA:
- containerName: app
maxRecommendation:
Expand Down Expand Up @@ -49,7 +54,6 @@ status:
memory:
quantity: 3Gi
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ status:
memory:
quantity: "0"
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ spec:
name: mercari-app
status:
conditions:
tortoiseConditions:
- message: "HPA target utilization is updated"
reason: HPATargetUtilizationUpdated
status: "True"
type: HPATargetUtilizationUpdated
containerRecommendationFromVPA:
- containerName: app
maxRecommendation:
Expand Down Expand Up @@ -49,7 +54,6 @@ status:
memory:
quantity: 3Gi
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ status:
memory:
quantity: "0"
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ status:
memory:
quantity: 3Gi
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ status:
memory:
quantity: "0"
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ spec:
updateMode: Emergency
status:
conditions:
tortoiseConditions:
- message: "HPA target utilization is updated"
reason: HPATargetUtilizationUpdated
status: "True"
type: HPATargetUtilizationUpdated
containerRecommendationFromVPA:
- containerName: app
maxRecommendation:
Expand All @@ -31,7 +36,6 @@ status:
memory:
quantity: 3Gi
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ status:
memory:
quantity: "0"
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ spec:
name: mercari-app
status:
conditions:
tortoiseConditions:
- message: "HPA target utilization is updated"
reason: HPATargetUtilizationUpdated
status: "True"
type: HPATargetUtilizationUpdated
containerRecommendationFromVPA:
- containerName: app
maxRecommendation:
Expand All @@ -30,7 +35,6 @@ status:
memory:
quantity: 3Gi
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ status:
memory:
quantity: "0"
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ status:
memory:
quantity: 3Gi
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ status:
memory:
quantity: 3Gi
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ spec:
name: mercari-app
status:
conditions:
tortoiseConditions:
- message: "HPA target utilization is updated"
reason: HPATargetUtilizationUpdated
status: "True"
type: HPATargetUtilizationUpdated
containerRecommendationFromVPA:
- containerName: app
maxRecommendation:
Expand All @@ -30,7 +35,6 @@ status:
memory:
quantity: 3Gi
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ status:
memory:
quantity: 3Gi
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ spec:
name: mercari-app
status:
conditions:
tortoiseConditions:
- message: "HPA target utilization is updated"
reason: HPATargetUtilizationUpdated
status: "True"
type: HPATargetUtilizationUpdated
containerRecommendationFromVPA:
- containerName: app
maxRecommendation:
Expand All @@ -30,7 +35,6 @@ status:
memory:
quantity: 3Gi
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ status:
memory:
quantity: 3Gi
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ spec:
name: mercari-app
status:
conditions:
tortoiseConditions:
- message: "HPA target utilization is updated"
reason: HPATargetUtilizationUpdated
status: "True"
type: HPATargetUtilizationUpdated
containerRecommendationFromVPA:
- containerName: app
maxRecommendation:
Expand All @@ -30,7 +35,6 @@ status:
memory:
quantity: 3Gi
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ status:
memory:
quantity: "0"
updatedAt: null
tortoiseConditions: null
recommendations:
horizontal:
maxReplicas:
Expand Down
Loading

0 comments on commit d40832b

Please sign in to comment.