@@ -31,67 +31,91 @@ const (
31
31
// PodPending means the pod group has been accepted by the system, but scheduler can not allocate
32
32
// enough resources to it.
33
33
PodGroupPending PodGroupPhase = " Pending"
34
+
34
35
// PodRunning means `spec.minMember` pods of PodGroups has been in running phase.
35
36
PodGroupRunning PodGroupPhase = " Running"
36
- // PodGroupRecovering means part of `spec.minMember` pods have exception, e.g. killed; scheduler will
37
- // wait for related controller to recover it.
38
- PodGroupRecovering PodGroupPhase = " Recovering"
39
- // PodGroupUnschedulable means part of `spec.minMember` pods are running but the other part can not
40
- // be scheduled, e.g. not enough resource; scheduler will wait for related controller to recover it.
41
- PodGroupUnschedulable PodGroupPhase = " Unschedulable"
37
+
38
+ // PodGroupUnknown means part of `spec.minMember` pods are running but the other part can not
39
+ // be scheduled, e.g. not enough resource; scheduler will wait for related controller to recover it.
40
+ PodGroupUnknown PodGroupPhase = " Unknown"
42
41
)
43
42
43
+ type PodGroupConditionType string
44
+
44
45
const (
45
- // PodFailedReason is probed if pod of PodGroup failed
46
- PodFailedReason string = " PodFailed"
47
- // PodDeletedReason is probed if pod of PodGroup deleted
48
- PodDeletedReason string = " PodDeleted"
49
- // NotEnoughResourcesReason is probed if there're not enough resources to schedule pods
50
- NotEnoughResourcesReason string = " NotEnoughResources"
51
- // NotEnoughPodsReason is probed if there're not enough tasks compared to `spec.minMember`
52
- NotEnoughPodsReason string = " NotEnoughTasks"
46
+ PodGroupUnschedulableType PodGroupConditionType = " Unschedulable"
53
47
)
54
48
55
- // PodGroupState contains details for the current state of this pod group.
56
- type PodGroupState struct {
57
- // Current phase of PodGroup.
58
- Phase PodGroupPhase ` json:"phase,omitempty" protobuf:"bytes,1,opt,name=phase"`
59
-
60
- // Last time we probed to this Phase.
61
- // +optional
62
- LastProbeTime metav1.Time ` json:"lastProbeTime,omitempty" protobuf:"bytes,2,opt,name=lastProbeTime"`
49
+ // PodGroupCondition contains details for the current state of this pod group.
50
+ type PodGroupCondition struct {
51
+ // Type is the type of the condition
52
+ Type PodGroupConditionType ` json:"type,omitempty" protobuf:"bytes,1,opt,name=type"`
53
+
54
+ // Status is the status of the condition.
55
+ Status v1.ConditionStatus ` json:"status,omitempty" protobuf:"bytes,2,opt,name=status"`
56
+
57
+ // The ID of condition transition.
58
+ TransitionID string ` json:"transitionID,omitempty" protobuf:"bytes,3,opt,name=transitionID"`
59
+
63
60
// Last time the phase transitioned from another to current phase.
64
61
// +optional
65
- LastTransitionTime metav1.Time ` json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"`
62
+ LastTransitionTime metav1.Time ` json:"lastTransitionTime,omitempty" protobuf:"bytes,4,opt,name=lastTransitionTime"`
63
+
66
64
// Unique, one-word, CamelCase reason for the phase's last transition.
67
65
// +optional
68
- Reason string ` json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
66
+ Reason string ` json:"reason,omitempty" protobuf:"bytes,5,opt,name=reason"`
67
+
69
68
// Human-readable message indicating details about last transition.
70
69
// +optional
71
- Message string ` json:"message,omitempty" protobuf:"bytes,5 ,opt,name=message"`
70
+ Message string ` json:"message,omitempty" protobuf:"bytes,6 ,opt,name=message"`
72
71
}
73
72
73
+ const (
74
+ // PodFailedReason is probed if pod of PodGroup failed
75
+ PodFailedReason string = " PodFailed"
76
+
77
+ // PodDeletedReason is probed if pod of PodGroup deleted
78
+ PodDeletedReason string = " PodDeleted"
79
+
80
+ // NotEnoughResourcesReason is probed if there're not enough resources to schedule pods
81
+ NotEnoughResourcesReason string = " NotEnoughResources"
82
+
83
+ // NotEnoughPodsReason is probed if there're not enough tasks compared to `spec.minMember`
84
+ NotEnoughPodsReason string = " NotEnoughTasks"
85
+ )
86
+
87
+ // PodGroupStatus represents the current state of a pod group.
74
88
type PodGroupStatus struct {
75
- ......
89
+ // Current phase of PodGroup.
90
+ Phase PodGroupPhase ` json:"phase,omitempty" protobuf:"bytes,1,opt,name=phase"`
91
+
92
+ // The conditions of PodGroup.
93
+ // +optional
94
+ Conditions []PodGroupCondition ` json:"conditions,omitempty" protobuf:"bytes,2,opt,name=conditions"`
76
95
96
+ // The number of actively running pods.
77
97
// +optional
78
- State PodGroupState ` json:"state,omitempty" protobuf:"bytes,1,opt,name=state,casttype=State"`
98
+ Running int32 ` json:"running,omitempty" protobuf:"bytes,3,opt,name=running"`
99
+
100
+ // The number of pods which reached phase Succeeded.
101
+ // +optional
102
+ Succeeded int32 ` json:"succeeded,omitempty" protobuf:"bytes,4,opt,name=succeeded"`
103
+
104
+ // The number of pods which reached phase Failed.
105
+ // +optional
106
+ Failed int32 ` json:"failed,omitempty" protobuf:"bytes,5,opt,name=failed"`
79
107
}
108
+
80
109
```
81
110
82
111
According to the PodGroup's lifecycle, the following phase/state transactions are reasonable. And related
83
112
reasons will be appended to ` Reason ` field.
84
113
85
- | From | To | Reason |
86
- | ---------------| ---------------| ---------|
87
- | Pending | Running | When every pods of ` spec.minMember ` are running |
88
- | Pending | Recovering | When only part of ` spec.minMember ` are running and the other part pod are rejected by kubelet |
89
- | Running | Recovering | When part of ` spec.minMember ` have exception, e.g. kill |
90
- | Recovering | Running | When the failed pods re-run successfully |
91
- | Recovering | Unschedulable | When the new pod can not be scheduled |
92
- | Unschedulable | Pending | When all pods (` spec.minMember ` ) in PodGroups are deleted |
93
- | Unschedulable | Running | When all pods (` spec.minMember ` ) are deleted |
94
-
114
+ | From | To | Reason |
115
+ | ---------| ---------------| ---------|
116
+ | Pending | Running | When every pods of ` spec.minMember ` are running |
117
+ | Running | Unknown | When some pods of ` spec.minMember ` are restarted but can not be rescheduled |
118
+ | Unknown | Pending | When all pods (` spec.minMember ` ) in PodGroups are deleted |
95
119
96
120
## Feature Interaction
97
121
@@ -110,8 +134,7 @@ Cluster-Autoscaler right now. Alternative solution will be proposed later for th
110
134
### Operators/Controllers
111
135
112
136
The lifecycle of ` PodGroup ` are managed by operators/controllers, the scheduler only probes related state for
113
- controllers. For example, if ` PodGroup ` is ` Unschedulable ` for MPI job, the controller need to re-start all
114
- pods in ` PodGroup ` .
137
+ controllers. For example, if ` PodGroup ` is ` Unknown ` for MPI job, the controller need to re-start all pods in ` PodGroup ` .
115
138
116
139
## Reference
117
140
0 commit comments