@@ -17,18 +17,10 @@ limitations under the License.
17
17
package v1alpha1
18
18
19
19
import (
20
+ "k8s.io/api/core/v1"
20
21
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21
22
)
22
23
23
- // Event represent the phase of PodGroup, e.g. pod-failed.
24
- type Event string
25
-
26
- const (
27
- EvictEvent Event = "Evict"
28
- UnschedulableEvent Event = "Unschedulable"
29
- FailedSchedulingEvent Event = "FailedScheduling"
30
- )
31
-
32
24
// PodGroupPhase is the phase of a pod group at the current time.
33
25
type PodGroupPhase string
34
26
@@ -41,35 +33,39 @@ const (
41
33
// PodRunning means `spec.minMember` pods of PodGroups has been in running phase.
42
34
PodGroupRunning PodGroupPhase = "Running"
43
35
44
- // PodGroupRecovering means part of `spec.minMember` pods have exception, e.g. killed; scheduler will
45
- // wait for related controller to recover it.
46
- PodGroupRecovering PodGroupPhase = "Recovering"
47
-
48
- // PodGroupUnschedulable means part of `spec.minMember` pods are running but the other part can not
36
+ // PodGroupUnknown means part of `spec.minMember` pods are running but the other part can not
49
37
// be scheduled, e.g. not enough resource; scheduler will wait for related controller to recover it.
50
- PodGroupUnschedulable PodGroupPhase = "Unschedulable "
38
+ PodGroupUnknown PodGroupPhase = "Unknown "
51
39
)
52
40
53
- // PodGroupState contains details for the current state of this pod group.
54
- type PodGroupState struct {
55
- // Current phase of PodGroup.
56
- Phase PodGroupPhase `json:"phase,omitempty" protobuf:"bytes,1,opt,name=phase"`
41
+ type PodGroupConditionType string
57
42
58
- // Last time we probed to this Phase.
59
- // +optional
60
- LastProbeTime metav1.Time `json:"lastProbeTime,omitempty" protobuf:"bytes,2,opt,name=lastProbeTime"`
43
+ const (
44
+ PodGroupUnschedulableType PodGroupConditionType = "Unschedulable"
45
+ )
46
+
47
+ // PodGroupCondition contains details for the current state of this pod group.
48
+ type PodGroupCondition struct {
49
+ // Type is the type of the condition
50
+ Type PodGroupConditionType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type"`
51
+
52
+ // Status is the status of the condition.
53
+ Status v1.ConditionStatus `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"`
54
+
55
+ // The ID of condition transition.
56
+ TransitionID string `json:"transitionID,omitempty" protobuf:"bytes,3,opt,name=transitionID"`
61
57
62
58
// Last time the phase transitioned from another to current phase.
63
59
// +optional
64
- LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3 ,opt,name=lastTransitionTime"`
60
+ LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,4 ,opt,name=lastTransitionTime"`
65
61
66
62
// Unique, one-word, CamelCase reason for the phase's last transition.
67
63
// +optional
68
- Reason string `json:"reason,omitempty" protobuf:"bytes,4 ,opt,name=reason"`
64
+ Reason string `json:"reason,omitempty" protobuf:"bytes,5 ,opt,name=reason"`
69
65
70
66
// Human-readable message indicating details about last transition.
71
67
// +optional
72
- Message string `json:"message,omitempty" protobuf:"bytes,5 ,opt,name=message"`
68
+ Message string `json:"message,omitempty" protobuf:"bytes,6 ,opt,name=message"`
73
69
}
74
70
75
71
const (
@@ -122,21 +118,24 @@ type PodGroupSpec struct {
122
118
123
119
// PodGroupStatus represents the current state of a pod group.
124
120
type PodGroupStatus struct {
125
- // The state of PodGroup.
121
+ // Current phase of PodGroup.
122
+ Phase PodGroupPhase `json:"phase,omitempty" protobuf:"bytes,1,opt,name=phase"`
123
+
124
+ // The conditions of PodGroup.
126
125
// +optional
127
- State PodGroupState `json:"state ,omitempty" protobuf:"bytes,1 ,opt,name=state,casttype=State "`
126
+ Conditions [] PodGroupCondition `json:"conditions ,omitempty" protobuf:"bytes,2 ,opt,name=conditions "`
128
127
129
128
// The number of actively running pods.
130
129
// +optional
131
- Running int32 `json:"running,omitempty" protobuf:"bytes,2 ,opt,name=running"`
130
+ Running int32 `json:"running,omitempty" protobuf:"bytes,3 ,opt,name=running"`
132
131
133
132
// The number of pods which reached phase Succeeded.
134
133
// +optional
135
- Succeeded int32 `json:"succeeded,omitempty" protobuf:"bytes,3 ,opt,name=succeeded"`
134
+ Succeeded int32 `json:"succeeded,omitempty" protobuf:"bytes,4 ,opt,name=succeeded"`
136
135
137
136
// The number of pods which reached phase Failed.
138
137
// +optional
139
- Failed int32 `json:"failed,omitempty" protobuf:"bytes,4 ,opt,name=failed"`
138
+ Failed int32 `json:"failed,omitempty" protobuf:"bytes,5 ,opt,name=failed"`
140
139
}
141
140
142
141
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
0 commit comments