Commit 716e07d
feat(scheduling): phase 1 - swift-nic capacity scheduling, pending reservations, provision shard pinning
Builds on phase 0 (ready/not-ready mirroring). Adds capacity-aware placement of
HostedControlPlanes onto management clusters based on SWIFT-NIC capacity, plus
provision-shard pinning at Cluster Service creation.
Per eligible management cluster, available swift NICs are computed as:
ScaleCeiling.Capacity[swift-nic]
- ObservedResources.Usage[swift-nic]
- (non-empty NotReadyResourceIDs)*3
- (non-nil PendingAssignedClusters)*3
and an HCP fits when available >= 3 (swiftNICsPerHCP; a conservative flat
per-HCP cost that never overbooks). Nil/empty list entries do not correspond to
a real HCP and never reserve capacity.
API:
- coreapi: add ServiceProviderCluster.Spec.ManagementClusterResourceID
(scheduler intent; drift from the observed Status placement is logged for
investigation but NOT auto-corrected), regenerate deepcopy.
- fleetapi: add ManagementClusterScheduling.Status.PendingAssignedClusters
(transient reservations), regenerate deepcopy.
Controllers:
- placement: new PlacementController (cluster-keyed, single worker). Backfills
Spec from an already-observed Status placement during rollout; otherwise runs
a pure, capacity-aware selection (fit filter + lowest-available bin-pack
tie-break), reserves capacity in the chosen MC's PendingAssignedClusters, then
records Spec. Transient write/conflict failures return an error so the
workqueue retries with backoff.
- placement: new PendingCleanupController (MC-keyed periodic sweep) removes stale
pending reservations. Effective placement favors the SPC's observed Status over
Spec; an entry is kept when it points here or is still resolving (nil) and
removed when it points elsewhere or the SPC is gone. SPCs are read via the
shared lister/cache; transient failures return an error for workqueue backoff.
- placement: ManagementClusterPlacementSync reconciles Status from Cluster
Service only while the observed placement is still unknown; once Status is set
it skips the CS lookup. Spec/Status drift is logged, never auto-corrected.
- fleet CapacityReportingController: in the same read-modify-write, drops
pending reservations that are now observed (Ready or NotReady).
- creation: ClusterPendingClusterServiceIDAssign gates on
Spec.ManagementClusterResourceID != nil; ClusterClusterServiceCreate pins the
provision shard via ClusterBuilder.ProvisionShardID resolved from the placed
management cluster.
- wire PlacementController and PendingCleanupController into backend (single
worker each; FleetDBClient + listers).
Tests: pure selection combos + lowest-available tie-break; capacity formula
edges incl. nil/empty entries; capacity-report pending cleanup; pending-cleanup
stale-entry matrix (Status-favored); rollout backfill; placement-sync
skip-when-Status-set and log-only drift; gated needsWork; provision shard
pinning.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent fb8beff commit 716e07d
20 files changed
Lines changed: 1850 additions & 188 deletions
File tree
- backend/pkg
- app
- controllers
- cluster
- creation
- placement
- metrics
- docs
- fleet/pkg/controllers/capacityreporting
- internal/api
- coreapi
- fleetapi
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
462 | 462 | | |
463 | 463 | | |
464 | 464 | | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
465 | 468 | | |
466 | 469 | | |
467 | 470 | | |
| |||
881 | 884 | | |
882 | 885 | | |
883 | 886 | | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
884 | 899 | | |
885 | 900 | | |
886 | 901 | | |
| |||
952 | 967 | | |
953 | 968 | | |
954 | 969 | | |
| 970 | + | |
955 | 971 | | |
956 | 972 | | |
957 | 973 | | |
| |||
1126 | 1142 | | |
1127 | 1143 | | |
1128 | 1144 | | |
| 1145 | + | |
1129 | 1146 | | |
| 1147 | + | |
| 1148 | + | |
1130 | 1149 | | |
1131 | 1150 | | |
1132 | 1151 | | |
| |||
Lines changed: 53 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
| 50 | + | |
48 | 51 | | |
49 | 52 | | |
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
57 | 61 | | |
58 | 62 | | |
59 | 63 | | |
| |||
235 | 239 | | |
236 | 240 | | |
237 | 241 | | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
238 | 247 | | |
239 | 248 | | |
240 | 249 | | |
241 | 250 | | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
242 | 254 | | |
243 | 255 | | |
244 | 256 | | |
| |||
253 | 265 | | |
254 | 266 | | |
255 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
Lines changed: 35 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| |||
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
55 | 61 | | |
56 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
57 | 81 | | |
58 | 82 | | |
59 | 83 | | |
| |||
128 | 152 | | |
129 | 153 | | |
130 | 154 | | |
| 155 | + | |
131 | 156 | | |
132 | 157 | | |
133 | 158 | | |
| |||
142 | 167 | | |
143 | 168 | | |
144 | 169 | | |
| 170 | + | |
145 | 171 | | |
| 172 | + | |
146 | 173 | | |
147 | 174 | | |
148 | 175 | | |
| |||
154 | 181 | | |
155 | 182 | | |
156 | 183 | | |
| 184 | + | |
157 | 185 | | |
158 | 186 | | |
159 | 187 | | |
| |||
232 | 260 | | |
233 | 261 | | |
234 | 262 | | |
| 263 | + | |
235 | 264 | | |
| 265 | + | |
236 | 266 | | |
237 | 267 | | |
238 | 268 | | |
| |||
284 | 314 | | |
285 | 315 | | |
286 | 316 | | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
291 | 322 | | |
292 | 323 | | |
293 | 324 | | |
| |||
Lines changed: 27 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| 45 | + | |
44 | 46 | | |
45 | | - | |
46 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
47 | 50 | | |
48 | 51 | | |
49 | 52 | | |
| |||
56 | 59 | | |
57 | 60 | | |
58 | 61 | | |
59 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
60 | 69 | | |
61 | 70 | | |
62 | 71 | | |
63 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
64 | 75 | | |
65 | 76 | | |
66 | 77 | | |
| |||
74 | 85 | | |
75 | 86 | | |
76 | 87 | | |
77 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
78 | 98 | | |
79 | 99 | | |
80 | 100 | | |
| |||
0 commit comments