From 67a20f3d2036ce63e61c7076d44d0e775398bc34 Mon Sep 17 00:00:00 2001 From: gaoyk19 Date: Thu, 19 Nov 2026 09:23:03 +0800 Subject: [PATCH] feat(api): support per-pool PodGroup status apply ownership Define schedulingConditions as a map list keyed by required nodePool. Treat each scheduling condition and schedulingState as atomic objects so independent scheduler writers can manage their own status fields. Regenerate the PodGroup CRD and add a changelog fragment. This schema change supports the scheduler status SSA migration in kai-scheduler/KAI-Scheduler#2612. Validation: go test ./scheduling/v2alpha2 -count=1 and git diff --check passed. Signed-off-by: gaoyk19 --- .changes/unreleased/changed-20261116-211258.yaml | 3 +++ config/crd/scheduling.run.ai_podgroups.yaml | 10 +++++++++- scheduling/v2alpha2/podgroup_types.go | 8 ++++++-- 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 .changes/unreleased/changed-20261116-211258.yaml diff --git a/.changes/unreleased/changed-20261116-211258.yaml b/.changes/unreleased/changed-20261116-211258.yaml new file mode 100644 index 0000000..be72538 --- /dev/null +++ b/.changes/unreleased/changed-20261116-211258.yaml @@ -0,0 +1,3 @@ +kind: Changed +body: |- + Key PodGroup scheduling conditions by node pool for independent server-side apply ownership diff --git a/config/crd/scheduling.run.ai_podgroups.yaml b/config/crd/scheduling.run.ai_podgroups.yaml index 638b8ba..480a7de 100644 --- a/config/crd/scheduling.run.ai_podgroups.yaml +++ b/config/crd/scheduling.run.ai_podgroups.yaml @@ -267,7 +267,8 @@ spec: type: object type: object schedulingConditions: - description: The scheduling conditions of PodGroup. + description: The scheduling conditions of PodGroup, keyed by node + pool. items: description: SchedulingCondition contains details for the current scheduling state of this pod group. @@ -409,8 +410,14 @@ spec: type: description: Type is the type of the scheduling condition type: string + required: + - nodePool type: object + x-kubernetes-map-type: atomic type: array + x-kubernetes-list-map-keys: + - nodePool + x-kubernetes-list-type: map schedulingState: description: |- SchedulingState is the scheduler's authoritative view of this pod group. Read-only for @@ -425,6 +432,7 @@ spec: type: string type: array type: object + x-kubernetes-map-type: atomic type: object type: object served: true diff --git a/scheduling/v2alpha2/podgroup_types.go b/scheduling/v2alpha2/podgroup_types.go index ea81f85..048d569 100644 --- a/scheduling/v2alpha2/podgroup_types.go +++ b/scheduling/v2alpha2/podgroup_types.go @@ -188,7 +188,9 @@ type PodGroupStatus struct { // +optional Conditions []PodGroupCondition `json:"conditions,omitempty" protobuf:"bytes,2,opt,name=conditions"` - // The scheduling conditions of PodGroup. + // The scheduling conditions of PodGroup, keyed by node pool. + // +listType=map + // +listMapKey=nodePool // +optional SchedulingConditions []SchedulingCondition `json:"schedulingConditions,omitempty" protobuf:"bytes,7,rep,name=schedulingConditions"` @@ -204,6 +206,7 @@ type PodGroupStatus struct { // PodGroupSchedulingState carries the scheduler's authoritative accounting for this pod group. // It is populated exclusively by the scheduler; all other controllers MUST treat it as read-only. +// +structType=atomic type PodGroupSchedulingState struct { // CorePods names the allocated pods the scheduler protects from preemption and reclaim (the // "core", i.e. the job's minimal satisfying set). Written only for semi-preemptible pod groups, @@ -257,12 +260,13 @@ type PodGroupCondition struct { } // SchedulingCondition contains details for the current scheduling state of this pod group. +// +structType=atomic type SchedulingCondition struct { // Type is the type of the scheduling condition Type SchedulingConditionType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type"` // The Node Pool name on witch the scheduling condition happened - NodePool string `json:"nodePool,omitempty" protobuf:"bytes,2,opt,name=nodePool"` + NodePool string `json:"nodePool" protobuf:"bytes,2,opt,name=nodePool"` // Unique, one-word, CamelCase reason for the phase's last transition. // Deprecated: use Reasons instead