Skip to content

Commit 2e261c4

Browse files
committed
refactor tortoisephase change into tortoise service and write unit tests
1 parent dd7c10a commit 2e261c4

File tree

46 files changed

+905
-67
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+905
-67
lines changed

internal/controller/testdata/deletion-no-delete/before/hpa.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,25 @@ metadata:
33
tortoise.autoscaling.mercari.com/managed-by-tortoise: "true"
44
name: tortoise-hpa-mercari
55
namespace: default
6+
status:
7+
conditions:
8+
- status: "True"
9+
type: AbleToScale
10+
message: "recommended size matches current size"
11+
- status: "True"
12+
type: ScalingActive
13+
message: "the HPA was able to compute the replica count"
14+
currentMetrics:
15+
- containerResource:
16+
container: app
17+
name: cpu
18+
current:
19+
value: 3
20+
- containerResource:
21+
container: istio-proxy
22+
name: cpu
23+
current:
24+
value: 3
625
spec:
726
behavior:
827
scaleDown:

internal/controller/testdata/deletion-policy-all/before/hpa.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,25 @@ metadata:
33
tortoise.autoscaling.mercari.com/managed-by-tortoise: "true"
44
name: tortoise-hpa-mercari
55
namespace: default
6+
status:
7+
conditions:
8+
- status: "True"
9+
type: AbleToScale
10+
message: "recommended size matches current size"
11+
- status: "True"
12+
type: ScalingActive
13+
message: "the HPA was able to compute the replica count"
14+
currentMetrics:
15+
- containerResource:
16+
container: app
17+
name: cpu
18+
current:
19+
value: 3
20+
- containerResource:
21+
container: istio-proxy
22+
name: cpu
23+
current:
24+
value: 3
625
spec:
726
behavior:
827
scaleDown:

internal/controller/testdata/mutable-autoscalingpolicy-add-another-horizontal/after/hpa.yaml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,21 @@ spec:
4747
kind: Deployment
4848
name: mercari-app
4949
status:
50-
currentMetrics: null
51-
desiredReplicas: 0
50+
conditions:
51+
- status: "True"
52+
type: AbleToScale
53+
message: "recommended size matches current size"
54+
- status: "True"
55+
type: ScalingActive
56+
message: "the HPA was able to compute the replica count"
57+
currentMetrics:
58+
- containerResource:
59+
container: app
60+
name: cpu
61+
current:
62+
value: 3
63+
- containerResource:
64+
container: istio-proxy
65+
name: cpu
66+
current:
67+
value: 3

internal/controller/testdata/mutable-autoscalingpolicy-add-another-horizontal/before/hpa.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,25 @@ metadata:
33
tortoise.autoscaling.mercari.com/managed-by-tortoise: "true"
44
name: tortoise-hpa-mercari
55
namespace: default
6+
status:
7+
conditions:
8+
- status: "True"
9+
type: AbleToScale
10+
message: "recommended size matches current size"
11+
- status: "True"
12+
type: ScalingActive
13+
message: "the HPA was able to compute the replica count"
14+
currentMetrics:
15+
- containerResource:
16+
container: app
17+
name: cpu
18+
current:
19+
value: 3
20+
- containerResource:
21+
container: istio-proxy
22+
name: cpu
23+
current:
24+
value: 3
625
spec:
726
behavior:
827
scaleDown:

internal/controller/testdata/mutable-autoscalingpolicy-remove-horizontal-2/after/hpa.yaml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,21 @@ spec:
3232
kind: Deployment
3333
name: mercari-app
3434
status:
35-
currentMetrics: null
36-
desiredReplicas: 0
35+
conditions:
36+
- status: "True"
37+
type: AbleToScale
38+
message: "recommended size matches current size"
39+
- status: "True"
40+
type: ScalingActive
41+
message: "the HPA was able to compute the replica count"
42+
currentMetrics:
43+
- containerResource:
44+
container: app
45+
name: cpu
46+
current:
47+
value: 3
48+
- containerResource:
49+
container: istio-proxy
50+
name: cpu
51+
current:
52+
value: 3

