-
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?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Pull Request Overview
This PR introduces a new coordination mechanism for RoleBasedGroup resources, enabling coordinated rollout strategies across multiple roles. The coordination feature allows defining constraints for rolling updates, such as maximum skew, partition, and maximum unavailable replicas between roles.
Key changes:
- Added new
CoordinationandCoordinationRolloutStrategytypes to the API schema - Updated CRDs for both RoleBasedGroup and RoleBasedGroupSet resources to include the coordination field
- Generated corresponding client-go apply configurations and deep copy methods
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| api/workloads/v1alpha1/rolebasedgroup_types.go | Defines new Coordination and CoordinationRolloutStrategy types with rollout coordination fields |
| config/crd/bases/workloads.x-k8s.io_rolebasedgroups.yaml | Updates RoleBasedGroup CRD schema to include coordination field as required |
| config/crd/bases/workloads.x-k8s.io_rolebasedgroupsets.yaml | Updates RoleBasedGroupSet CRD schema to include coordination field in template as required |
| deploy/helm/rbgs/crds/workloads.x-k8s.io_rolebasedgroups.yaml | Helm CRD update mirroring config changes for RoleBasedGroup |
| deploy/helm/rbgs/crds/workloads.x-k8s.io_rolebasedgroupsets.yaml | Helm CRD update mirroring config changes for RoleBasedGroupSet |
| client-go/applyconfiguration/workloads/v1alpha1/rolebasedgroupspec.go | Adds Coordination field and WithCoordination method to apply configuration |
| client-go/applyconfiguration/workloads/v1alpha1/coordination.go | Generated apply configuration for Coordination type |
| client-go/applyconfiguration/workloads/v1alpha1/coordinationrolloutstrategy.go | Generated apply configuration for CoordinationRolloutStrategy type |
| client-go/applyconfiguration/utils.go | Registers new Coordination and CoordinationRolloutStrategy types in ForKind function |
| api/workloads/v1alpha1/zz_generated.deepcopy.go | Generated deep copy methods for new Coordination types |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: veophi <[email protected]>
b4e23ff to
d512730
Compare
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.
Pull Request Overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // 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. |
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=`^[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]+%$` |
| // 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. |
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+%$` |
| // 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. |
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+%$ |
| // Name of the coordination. | ||
| Name string `json:"name"` | ||
|
|
||
| // Roles that should be constrained by this coordination. |
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 Coordination struct has required fields Name and Roles but lacks kubebuilder validation markers (e.g., +kubebuilder:validation:Required, +kubebuilder:validation:MinItems=1 for Roles). Consider adding these to ensure proper validation at the API level.
| // Name of the coordination. | |
| Name string `json:"name"` | |
| // Roles that should be constrained by this coordination. | |
| // Name of the coordination. | |
| // +kubebuilder:validation:Required | |
| Name string `json:"name"` | |
| // Roles that should be constrained by this coordination. | |
| // +kubebuilder:validation:Required | |
| // +kubebuilder:validation:MinItems=1 |
Ⅰ. Motivation
more details in KEP #59.
Ⅱ. Modifications
add coordination api for rbg.
Ⅲ. Does this pull request fix one issue?
fixes #45
Ⅳ. List the added test cases (unit test/integration test) if any, please explain if no tests are needed.
Ⅴ. Describe how to verify it
VI. Special notes for reviews
Checklist
make fmt.