Skip to content

Commit 5a9c864

Browse files
committed
Merge branch 'main' of github.com:mercari/tortoise into scheduledscaling
2 parents bff5b46 + c9a9c31 commit 5a9c864

File tree

68 files changed

+3655
-828
lines changed

Some content is hidden

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

68 files changed

+3655
-828
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
# Image URL to use all building/pushing image targets
3-
IMG ?= ghcr.io/mercari/tortoise:v0.7.0
3+
IMG ?= ghcr.io/mercari/tortoise:v0.9.0
44
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
55
ENVTEST_K8S_VERSION = 1.27.1
66

README.md

Lines changed: 50 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,44 @@
11
# Tortoise
22

3-
**Tortoise is under the active development and not production ready yet.**
43

54
<img alt="Tortoise" src="docs/images/tortoise_big.jpg" width="400px"/>
65

76
Get cute Tortoises into your Kubernetes garden and say goodbye to the days optimizing your rigid autoscalers.
87

8+
_Tortoise is still in the early stage and we recommend evaluating its behaviour with your services in your development environment carefully._
9+
10+
## Motivation
11+
12+
At Mercari, the responsibilities of the Platform team and the service development teams are clearly distinguished. Not all service owners possess expert knowledge of Kubernetes.
13+
14+
Also, Mercari has embraced a microservices architecture, currently managing over 1000 Deployments, each with its dedicated development team.
15+
16+
To effectively drive FinOps across such a sprawling landscape,
17+
it's clear that the platform team cannot individually optimize all services.
18+
As a result, they provide a plethora of tools and guidelines to simplify the process of the Kubernetes optimization for service owners.
19+
20+
But, even with them, manually optimizing various parameters across different resources,
21+
such as resource requests/limits, HPA parameters, and Golang runtime environment variables, presents a substantial challenge.
22+
23+
Furthermore, this optimization demands engineering efforts from each team constantly -
24+
adjustments are necessary whenever there’s a change impacting a resource usage, which can occur frequently:
25+
Changes in implementation can alter resource consumption patterns, fluctuations in traffic volume are common, etc.
26+
27+
Therefore, to keep our Kubernetes clusters optimized, it would necessitate mandating all teams to perpetually engage in complex manual optimization processes indefinitely,
28+
or until Mercari goes out of business.
29+
30+
To address these challenges, the platform team has embarked on developing Tortoise,
31+
an automated solution designed to meet all Kubernetes resource optimization needs.
32+
33+
This approach shifts the optimization responsibility from service owners to the platform team (Tortoises),
34+
allowing for comprehensive tuning by the platform team to ensure all Tortoises in the cluster adapts to each workload.
35+
On the other hand, service owners are required to configure only a minimal number of parameters
36+
to initiate autoscaling with Tortoise, significantly simplifying their involvement.
37+
38+
See more details in the blog post:
39+
- [Tortoise: Outpacing the Optimization Challenges in Kubernetes at Mercari](https://engineering.mercari.com/en/blog/entry/20240206-3a12bb1288/)
40+
- [人間によるKubernetesリソース最適化の”諦め”とそこに見るリクガメの可能性](https://engineering.mercari.com/blog/entry/20240206-3a12bb1288/)
41+
942
## Install
1043

1144
You cannot get it from the breeder, you need to get it from GitHub instead.
@@ -19,34 +52,17 @@ make deploy
1952

2053
You don't need a rearing cage, but need VPA in your Kubernetes cluster before installing it.
2154

22-
## Motivation
55+
## Usage
2356

24-
Many developers are working in Mercari, and not all of them are the experts of Kubernetes.
25-
The platform has many tools and guides to simplify the task of optimizing resource requests,
26-
but the optimization takes engineering cost in every team constantly.
57+
As described in [Motivation](#motivation) section, Tortoise exposes many global parameters to a cluster admin, while it exposes few parameters in Tortoise resource.
2758

28-
The optimization should be done every time the situation around the service get changed, which could happen easily and frequently.
29-
(e.g., the implementation change could change the way of consuming resources, the amount of traffic could be changed, etc)
59+
### Cluster admin
3060

31-
Also, when it comes to HorizontalPodAutoscaler(HPA), it's nearly impossible for human to optimize.
32-
It’s not a simple problem which we just set the target utilization as high as possible –
33-
there are many scenarios where the actual resource utilization doesn’t reach the target resource utilization in the first place
34-
(because of multiple containers, minReplicas, unbalanced container’s size etc).
61+
See [Admin guide](./docs/admin-guide.md) to understand how to configure the tortoise controller to make it fit your workloads in one cluster.
3562

36-
To overcome those challenges,
37-
the platform team start to have Tortoise, which is the automated solution for all optimization needs to be done for Kubernetes resource.
63+
### Tortoise users
3864

39-
It aims to move the responsibility of optimizing the workloads from the application teams to tortoises (Platform team).
40-
Application teams just need to set up Tortoise, and the platform team will never bother them again for the resource optimization -
41-
all actual optimization is done by Tortoise automatically.
42-
43-
See a detailed motivation in the blog post:
44-
- [Tortoise: Outpacing the Optimization Challenges in Kubernetes at Mercari](https://engineering.mercari.com/en/blog/entry/20240206-3a12bb1288/)
45-
- [人間によるKubernetesリソース最適化の”諦め”とそこに見るリクガメの可能性](https://engineering.mercari.com/blog/entry/20240206-3a12bb1288/)
46-
47-
## Usage
48-
49-
Tortoise has a very simple interface:
65+
Tortoise CRD itself has a very simple interface:
5066

5167
```yaml
5268
apiVersion: autoscaling.mercari.com/v1beta3
@@ -62,12 +78,11 @@ spec:
6278
name: sample
6379
```
6480
65-
Then, Tortoise creates fully managed autoscalers (HPA and VPA).
66-
67-
Despite its simple appearance, it contains a rich collection of historical data on resource utilization beneath its shell,
81+
Then, Tortoise creates HPA and VPA under the hood.
82+
Despite its simple appearance, each tortoise stores a rich collection of historical data on resource utilization beneath its shell,
6883
and cleverly utilizes them to manage parameters in autoscalers.
6984
70-
Please refer to [User guide](./docs/user-guide.md) for other parameters.
85+
Please refer to [User guide](./docs/user-guide.md) to learn more about other parameters.
7186
7287
## Documentations
7388
@@ -84,6 +99,13 @@ and how they can configure Tortoise so that they can let tortoises autoscale the
8499
85100
- [Tortoise](./api/v1beta3/tortoise_types.go)
86101
102+
## Notes
103+
104+
Here's some notes that you may want to pay attention to before starting to use Tortoise.
105+
106+
- Tortoise only supports Deployment at the moment. In the future, [we'll support all resources supporting scale subresources](https://github.com/mercari/tortoise/issues/129).
107+
- In Mercari, we've evaluated Tortoise with many Golang microservices, while there're a few services implemented in other languages using Tortoise. Any contributions would be welcome for enhance the recommendation for your language's services!
108+
87109
## Contribution
88110
89111
Before implementing any feature changes as Pull Requests,

api/autoscaling/v2/testdata/mutating/mutate-by-one-recommendation/tortoise.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ status:
4343
verticalPodAutoscalers:
4444
- name: tortoise-monitor-sample
4545
role: Monitor
46-
- name: tortoise-updater-sample
47-
role: Updater
4846
conditions:
4947
containerRecommendationFromVPA:
5048
- containerName: echo

api/autoscaling/v2/testdata/mutating/mutate-by-recommendations-back-to-normal/tortoise.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ status:
4343
verticalPodAutoscalers:
4444
- name: tortoise-monitor-sample
4545
role: Monitor
46-
- name: tortoise-updater-sample
47-
role: Updater
4846
conditions:
4947
containerRecommendationFromVPA:
5048
- containerName: echo

api/autoscaling/v2/testdata/mutating/mutate-by-recommendations/tortoise.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ status:
4343
verticalPodAutoscalers:
4444
- name: tortoise-monitor-sample
4545
role: Monitor
46-
- name: tortoise-updater-sample
47-
role: Updater
4846
conditions:
4947
containerRecommendationFromVPA:
5048
- containerName: echo

api/autoscaling/v2/testdata/mutating/no-mutate-by-recommendations-when-dryrun/tortoise.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ status:
4343
verticalPodAutoscalers:
4444
- name: tortoise-monitor-sample
4545
role: Monitor
46-
- name: tortoise-updater-sample
47-
role: Updater
4846
conditions:
4947
containerRecommendationFromVPA:
5048
- containerName: echo

api/autoscaling/v2/testdata/mutating/no-tortoise-for-this-hpa/tortoise.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ status:
4343
verticalPodAutoscalers:
4444
- name: tortoise-monitor-sample
4545
role: Monitor
46-
- name: tortoise-updater-sample
47-
role: Updater
4846
conditions:
4947
containerRecommendationFromVPA:
5048
- containerName: echo

api/autoscaling/v2/testdata/validating/hpa-with-auto-being-deleted/tortoise.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ status:
4444
verticalPodAutoscalers:
4545
- name: tortoise-monitor-sample
4646
role: Monitor
47-
- name: tortoise-updater-sample
48-
role: Updater
4947
conditions:
5048
containerRecommendationFromVPA:
5149
- containerName: echo

api/autoscaling/v2/testdata/validating/hpa-with-auto-existing/tortoise.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ status:
4343
verticalPodAutoscalers:
4444
- name: tortoise-monitor-sample
4545
role: Monitor
46-
- name: tortoise-updater-sample
47-
role: Updater
4846
conditions:
4947
containerRecommendationFromVPA:
5048
- containerName: echo

api/autoscaling/v2/testdata/validating/hpa-with-off/tortoise.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ status:
4343
verticalPodAutoscalers:
4444
- name: tortoise-monitor-sample
4545
role: Monitor
46-
- name: tortoise-updater-sample
47-
role: Updater
4846
conditions:
4947
containerRecommendationFromVPA:
5048
- containerName: echo

0 commit comments

Comments
 (0)