-
Notifications
You must be signed in to change notification settings - Fork 32
api: add coordination api for rbg #84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -38,6 +38,44 @@ type RoleBasedGroupSpec struct { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Configuration for the PodGroup to enable gang-scheduling via supported plugins. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PodGroupPolicy *PodGroupPolicy `json:"podGroupPolicy,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Coordination describes the requirements of coordination strategies for some specified roles. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // +patchMergeKey=name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // +patchStrategy=merge | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // +listType=map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // +listMapKey=name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Coordination []Coordination `json:"coordination,omitempty" patchStrategy:"merge" patchMergeKey:"name"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Coordination describes the requirements of coordination strategies for roles. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type Coordination struct { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Name of the coordination. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Name string `json:"name"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Roles that should be constrained by this coordination. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Roles []string `json:"roles"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // RolloutStrategy describes the coordination strategy for rolling update. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RolloutStrategy *CoordinationRolloutStrategy `json:"rolloutStrategy,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // CoordinationRolloutStrategy describes the rolling update coordination strategy. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type CoordinationRolloutStrategy struct { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // MaxSkew defines the max skew requirement about updated replicas between the roles when rolling update. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // For example, one RoleBasedGroup with (200 prefills, 100 decodes) will have the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // constraint `abs(updated_prefills/200, updated_decodes/100) <= MaxSkew`. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
RongGu marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Only support percentage value, and defaults to nil. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MaxSkew *intstr.IntOrString `json:"maxSkew,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Partition indicates the replicas at which the role should be partitioned for rolling update. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // If Partition is not nil, the Partition of the roles' rolloutStrategy will be overridden by this field. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Only support percentage value, and defaults to nil. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Partition *intstr.IntOrString `json:"partition,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // MaxUnavailable defines the updating step during rolling. If MaxUnavailable is not nil, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // the MaxUnavailable of the roles' rolloutStrategy will be overridden by this field. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Only support percentage value, and defaults to nil. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+67
to
+77
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Only support percentage value, and defaults to nil. | |
| MaxSkew *intstr.IntOrString `json:"maxSkew,omitempty"` | |
| // Partition indicates the replicas at which the role should be partitioned for rolling update. | |
| // If Partition is not nil, the Partition of the roles' rolloutStrategy will be overridden by this field. | |
| // Only support percentage value, and defaults to nil. | |
| Partition *intstr.IntOrString `json:"partition,omitempty"` | |
| // MaxUnavailable defines the updating step during rolling. If MaxUnavailable is not nil, | |
| // the MaxUnavailable of the roles' rolloutStrategy will be overridden by this field. | |
| // Only support percentage value, and defaults to nil. | |
| // Only support percentage value, and defaults to nil. | |
| // +kubebuilder:validation:Pattern=`^[0-9]+%$` | |
| MaxSkew *intstr.IntOrString `json:"maxSkew,omitempty"` | |
| // Partition indicates the replicas at which the role should be partitioned for rolling update. | |
| // If Partition is not nil, the Partition of the roles' rolloutStrategy will be overridden by this field. | |
| // Only support percentage value, and defaults to nil. | |
| // +kubebuilder:validation:Pattern=`^[0-9]+%$` | |
| Partition *intstr.IntOrString `json:"partition,omitempty"` | |
| // MaxUnavailable defines the updating step during rolling. If MaxUnavailable is not nil, | |
| // the MaxUnavailable of the roles' rolloutStrategy will be overridden by this field. | |
| // Only support percentage value, and defaults to nil. | |
| // +kubebuilder:validation:Pattern=`^[0-9]+%$` |
Copilot
AI
Nov 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment states 'Only support percentage value' but the field type is *intstr.IntOrString which accepts both integer and string values. Consider adding validation (e.g., +kubebuilder:validation:Pattern) to enforce percentage format if only percentages are truly supported, or update the documentation to clarify what formats are accepted.
| // Only support percentage value, and defaults to nil. | |
| MaxSkew *intstr.IntOrString `json:"maxSkew,omitempty"` | |
| // Partition indicates the replicas at which the role should be partitioned for rolling update. | |
| // If Partition is not nil, the Partition of the roles' rolloutStrategy will be overridden by this field. | |
| // Only support percentage value, and defaults to nil. | |
| Partition *intstr.IntOrString `json:"partition,omitempty"` | |
| // MaxUnavailable defines the updating step during rolling. If MaxUnavailable is not nil, | |
| // the MaxUnavailable of the roles' rolloutStrategy will be overridden by this field. | |
| // Only support percentage value, and defaults to nil. | |
| // Only support percentage value, and defaults to nil. | |
| // +kubebuilder:validation:Pattern=`^\d+%$` | |
| MaxSkew *intstr.IntOrString `json:"maxSkew,omitempty"` | |
| // Partition indicates the replicas at which the role should be partitioned for rolling update. | |
| // If Partition is not nil, the Partition of the roles' rolloutStrategy will be overridden by this field. | |
| // Only support percentage value, and defaults to nil. | |
| // +kubebuilder:validation:Pattern=`^\d+%$` | |
| Partition *intstr.IntOrString `json:"partition,omitempty"` | |
| // MaxUnavailable defines the updating step during rolling. If MaxUnavailable is not nil, | |
| // the MaxUnavailable of the roles' rolloutStrategy will be overridden by this field. | |
| // Only support percentage value, and defaults to nil. | |
| // +kubebuilder:validation:Pattern=`^\d+%$` |
Copilot
AI
Nov 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment states 'Only support percentage value' but the field type is *intstr.IntOrString which accepts both integer and string values. Consider adding validation (e.g., +kubebuilder:validation:Pattern) to enforce percentage format if only percentages are truly supported, or update the documentation to clarify what formats are accepted.
| // Only support percentage value, and defaults to nil. | |
| MaxSkew *intstr.IntOrString `json:"maxSkew,omitempty"` | |
| // Partition indicates the replicas at which the role should be partitioned for rolling update. | |
| // If Partition is not nil, the Partition of the roles' rolloutStrategy will be overridden by this field. | |
| // Only support percentage value, and defaults to nil. | |
| Partition *intstr.IntOrString `json:"partition,omitempty"` | |
| // MaxUnavailable defines the updating step during rolling. If MaxUnavailable is not nil, | |
| // the MaxUnavailable of the roles' rolloutStrategy will be overridden by this field. | |
| // Only support percentage value, and defaults to nil. | |
| // Only support percentage value, and defaults to nil. | |
| // +kubebuilder:validation:Pattern=^\d+%$ | |
| MaxSkew *intstr.IntOrString `json:"maxSkew,omitempty"` | |
| // Partition indicates the replicas at which the role should be partitioned for rolling update. | |
| // If Partition is not nil, the Partition of the roles' rolloutStrategy will be overridden by this field. | |
| // Only support percentage value, and defaults to nil. | |
| // +kubebuilder:validation:Pattern=^\d+%$ | |
| Partition *intstr.IntOrString `json:"partition,omitempty"` | |
| // MaxUnavailable defines the updating step during rolling. If MaxUnavailable is not nil, | |
| // the MaxUnavailable of the roles' rolloutStrategy will be overridden by this field. | |
| // Only support percentage value, and defaults to nil. | |
| // +kubebuilder:validation:Pattern=^\d+%$ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Coordination struct has required fields
NameandRolesbut lacks kubebuilder validation markers (e.g.,+kubebuilder:validation:Required,+kubebuilder:validation:MinItems=1for Roles). Consider adding these to ensure proper validation at the API level.