-
Notifications
You must be signed in to change notification settings - Fork 427
[Misc] feature: add Progressing condition in roleset controller #1308
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?
[Misc] feature: add Progressing condition in roleset controller #1308
Conversation
e76b5d3
to
6a27eae
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.
Summary of Changes
Hello @googs1025, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request significantly enhances the status reporting capabilities of the RoleSet
custom resource by introducing a new Progressing
condition. This addition provides a more detailed view of the RoleSet
's lifecycle, allowing users and automated systems to track its transient states as underlying roles are being updated or scaled, thereby improving observability and operational insight.
Highlights
- New Condition Type: Introduced
RoleSetProgressing
as a newConditionType
in the API definition to provide more granular status updates during resource reconciliation. - Enhanced Condition Reasons: Defined a set of new constants for
Ready
,Progressing
, andReplicaFailure
condition reasons (e.g.,RoleSetReasonRolesReady
,RoleSetReasonRolesProgressing
), offering more specific context for status messages. - Progressing Condition Logic: Implemented logic within the
RoleSet
controller's status calculation to determine if aRoleSet
isProgressing
. This state is now set when roles have unready replicas or are in the process of updating, based onReadyReplicas
andUpdatedReadyReplicas
. - Status Update Refinement: Updated existing
RoleSetReady
andRoleSetReplicaFailure
condition setting to utilize the newly defined reason constants, improving consistency and clarity across all status conditions.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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.
Code Review
This pull request introduces a Progressing
condition to the RoleSet
status, which is a valuable addition for observing the state of a RoleSet
during updates. The implementation is mostly correct, but I've identified a few areas for improvement in the sync.go
file to enhance code clarity, correctness, and consistency in user-facing messages. My suggestions include simplifying a redundant condition, making status messages more consistent and grammatically correct, and refining the logic for state transitions of the new Progressing
condition.
if roleStatus.ReadyReplicas < *role.Replicas || | ||
roleStatus.UpdatedReadyReplicas < roleStatus.UpdatedReplicas || | ||
(roleStatus.UpdatedReplicas > 0 && roleStatus.UpdatedReadyReplicas < roleStatus.UpdatedReplicas) { | ||
progressingRoles = append(progressingRoles, role.Name) | ||
isProgressing = true | ||
} |
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 condition to check if a role is progressing is partially redundant. The third part of the ||
condition, (roleStatus.UpdatedReplicas > 0 && roleStatus.UpdatedReadyReplicas < roleStatus.UpdatedReplicas)
, is already covered by the second part, roleStatus.UpdatedReadyReplicas < roleStatus.UpdatedReplicas
.
If UpdatedReadyReplicas
is less than UpdatedReplicas
, it implies UpdatedReplicas
must be greater than 0 (since replica counts are non-negative). This redundancy can be removed to simplify the code and improve clarity.
if roleStatus.ReadyReplicas < *role.Replicas ||
roleStatus.UpdatedReadyReplicas < roleStatus.UpdatedReplicas {
progressingRoles = append(progressingRoles, role.Name)
isProgressing = true
}
pkg/controller/roleset/sync.go
Outdated
orchestrationv1alpha1.RoleSetReady, | ||
v1.ConditionFalse, | ||
orchestrationv1alpha1.RoleSetReasonRolesNotReady, | ||
fmt.Sprintf("Roles %s is not ready", strings.Join(notReadyRoles, ",")), |
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 message for not-ready roles uses is not ready
and ","
as a separator. For better readability and grammatical correctness when multiple roles are listed, consider changing this to are not ready
and using ", "
as a separator. This also makes it consistent with the progressing message on line 142.
fmt.Sprintf("Roles %s are not ready", strings.Join(notReadyRoles, ", ")),
} else { | ||
// If all roles are ready, set the Progressing condition to complete. | ||
currentProgressingCond := utils.GetCondition(rs.Status.Conditions, orchestrationv1alpha1.RoleSetProgressing) | ||
if currentProgressingCond != nil { |
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.
This logic sets the Progressing
condition to False
if it existed in the previous status, regardless of its previous state (True
or False
). To be more precise and avoid unnecessary status updates, it's better to only set the condition to False
if it was previously True
. This more clearly indicates a completed transition from a progressing state.
if currentProgressingCond != nil && currentProgressingCond.Status == v1.ConditionTrue {
@@ -105,20 +107,63 @@ func (r *RoleSetReconciler) calculateStatus(ctx context.Context, rs *orchestrati | |||
if roleStatus.ReadyReplicas < *role.Replicas { | |||
notReadyRoles = append(notReadyRoles, role.Name) | |||
} |
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 current Progressing logic is as here 🤔
SetRoleSetCondition(newStatus, *readyCondition) | ||
} | ||
|
||
if isProgressing { |
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.
If it is Progressing, add condition.
If it is not Progressing, then if the Progressing condition exists, it means it has been completed. If not, it means it is not Progressing.
Signed-off-by: googs1025 <[email protected]>
6a27eae
to
e6d8340
Compare
thanks for driving the efforts. Let me take a look @googs1025 |
I read the PR and notice it expose the progressing status through the condition. We may also need |
I noticed that we only have Paused related fields in Storm Service controller. Do we need to have Paused field in Roleset controller as well? |
Pull Request Description
[Please provide a clear and concise description of your changes here]
Related Issues
Resolves: #[Insert issue number(s)]
Important: Before submitting, please complete the description above and review the checklist below.
Contribution Guidelines (Expand for Details)
We appreciate your contribution to aibrix! To ensure a smooth review process and maintain high code quality, please adhere to the following guidelines:
Pull Request Title Format
Your PR title should start with one of these prefixes to indicate the nature of the change:
[Bug]
: Corrections to existing functionality[CI]
: Changes to build process or CI pipeline[Docs]
: Updates or additions to documentation[API]
: Modifications to aibrix's API or interface[CLI]
: Changes or additions to the Command Line Interface[Misc]
: For changes not covered above (use sparingly)Note: For changes spanning multiple categories, use multiple prefixes in order of importance.
Submission Checklist
By submitting this PR, you confirm that you've read these guidelines and your changes align with the project's contribution standards.