Commit 9ea47d0
authored
✨ feat: Implement autoscaling from zero by auto-populating AWSMachineTemplate capacity (kubernetes-sigs#5711)
* feat: implement auto-population of AWSMachineTemplate capacity and nodeInfo
Add AWSMachineTemplateReconciler to automatically populate capacity and node
info fields by querying AWS EC2 API. This completes the autoscaling from zero
implementation by ensuring the required metadata is available without manual
configuration.
Changes include:
- Add NodeInfo struct with Architecture and OperatingSystem fields to AWSMachineTemplate status
- Implement controller that queries EC2 API for instance type specifications
- Auto-populate CPU, memory, pods, and ephemeral storage capacity
- Auto-detect architecture (amd64/arm64) and OS (linux/windows) from AMI
- Add conversion logic for backward compatibility with v1beta1
- Enable status subresource on AWSMachineTemplate CRD
- Add comprehensive unit tests (351 lines) covering various scenarios
- Add RBAC permissions for controller operations
The controller automatically populates these fields when an AWSMachineTemplate
is created or updated, eliminating the need for manual configuration and
enabling Cluster Autoscaler to make informed scaling decisions from zero nodes.
Related: https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20210310-opt-in-autoscaling-from-zero.md
Squashed from 5 commits:
- 9a92a43 Implement autoscaling from zero by auto-populating AWSMachineTemplate capacity
- 86fe072 add AWSMachineTemplate NodeInfo
- ddaf62c Fix review comments
- 4ea52c8 Fix review comments 2
- b398ffc Fix review comments 3
* feat(api): add Conditions field and update for CAPI v1.11
Add Conditions to AWSMachineTemplateStatus and update controller for CAPI v1.11
API changes.
Squashed from 2 commits:
- ffdf7db Fix review comments 4
- 6493363 rebase kubernetes-sigs#57201 parent 26c3586 commit 9ea47d0
File tree
11 files changed
+1051
-10
lines changed- api
- v1beta1
- v1beta2
- config
- crd/bases
- rbac
- controllers
- test/e2e/suites/unmanaged
11 files changed
+1051
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
139 | 143 | | |
140 | 144 | | |
141 | 145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
26 | 62 | | |
27 | 63 | | |
28 | 64 | | |
29 | 65 | | |
30 | 66 | | |
31 | 67 | | |
32 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
33 | 79 | | |
34 | 80 | | |
35 | 81 | | |
| |||
40 | 86 | | |
41 | 87 | | |
42 | 88 | | |
| 89 | + | |
43 | 90 | | |
44 | 91 | | |
45 | 92 | | |
| |||
71 | 118 | | |
72 | 119 | | |
73 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
74 | 131 | | |
75 | 132 | | |
76 | 133 | | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 77 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1156 | 1156 | | |
1157 | 1157 | | |
1158 | 1158 | | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
1159 | 1234 | | |
1160 | 1235 | | |
1161 | 1236 | | |
1162 | 1237 | | |
| 1238 | + | |
| 1239 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| 186 | + | |
186 | 187 | | |
187 | 188 | | |
188 | 189 | | |
| |||
0 commit comments