internal/controller/testdata/mutable-autoscalingpolicy-remove-horizontal-2/before/hpa.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,25 @@ metadata:
33
tortoise.autoscaling.mercari.com/managed-by-tortoise: "true"
44
name: tortoise-hpa-mercari
55
namespace: default
6+
status:
7+
conditions:
8+
- status: "True"
9+
type: AbleToScale
10+
message: "recommended size matches current size"
11+
- status: "True"
12+
type: ScalingActive
13+
message: "the HPA was able to compute the replica count"
14+
currentMetrics:
15+
- containerResource:
16+
container: app
17+
name: cpu
18+
current:
19+
value: 3
20+
- containerResource:
21+
container: istio-proxy
22+
name: cpu
23+
current:
24+
value: 3
625
spec:
726
behavior:
827
scaleDown:

internal/controller/testdata/mutable-autoscalingpolicy-remove-horizontal/before/hpa.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,25 @@ metadata:
33
tortoise.autoscaling.mercari.com/managed-by-tortoise: "true"
44
name: tortoise-hpa-mercari
55
namespace: default
6+
status:
7+
conditions:
8+
- status: "True"
9+
type: AbleToScale
10+
message: "recommended size matches current size"
11+
- status: "True"
12+
type: ScalingActive
13+
message: "the HPA was able to compute the replica count"
14+
currentMetrics:
15+
- containerResource:
16+
container: app
17+
name: cpu
18+
current:
19+
value: 3
20+
- containerResource:
21+
container: istio-proxy
22+
name: cpu
23+
current:
24+
value: 3
625
spec:
726
behavior:
827
scaleDown:

internal/controller/testdata/reconcile-for-the-istio-enabled-pod-working/after/hpa.yaml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,21 @@ spec:
4040
kind: Deployment
4141
name: mercari-app
4242
status:
43-
currentMetrics: null
44-
desiredReplicas: 0
43+
conditions:
44+
- status: "True"
45+
type: AbleToScale
46+
message: "recommended size matches current size"
47+
- status: "True"
48+
type: ScalingActive
49+
message: "the HPA was able to compute the replica count"
50+
currentMetrics:
51+
- containerResource:
52+
container: app
53+
name: cpu
54+
current:
55+
value: 3
56+
- containerResource:
57+
container: istio-proxy
58+
name: cpu
59+
current:
60+
value: 3

internal/controller/testdata/reconcile-for-the-istio-enabled-pod-working/before/hpa.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,25 @@ metadata:
33
tortoise.autoscaling.mercari.com/managed-by-tortoise: "true"
44
name: tortoise-hpa-mercari
55
namespace: default
6+
status:
7+
conditions:
8+
- status: "True"
9+
type: AbleToScale
10+
message: "recommended size matches current size"
11+
- status: "True"
12+
type: ScalingActive
13+
message: "the HPA was able to compute the replica count"
14+
currentMetrics:
15+
- containerResource:
16+
container: app
17+
name: cpu
18+
current:
19+
value: 3
20+
- containerResource:
21+
container: istio-proxy
22+
name: cpu
23+
current:
24+
value: 3
625
spec:
726
behavior:
827
scaleDown:

internal/controller/testdata/reconcile-for-the-multiple-containers-pod-during-emergency/after/hpa.yaml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,21 @@ spec:
4040
kind: Deployment
4141
name: mercari-app
4242
status:
43-
currentMetrics: null
44-
desiredReplicas: 0
43+
conditions:
44+
- status: "True"
45+
type: AbleToScale
46+
message: "recommended size matches current size"
47+
- status: "True"
48+
type: ScalingActive
49+
message: "the HPA was able to compute the replica count"
50+
currentMetrics:
51+
- containerResource:
52+
container: app
53+
name: cpu
54+
current:
55+
value: 3
56+
- containerResource:
57+
container: istio-proxy
58+
name: cpu
59+
current:
60+
value: 3

0 commit comments

Comments
 (0)