You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: designs/placement-groups-support.md
+12-21Lines changed: 12 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -278,7 +278,7 @@ Below lists the non-goals for _this RFC design._ Each of these items represents
278
278
- Add a new struct under `spec` for `placementGroupSelector` to `EC2NodeClass` for defining which Placement Group to be used for a specific `EC2NodeClass`
279
279
- Each EC2NodeClass maps to exactly one Placement Group
280
280
- The struct accepts either a placement group name or id as a string value
281
-
- Add a new field under `status` for the resolved Placement Group by the `spec.placementGroupSelector` for the `EC2NodeClass`
281
+
- The resolved placement group details are stored **in-memory** by the placement group provider
282
282
283
283
```yaml
284
284
apiVersion: karpenter.k8s.aws/v1
@@ -300,26 +300,17 @@ status:
300
300
# The EC2NodeClass is not ready if this condition is False,
301
301
# blocking all launches from this NodeClass.
302
302
type: PlacementGroupReady
303
-
# placementGroup contains the resolved placement group details.
304
-
placementGroup:
305
-
# Id for the Placement Group
306
-
id: String
307
-
# Name of the Placement Group
308
-
name: String
309
-
# Number of partitions for partition Placement Groups
310
-
partitionCount: int | None
311
-
# Spread level for spread Placement Groups {host, rack}
312
-
spreadLevel: String | None
313
-
# State of the placement group
314
-
# {pending, available, deleting, deleted}
315
-
# Karpenter sets PlacementGroupReady to False for any state other than "available"
316
-
state: String
317
-
# Strategy of the placement group
318
-
# {cluster, partition, spread}
319
-
strategy: String
320
303
```
321
304
322
-
This API closely follows how [DescribePlacementGroups](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribePlacementGroups.html) can filter placement groups -- allowing Karpenter to receive the server-side filtered version of the placement groups to store in its status.
305
+
The placement group provider resolves placement groups from the EC2 `DescribePlacementGroups` API and stores the result in-memory, keyed by nodeclass name. The resolved placement group contains the following fields:
306
+
307
+
- **ID**: Placement group ID (e.g., `"pg-0123456789abcdef0"`)
308
+
- **Name**: Placement group name
309
+
- **PartitionCount**: Number of partitions (partition strategy only)
310
+
- **SpreadLevel**: Spread level (`"rack"` or `"host"`, spread strategy only)
311
+
- **Strategy**: Placement group strategy (`"cluster"`, `"partition"`, or `"spread"`)
312
+
313
+
All consumers (drift detection, offering resolution, launch template creation, etc.) read from the provider's in-memory store. The nodeclass reconciler is responsible for calling the provider to resolve and store the placement group on each reconciliation loop, ensuring the in-memory state is always fresh.
323
314
324
315
### Labels
325
316
@@ -447,7 +438,7 @@ For partition placement groups, the `karpenter.k8s.aws/placement-group-partition
447
438
448
439
1. When a NodeClaim is created for an EC2NodeClass with a partition placement group, the instance is launched via `CreateFleet` without specifying a `PartitionNumber`, allowing EC2 to auto-assign the partition.
449
440
2. During node registration, before the `karpenter.sh/unregistered` taint is removed, the `PlacementGroupRegistrationHook` runs as part of the NodeClaim lifecycle controller's registration phase.
450
-
3. The hook resolves the EC2NodeClass from the NodeClaim's `spec.nodeClassRef` and checks `status.placementGroup` to determine if this is a partition placement group. If not, the hook passes through immediately.
441
+
3. The hook resolves the EC2NodeClass from the NodeClaim's `spec.nodeClassRef` and queries the placement group provider's in-memory store to determine if this is a partition placement group. If not, the hook passes through immediately.
451
442
4. For partition placement groups, the hook calls `DescribeInstances` to discover the EC2-assigned partition number from `Placement.PartitionNumber`.
452
443
5. Once the partition number is available, the hook sets the `karpenter.k8s.aws/placement-group-partition` label on the NodeClaim and allows registration to proceed. The label is then synced to the Node as part of the normal registration sync.
453
444
6. If the partition number is not yet available (e.g., the instance is still initializing), the hook returns `false`, causing the lifecycle controller to requeue after 1 second and retry.
@@ -522,7 +513,7 @@ Placement groups do not directly affect pricing, but they constrain the set of v
522
513
523
514
## Drift
524
515
525
-
Nodes are marked as drifted when their placement group ID label (`karpenter.k8s.aws/placement-group-id`) no longer matches the EC2NodeClass's resolved placement group ID (`status.placementGroup.id`). This is checked explicitly in the `isPlacementGroupDrifted` function, which compares the NodeClaim's `placement-group-id` label against the resolved PG ID from the NodeClass status.
516
+
Nodes are marked as drifted when their placement group ID label (`karpenter.k8s.aws/placement-group-id`) no longer matches the EC2NodeClass's resolved placement group ID stored in the placement group provider's in-memory store. This is checked explicitly in the `isPlacementGroupDrifted` function, which compares the NodeClaim's `placement-group-id` label against the resolved PG ID from the provider.
0 commit comments