Skip to content

[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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

googs1025
Copy link
Collaborator

Pull Request Description

[Please provide a clear and concise description of your changes here]

  • add Progressing condition in roleset controller

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

  • PR title includes appropriate prefix(es)
  • Changes are clearly explained in the PR description
  • New and existing tests pass successfully
  • Code adheres to project style and best practices
  • Documentation updated to reflect changes (if applicable)
  • Thorough testing completed, no regressions introduced

By submitting this PR, you confirm that you've read these guidelines and your changes align with the project's contribution standards.

@googs1025 googs1025 force-pushed the support/progressing/condition branch from e76b5d3 to 6a27eae Compare July 19, 2025 08:57
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 new ConditionType 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, and ReplicaFailure 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 a RoleSet is Progressing. This state is now set when roles have unready replicas or are in the process of updating, based on ReadyReplicas and UpdatedReadyReplicas.
  • Status Update Refinement: Updated existing RoleSetReady and RoleSetReplicaFailure 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

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

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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.

Comment on lines +110 to +115
if roleStatus.ReadyReplicas < *role.Replicas ||
roleStatus.UpdatedReadyReplicas < roleStatus.UpdatedReplicas ||
(roleStatus.UpdatedReplicas > 0 && roleStatus.UpdatedReadyReplicas < roleStatus.UpdatedReplicas) {
progressingRoles = append(progressingRoles, role.Name)
isProgressing = true
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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
			}

orchestrationv1alpha1.RoleSetReady,
v1.ConditionFalse,
orchestrationv1alpha1.RoleSetReasonRolesNotReady,
fmt.Sprintf("Roles %s is not ready", strings.Join(notReadyRoles, ",")),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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)
}
Copy link
Collaborator Author

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 {
Copy link
Collaborator Author

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.

@googs1025 googs1025 force-pushed the support/progressing/condition branch from 6a27eae to e6d8340 Compare July 19, 2025 09:06
@googs1025 googs1025 changed the title [Misc] feature: support add condition in roleset controller [Misc] feature: add Progressing condition in roleset controller Jul 19, 2025
@Jeffwan
Copy link
Collaborator

Jeffwan commented Jul 20, 2025

thanks for driving the efforts. Let me take a look @googs1025

@Jeffwan
Copy link
Collaborator

Jeffwan commented Jul 23, 2025

I read the PR and notice it expose the progressing status through the condition. We may also need pause interaction. I think the initial requirement is not that clear. Let me collect more feedback and polish the original issue.

@googs1025
Copy link
Collaborator Author

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?

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.

2 participants