Skip to content

Commit

Permalink
refactor tortoisephase change into tortoise service and write unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
randytqwjp committed Dec 12, 2024
1 parent dd7c10a commit 2e261c4
Show file tree
Hide file tree
Showing 46 changed files with 905 additions and 67 deletions.
19 changes: 19 additions & 0 deletions internal/controller/testdata/deletion-no-delete/before/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@ metadata:
tortoise.autoscaling.mercari.com/managed-by-tortoise: "true"
name: tortoise-hpa-mercari
namespace: default
status:
conditions:
- status: "True"
type: AbleToScale
message: "recommended size matches current size"
- status: "True"
type: ScalingActive
message: "the HPA was able to compute the replica count"
currentMetrics:
- containerResource:
container: app
name: cpu
current:
value: 3
- containerResource:
container: istio-proxy
name: cpu
current:
value: 3
spec:
behavior:
scaleDown:
Expand Down
19 changes: 19 additions & 0 deletions internal/controller/testdata/deletion-policy-all/before/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@ metadata:
tortoise.autoscaling.mercari.com/managed-by-tortoise: "true"
name: tortoise-hpa-mercari
namespace: default
status:
conditions:
- status: "True"
type: AbleToScale
message: "recommended size matches current size"
- status: "True"
type: ScalingActive
message: "the HPA was able to compute the replica count"
currentMetrics:
- containerResource:
container: app
name: cpu
current:
value: 3
- containerResource:
container: istio-proxy
name: cpu
current:
value: 3
spec:
behavior:
scaleDown:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,21 @@ spec:
kind: Deployment
name: mercari-app
status:
currentMetrics: null
desiredReplicas: 0
conditions:
- status: "True"
type: AbleToScale
message: "recommended size matches current size"
- status: "True"
type: ScalingActive
message: "the HPA was able to compute the replica count"
currentMetrics:
- containerResource:
container: app
name: cpu
current:
value: 3
- containerResource:
container: istio-proxy
name: cpu
current:
value: 3
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@ metadata:
tortoise.autoscaling.mercari.com/managed-by-tortoise: "true"
name: tortoise-hpa-mercari
namespace: default
status:
conditions:
- status: "True"
type: AbleToScale
message: "recommended size matches current size"
- status: "True"
type: ScalingActive
message: "the HPA was able to compute the replica count"
currentMetrics:
- containerResource:
container: app
name: cpu
current:
value: 3
- containerResource:
container: istio-proxy
name: cpu
current:
value: 3
spec:
behavior:
scaleDown:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,21 @@ spec:
kind: Deployment
name: mercari-app
status:
currentMetrics: null
desiredReplicas: 0
conditions:
- status: "True"
type: AbleToScale
message: "recommended size matches current size"
- status: "True"
type: ScalingActive
message: "the HPA was able to compute the replica count"
currentMetrics:
- containerResource:
container: app
name: cpu
current:
value: 3
- containerResource:
container: istio-proxy
name: cpu
current:
value: 3
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@ metadata:
tortoise.autoscaling.mercari.com/managed-by-tortoise: "true"
name: tortoise-hpa-mercari
namespace: default
status:
conditions:
- status: "True"
type: AbleToScale
message: "recommended size matches current size"
- status: "True"
type: ScalingActive
message: "the HPA was able to compute the replica count"
currentMetrics:
- containerResource:
container: app
name: cpu
current:
value: 3
- containerResource:
container: istio-proxy
name: cpu
current:
value: 3
spec:
behavior:
scaleDown:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@ metadata:
tortoise.autoscaling.mercari.com/managed-by-tortoise: "true"
name: tortoise-hpa-mercari
namespace: default
status:
conditions:
- status: "True"
type: AbleToScale
message: "recommended size matches current size"
- status: "True"
type: ScalingActive
message: "the HPA was able to compute the replica count"
currentMetrics:
- containerResource:
container: app
name: cpu
current:
value: 3
- containerResource:
container: istio-proxy
name: cpu
current:
value: 3
spec:
behavior:
scaleDown:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,21 @@ spec:
kind: Deployment
name: mercari-app
status:
currentMetrics: null
desiredReplicas: 0
conditions:
- status: "True"
type: AbleToScale
message: "recommended size matches current size"
- status: "True"
type: ScalingActive
message: "the HPA was able to compute the replica count"
currentMetrics:
- containerResource:
container: app
name: cpu
current:
value: 3
- containerResource:
container: istio-proxy
name: cpu
current:
value: 3
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@ metadata:
tortoise.autoscaling.mercari.com/managed-by-tortoise: "true"
name: tortoise-hpa-mercari
namespace: default
status:
conditions:
- status: "True"
type: AbleToScale
message: "recommended size matches current size"
- status: "True"
type: ScalingActive
message: "the HPA was able to compute the replica count"
currentMetrics:
- containerResource:
container: app
name: cpu
current:
value: 3
- containerResource:
container: istio-proxy
name: cpu
current:
value: 3
spec:
behavior:
scaleDown:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,21 @@ spec:
kind: Deployment
name: mercari-app
status:
currentMetrics: null
desiredReplicas: 0
conditions:
- status: "True"
type: AbleToScale
message: "recommended size matches current size"
- status: "True"
type: ScalingActive
message: "the HPA was able to compute the replica count"
currentMetrics:
- containerResource:
container: app
name: cpu
current:
value: 3
- containerResource:
container: istio-proxy
name: cpu
current:
value: 3
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@ metadata:
tortoise.autoscaling.mercari.com/managed-by-tortoise: "true"
name: tortoise-hpa-mercari
namespace: default
status:
conditions:
- status: "True"
type: AbleToScale
message: "recommended size matches current size"
- status: "True"
type: ScalingActive
message: "the HPA was able to compute the replica count"
currentMetrics:
- containerResource:
container: app
name: cpu
current:
value: 3
- containerResource:
container: istio-proxy
name: cpu
current:
value: 3
spec:
behavior:
scaleDown:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,21 @@ spec:
kind: Deployment
name: mercari-app
status:
currentMetrics: null
desiredReplicas: 0
conditions:
- status: "True"
type: AbleToScale
message: "recommended size matches current size"
- status: "True"
type: ScalingActive
message: "the HPA was able to compute the replica count"
currentMetrics:
- containerResource:
container: app
name: cpu
current:
value: 3
- containerResource:
container: istio-proxy
name: cpu
current:
value: 3
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@ metadata:
tortoise.autoscaling.mercari.com/managed-by-tortoise: "true"
name: tortoise-hpa-mercari
namespace: default
status:
conditions:
- status: "True"
type: AbleToScale
message: "recommended size matches current size"
- status: "True"
type: ScalingActive
message: "the HPA was able to compute the replica count"
currentMetrics:
- containerResource:
container: app
name: cpu
current:
value: 3
- containerResource:
container: istio-proxy
name: cpu
current:
value: 3
spec:
behavior:
scaleDown:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,16 @@ spec:
kind: Deployment
name: mercari-app
status:
currentMetrics: null
desiredReplicas: 0
conditions:
- status: "True"
type: AbleToScale
message: "recommended size matches current size"
- status: "True"
type: ScalingActive
message: "the HPA was able to compute the replica count"
currentMetrics:
- containerResource:
container: app
name: cpu
current:
value: 3
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@ metadata:
tortoise.autoscaling.mercari.com/managed-by-tortoise: "true"
name: tortoise-hpa-mercari
namespace: default
status:
conditions:
- status: "True"
type: AbleToScale
message: "recommended size matches current size"
- status: "True"
type: ScalingActive
message: "the HPA was able to compute the replica count"
currentMetrics:
- containerResource:
container: app
name: cpu
current:
value: 3
spec:
behavior:
scaleDown:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,21 @@ spec:
kind: Deployment
name: mercari-app
status:
currentMetrics: null
desiredReplicas: 0
conditions:
- status: "True"
type: AbleToScale
message: "recommended size matches current size"
- status: "True"
type: ScalingActive
message: "the HPA was able to compute the replica count"
currentMetrics:
- containerResource:
container: app
name: cpu
current:
value: 3
- containerResource:
container: istio-proxy
name: cpu
current:
value: 3
Loading

0 comments on commit 2e261c4

Please sign in to comment.