11# Demo workloads for kubetidy local testing.
22#
3- # These are deliberately OVER-PROVISIONED: each asks for far more CPU/memory than it uses
4- # (the pause image uses almost nothing), so `kubectl tidy scan` surfaces real rightsizing
5- # savings and a low efficiency score.
3+ # These are deliberately OVER-PROVISIONED: each REQUESTS far more CPU/memory than it uses, so
4+ # `kubectl tidy scan` surfaces real rightsizing savings. Unlike a bare `pause` container (which
5+ # uses ~0 and shows up as "—"), these tiny Python load generators hold a fixed chunk of memory
6+ # and burn a small, steady amount of CPU — so the scan shows a real avg/p95/p99/peak
7+ # distribution and a meaningful reduction.
68#
7- # Requests are sized to fit on a single default kind node (12 CPU / ~8Gi): the whole namespace
8- # asks for ~5 cores / ~5Gi, so every pod schedules and the rollout settles .
9+ # Requests are sized to fit a single default kind node (12 CPU / ~8Gi); actual usage is a small
10+ # fraction of the request .
911apiVersion : v1
1012kind : Namespace
1113metadata :
@@ -19,23 +21,28 @@ metadata:
1921spec :
2022 replicas : 2
2123 selector :
22- matchLabels :
23- app : checkout-api
24+ matchLabels : { app: checkout-api }
2425 template :
2526 metadata :
26- labels :
27- app : checkout-api
27+ labels : { app: checkout-api }
2828 spec :
2929 containers :
3030 - name : checkout-api
31- image : registry.k8s.io/pause:3.10
31+ image : python:3.12-alpine
32+ # Hold ~120Mi and burn a small, steady CPU slice (busy burst + sleep).
33+ command : ["python3", "-c"]
34+ args :
35+ - |
36+ import time
37+ buf = bytearray(120 * 1024 * 1024) # hold ~120Mi
38+ while True: # ~12% of a core
39+ t = time.time()
40+ while time.time() - t < 0.02:
41+ pass
42+ time.sleep(0.15)
3243 resources :
33- requests :
34- cpu : " 1000m" # asks for a full core...
35- memory : " 1Gi" # ...and 1Gi, but pause uses almost nothing
36- limits :
37- cpu : " 1000m"
38- memory : " 1Gi"
44+ requests : { cpu: "1000m", memory: "1Gi" } # asks for a full core + 1Gi...
45+ limits : { cpu: "1000m", memory: "1Gi" } # ...but uses ~0.1 core / ~120Mi
3946---
4047apiVersion : apps/v1
4148kind : Deployment
@@ -45,23 +52,27 @@ metadata:
4552spec :
4653 replicas : 1
4754 selector :
48- matchLabels :
49- app : search-indexer
55+ matchLabels : { app: search-indexer }
5056 template :
5157 metadata :
52- labels :
53- app : search-indexer
58+ labels : { app: search-indexer }
5459 spec :
5560 containers :
5661 - name : search-indexer
57- image : registry.k8s.io/pause:3.10
62+ image : python:3.12-alpine
63+ command : ["python3", "-c"]
64+ args :
65+ - |
66+ import time
67+ buf = bytearray(220 * 1024 * 1024) # hold ~220Mi
68+ while True: # ~18% of a core
69+ t = time.time()
70+ while time.time() - t < 0.03:
71+ pass
72+ time.sleep(0.14)
5873 resources :
59- requests :
60- cpu : " 2000m"
61- memory : " 2Gi"
62- limits :
63- cpu : " 2000m"
64- memory : " 2Gi"
74+ requests : { cpu: "2000m", memory: "2Gi" }
75+ limits : { cpu: "2000m", memory: "2Gi" }
6576---
6677apiVersion : apps/v1
6778kind : StatefulSet
@@ -72,20 +83,24 @@ spec:
7283 serviceName : cache
7384 replicas : 2
7485 selector :
75- matchLabels :
76- app : cache
86+ matchLabels : { app: cache }
7787 template :
7888 metadata :
79- labels :
80- app : cache
89+ labels : { app: cache }
8190 spec :
8291 containers :
8392 - name : cache
84- image : registry.k8s.io/pause:3.10
93+ image : python:3.12-alpine
94+ command : ["python3", "-c"]
95+ args :
96+ - |
97+ import time
98+ buf = bytearray(80 * 1024 * 1024) # hold ~80Mi
99+ while True: # ~8% of a core
100+ t = time.time()
101+ while time.time() - t < 0.015:
102+ pass
103+ time.sleep(0.18)
85104 resources :
86- requests :
87- cpu : " 500m"
88- memory : " 512Mi"
89- limits :
90- cpu : " 500m"
91- memory : " 512Mi"
105+ requests : { cpu: "500m", memory: "512Mi" }
106+ limits : { cpu: "500m", memory: "512Mi" }
0 commit comments