Skip to content

Commit d512730

Browse files
author
veophi
committed
api: add coordination api for rbg
Signed-off-by: veophi <[email protected]>
1 parent 1bc7a21 commit d512730

File tree

10 files changed

+442
-0
lines changed

10 files changed

+442
-0
lines changed

api/workloads/v1alpha1/rolebasedgroup_types.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,44 @@ type RoleBasedGroupSpec struct {
3838

3939
// Configuration for the PodGroup to enable gang-scheduling via supported plugins.
4040
PodGroupPolicy *PodGroupPolicy `json:"podGroupPolicy,omitempty"`
41+
42+
// Coordination describes the requirements of coordination strategies for some specified roles.
43+
// +patchMergeKey=name
44+
// +patchStrategy=merge
45+
// +listType=map
46+
// +listMapKey=name
47+
Coordination []Coordination `json:"coordination,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
48+
}
49+
50+
// Coordination describes the requirements of coordination strategies for roles.
51+
type Coordination struct {
52+
// Name of the coordination.
53+
Name string `json:"name"`
54+
55+
// Roles that should be constrained by this coordination.
56+
Roles []string `json:"roles"`
57+
58+
// RolloutStrategy describes the coordination strategy for rolling update.
59+
RolloutStrategy *CoordinationRolloutStrategy `json:"rolloutStrategy,omitempty"`
60+
}
61+
62+
// CoordinationRolloutStrategy describes the rolling update coordination strategy.
63+
type CoordinationRolloutStrategy struct {
64+
// MaxSkew defines the max skew requirement about updated replicas between the roles when rolling update.
65+
// For example, one RoleBasedGroup with (200 prefills, 100 decodes) will have the
66+
// constraint `abs(updated_prefills/200, updated_decodes/100) <= MaxSkew`.
67+
// Only support percentage value, and defaults to nil.
68+
MaxSkew *intstr.IntOrString `json:"maxSkew,omitempty"`
69+
70+
// Partition indicates the replicas at which the role should be partitioned for rolling update.
71+
// If Partition is not nil, the Partition of the roles' rolloutStrategy will be overridden by this field.
72+
// Only support percentage value, and defaults to nil.
73+
Partition *intstr.IntOrString `json:"partition,omitempty"`
74+
75+
// MaxUnavailable defines the updating step during rolling. If MaxUnavailable is not nil,
76+
// the MaxUnavailable of the roles' rolloutStrategy will be overridden by this field.
77+
// Only support percentage value, and defaults to nil.
78+
MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"`
4179
}
4280

4381
// PodGroupPolicy represents a PodGroup configuration for gang-scheduling.

api/workloads/v1alpha1/zz_generated.deepcopy.go

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

client-go/applyconfiguration/utils.go

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

client-go/applyconfiguration/workloads/v1alpha1/coordination.go

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

client-go/applyconfiguration/workloads/v1alpha1/coordinationrolloutstrategy.go

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

client-go/applyconfiguration/workloads/v1alpha1/rolebasedgroupspec.go

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

config/crd/bases/workloads.x-k8s.io_rolebasedgroups.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,57 @@ spec:
4646
spec:
4747
description: RoleBasedGroupSpec defines the desired state of RoleBasedGroup.
4848
properties:
49+
coordination:
50+
description: Coordination describes the requirements of coordination
51+
strategies for some specified roles.
52+
items:
53+
description: Coordination describes the requirements of coordination
54+
strategies for roles.
55+
properties:
56+
name:
57+
description: Name of the coordination.
58+
type: string
59+
roles:
60+
description: Roles that should be constrained by this coordination.
61+
items:
62+
type: string
63+
type: array
64+
rolloutStrategy:
65+
description: RolloutStrategy describes the coordination strategy
66+
for rolling update.
67+
properties:
68+
maxSkew:
69+
anyOf:
70+
- type: integer
71+
- type: string
72+
description: MaxSkew defines the max skew requirement about
73+
updated replicas between the roles when rolling update.
74+
x-kubernetes-int-or-string: true
75+
maxUnavailable:
76+
anyOf:
77+
- type: integer
78+
- type: string
79+
description: |-
80+
MaxUnavailable defines the updating step during rolling. If MaxUnavailable is not nil,
81+
the MaxUnavailable of the roles' rolloutStrategy will be overridden by this field.
82+
x-kubernetes-int-or-string: true
83+
partition:
84+
anyOf:
85+
- type: integer
86+
- type: string
87+
description: |-
88+
Partition indicates the replicas at which the role should be partitioned for rolling update.
89+
If Partition is not nil, the Partition of the roles' rolloutStrategy will be overridden by this field.
90+
x-kubernetes-int-or-string: true
91+
type: object
92+
required:
93+
- name
94+
- roles
95+
type: object
96+
type: array
97+
x-kubernetes-list-map-keys:
98+
- name
99+
x-kubernetes-list-type: map
49100
podGroupPolicy:
50101
description: Configuration for the PodGroup to enable gang-scheduling
51102
via supported plugins.

config/crd/bases/workloads.x-k8s.io_rolebasedgroupsets.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,58 @@ spec:
6060
template:
6161
description: Template describes the RoleBasedGroup that will be created.
6262
properties:
63+
coordination:
64+
description: Coordination describes the requirements of coordination
65+
strategies for some specified roles.
66+
items:
67+
description: Coordination describes the requirements of coordination
68+
strategies for roles.
69+
properties:
70+
name:
71+
description: Name of the coordination.
72+
type: string
73+
roles:
74+
description: Roles that should be constrained by this coordination.
75+
items:
76+
type: string
77+
type: array
78+
rolloutStrategy:
79+
description: RolloutStrategy describes the coordination
80+
strategy for rolling update.
81+
properties:
82+
maxSkew:
83+
anyOf:
84+
- type: integer
85+
- type: string
86+
description: MaxSkew defines the max skew requirement
87+
about updated replicas between the roles when rolling
88+
update.
89+
x-kubernetes-int-or-string: true
90+
maxUnavailable:
91+
anyOf:
92+
- type: integer
93+
- type: string
94+
description: |-
95+
MaxUnavailable defines the updating step during rolling. If MaxUnavailable is not nil,
96+
the MaxUnavailable of the roles' rolloutStrategy will be overridden by this field.
97+
x-kubernetes-int-or-string: true
98+
partition:
99+
anyOf:
100+
- type: integer
101+
- type: string
102+
description: |-
103+
Partition indicates the replicas at which the role should be partitioned for rolling update.
104+
If Partition is not nil, the Partition of the roles' rolloutStrategy will be overridden by this field.
105+
x-kubernetes-int-or-string: true
106+
type: object
107+
required:
108+
- name
109+
- roles
110+
type: object
111+
type: array
112+
x-kubernetes-list-map-keys:
113+
- name
114+
x-kubernetes-list-type: map
63115
podGroupPolicy:
64116
description: Configuration for the PodGroup to enable gang-scheduling
65117
via supported plugins.

0 commit comments

Comments
 (0)