@@ -28,6 +28,63 @@ const (
28
28
UnschedulableEvent Event = "Unschedulable"
29
29
)
30
30
31
+ // PodGroupPhase is the phase of a pod group at the current time.
32
+ type PodGroupPhase string
33
+
34
+ // These are the valid phase of podGroups.
35
+ const (
36
+ // PodPending means the pod group has been accepted by the system, but scheduler can not allocate
37
+ // enough resources to it.
38
+ PodGroupPending PodGroupPhase = "Pending"
39
+
40
+ // PodRunning means `spec.minMember` pods of PodGroups has been in running phase.
41
+ PodGroupRunning PodGroupPhase = "Running"
42
+
43
+ // PodGroupRecovering means part of `spec.minMember` pods have exception, e.g. killed; scheduler will
44
+ // wait for related controller to recover it.
45
+ PodGroupRecovering PodGroupPhase = "Recovering"
46
+
47
+ // PodGroupUnschedulable means part of `spec.minMember` pods are running but the other part can not
48
+ // be scheduled, e.g. not enough resource; scheduler will wait for related controller to recover it.
49
+ PodGroupUnschedulable PodGroupPhase = "Unschedulable"
50
+ )
51
+
52
+ // PodGroupState contains details for the current state of this pod group.
53
+ type PodGroupState struct {
54
+ // Current phase of PodGroup.
55
+ Phase PodGroupPhase `json:"phase,omitempty" protobuf:"bytes,1,opt,name=phase"`
56
+
57
+ // Last time we probed to this Phase.
58
+ // +optional
59
+ LastProbeTime metav1.Time `json:"lastProbeTime,omitempty" protobuf:"bytes,2,opt,name=lastProbeTime"`
60
+
61
+ // Last time the phase transitioned from another to current phase.
62
+ // +optional
63
+ LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"`
64
+
65
+ // Unique, one-word, CamelCase reason for the phase's last transition.
66
+ // +optional
67
+ Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
68
+
69
+ // Human-readable message indicating details about last transition.
70
+ // +optional
71
+ Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
72
+ }
73
+
74
+ const (
75
+ // PodFailedReason is probed if pod of PodGroup failed
76
+ PodFailedReason string = "PodFailed"
77
+
78
+ // PodDeletedReason is probed if pod of PodGroup deleted
79
+ PodDeletedReason string = "PodDeleted"
80
+
81
+ // NotEnoughResourcesReason is probed if there're not enough resources to schedule pods
82
+ NotEnoughResourcesReason string = "NotEnoughResources"
83
+
84
+ // NotEnoughPodsReason is probed if there're not enough tasks compared to `spec.minMember`
85
+ NotEnoughPodsReason string = "NotEnoughTasks"
86
+ )
87
+
31
88
// +genclient
32
89
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
33
90
@@ -67,12 +124,17 @@ type PodGroupStatus struct {
67
124
// The number of actively running pods.
68
125
// +optional
69
126
Running int32 `json:"running,omitempty" protobuf:"bytes,3,opt,name=running"`
127
+
70
128
// The number of pods which reached phase Succeeded.
71
129
// +optional
72
130
Succeeded int32 `json:"succeeded,omitempty" protobuf:"bytes,3,opt,name=succeeded"`
131
+
73
132
// The number of pods which reached phase Failed.
74
133
// +optional
75
134
Failed int32 `json:"failed,omitempty" protobuf:"bytes,3,opt,name=failed"`
135
+
136
+ // +optional
137
+ State PodGroupState `json:"state,omitempty" protobuf:"bytes,1,opt,name=state,casttype=State"`
76
138
}
77
139
78
140
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
0 commit comments