Skip to content

Commit 620058f

Browse files
author
zhuyiqing.wiz
committed
[feat] stormservice support podgroup
Signed-off-by: zhuyiqing.wiz <[email protected]>
1 parent 941e68f commit 620058f

28 files changed

+1980
-93
lines changed

api/orchestration/v1alpha1/groupversion_info.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
const (
2828
StormServiceKind = "StormService"
2929
RoleSetKind = "RoleSet"
30+
PodSetKind = "PodSet"
3031
)
3132

3233
var (

api/orchestration/v1alpha1/podset_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ type PodSetSpec struct {
4141
// +kubebuilder:validation:Enum={ReplaceUnhealthy,Recreate}
4242
// +optional
4343
RecoveryPolicy PodRecoveryPolicy `json:"recoveryPolicy,omitempty"`
44+
45+
// +optional
46+
SchedulingStrategy *SchedulingStrategy `json:"schedulingStrategy,omitempty"`
4447
}
4548

4649
// PodSetStatus defines the observed state of PodSet

api/orchestration/v1alpha1/roleset_types.go

Lines changed: 90 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,96 @@ type RoleSetSpec struct {
3535
UpdateStrategy RoleSetUpdateStrategyType `json:"updateStrategy,omitempty"`
3636

3737
// +optional
38-
SchedulingStrategy SchedulingStrategy `json:"schedulingStrategy,omitempty"`
38+
SchedulingStrategy *SchedulingStrategy `json:"schedulingStrategy,omitempty"`
3939
}
4040

41-
// +enum
41+
// +kubebuilder:validation:MaxProperties=1
4242
type SchedulingStrategy struct {
43-
PodGroup *schedv1alpha1.PodGroupSpec `json:"podGroup,omitempty"`
43+
GodelSchedulingStrategy *GodelSchedulingStrategySpec `json:"godelSchedulingStrategy,omitempty"`
44+
45+
CoschedulingSchedulingStrategy *CoschedulingSchedulingStrategySpec `json:"coschedulingSchedulingStrategy,omitempty"`
46+
47+
VolcanoSchedulingStrategy *VolcanoSchedulingStrategySpec `json:"volcanoSchedulingStrategy,omitempty"`
48+
}
49+
50+
// GodelSchedulingStrategySpec uses godel scheduler's podgroup definition
51+
type GodelSchedulingStrategySpec struct {
52+
// MinMember defines the minimal number of members/tasks to run the pod group;
53+
// if there's not enough resources to start all tasks, the scheduler
54+
// will not start anyone.
55+
MinMember int32 `json:"minMember,omitempty"`
56+
57+
// If specified, indicates the PodGroup's priority. "system-node-critical" and
58+
// "system-cluster-critical" are two special reserved keywords which indicate the highest priorities.
59+
// Any other name must be defined by creating a PriorityClass object with that name.
60+
// If not specified, the PodGroup priority will be default.
61+
// If default priority class doesn't exist, the PodGroup priority will be zero.
62+
// +optional
63+
PriorityClassName string `json:"priorityClassName,omitempty"`
64+
65+
// ScheduleTimeoutSeconds defines the maximal time of tasks to wait before run the pod group;
66+
// +optional
67+
ScheduleTimeoutSeconds *int32 `json:"scheduleTimeoutSeconds,omitempty"`
68+
69+
// Application indicates the podGroup belongs to a logical Application
70+
// This will be used for coordinate with features like drf and faire share.
71+
// +optional
72+
Application string `json:"application,omitempty"`
73+
74+
// Affinity shows the affinity/anti-affinity rules that scheduler needs to follow
75+
// when scheduling instances of this pod group.
76+
// +optional
77+
Affinity *schedv1alpha1.Affinity `json:"affinity,omitempty"`
78+
}
79+
80+
// CoschedulingSchedulingStrategySpec uses coscheduling scheduler-plugin's podgroup definition
81+
type CoschedulingSchedulingStrategySpec struct {
82+
// MinMember defines the minimal number of members/tasks to run the pod group;
83+
// if there's not enough resources to start all tasks, the scheduler
84+
// will not start any.
85+
// The minimum is 1
86+
// +kubebuilder:validation:Minimum=1
87+
MinMember int32 `json:"minMember,omitempty"`
88+
89+
// MinResources defines the minimal resource of members/tasks to run the pod group;
90+
// if there's not enough resources to start all tasks, the scheduler
91+
// will not start any.
92+
MinResources v1.ResourceList `json:"minResources,omitempty"`
93+
94+
// ScheduleTimeoutSeconds defines the maximal time of members/tasks to wait before run the pod group;
95+
ScheduleTimeoutSeconds *int32 `json:"scheduleTimeoutSeconds,omitempty"`
96+
}
97+
98+
// VolcanoSchedulingStrategySpec uses volcano's podgroup definition
99+
type VolcanoSchedulingStrategySpec struct {
100+
// MinMember defines the minimal number of members/tasks to run the pod group;
101+
// if there's not enough resources to start all tasks, the scheduler
102+
// will not start anyone.
103+
MinMember int32 `json:"minMember,omitempty" protobuf:"bytes,1,opt,name=minMember"`
104+
105+
// MinTaskMember defines the minimal number of pods to run each task in the pod group;
106+
// if there's not enough resources to start each task, the scheduler
107+
// will not start anyone.
108+
MinTaskMember map[string]int32 `json:"minTaskMember,omitempty" protobuf:"bytes,1,opt,name=minTaskMember"`
109+
110+
// Queue defines the queue to allocate resource for PodGroup; if queue does not exist,
111+
// the PodGroup will not be scheduled. Defaults to `default` Queue with the lowest weight.
112+
// +optional
113+
Queue string `json:"queue,omitempty" protobuf:"bytes,2,opt,name=queue"`
114+
115+
// If specified, indicates the PodGroup's priority. "system-node-critical" and
116+
// "system-cluster-critical" are two special keywords which indicate the
117+
// highest priorities with the former being the highest priority. Any other
118+
// name must be defined by creating a PriorityClass object with that name.
119+
// If not specified, the PodGroup priority will be default or zero if there is no
120+
// default.
121+
// +optional
122+
PriorityClassName string `json:"priorityClassName,omitempty" protobuf:"bytes,3,opt,name=priorityClassName"`
123+
124+
// MinResources defines the minimal resource of members/tasks to run the pod group;
125+
// if there's not enough resources to start all tasks, the scheduler
126+
// will not start anyone.
127+
MinResources v1.ResourceList `json:"minResources,omitempty" protobuf:"bytes,4,opt,name=minResources"`
44128
}
45129

46130
// +enum
@@ -93,6 +177,9 @@ type RoleSpec struct {
93177
// DisruptionTolerance indicates how many pods can be unavailable during the preemption/eviction.
94178
// +optional
95179
DisruptionTolerance DisruptionTolerance `json:"disruptionTolerance,omitempty"`
180+
181+
// +optional
182+
SchedulingStrategy *SchedulingStrategy `json:"schedulingStrategy,omitempty"`
96183
}
97184

98185
// +enum

api/orchestration/v1alpha1/zz_generated.deepcopy.go

Lines changed: 109 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)