Skip to content

Conversation

@veophi
Copy link
Contributor

@veophi veophi commented Nov 5, 2025

Ⅰ. 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

  • Format your code make fmt.
  • Add unit tests or integration tests.
  • Update the documentation related to the change.

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@RongGu RongGu requested a review from Copilot November 5, 2025 10:43
Copy link
Contributor

Copilot AI left a 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 Coordination and CoordinationRolloutStrategy types 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.

@RongGu RongGu requested a review from Copilot November 5, 2025 12:05
Copy link
Contributor

Copilot AI left a 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.

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.
Copy link

Copilot AI Nov 5, 2025

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.

Suggested change
// 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 uses AI. Check for mistakes.
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.
Copy link

Copilot AI Nov 5, 2025

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.

Suggested change
// 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 uses AI. Check for mistakes.
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.
Copy link

Copilot AI Nov 5, 2025

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.

Suggested change
// 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 uses AI. Check for mistakes.
Comment on lines +52 to +55
// Name of the coordination.
Name string `json:"name"`

// Roles that should be constrained by this coordination.
Copy link

Copilot AI Nov 5, 2025

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.

Suggested change
// 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

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Development Roadmap (v0.5.0)

2 participants