Add default comment and defaulting logic for TaskSpec.MinAvailable#188
Add default comment and defaulting logic for TaskSpec.MinAvailable#188SuyashParmar wants to merge 1 commit intovolcano-sh:masterfrom
Conversation
Signed-off-by: SuyashParmar <[email protected]>
|
Welcome @SuyashParmar! |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Summary of Changes
Hello @SuyashParmar, 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!
I've implemented a new Default() method for the TaskSpec struct. This method automatically assigns the value of Replicas to MinAvailable if MinAvailable is not specified, standardizing the default behavior for task specifications and ensuring MinAvailable always has a sensible fallback.
Highlights
- Defaulting Logic: I've introduced a
Default()method for theTaskSpecstruct to automatically setMinAvailable. - Field Default Value: I've ensured that
TaskSpec.MinAvailablenow defaults to the value ofTaskSpec.Replicasif it is not explicitly set.
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 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 or fill out our survey 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.
Code Review
This pull request introduces a Default() method for TaskSpec to set a default value for MinAvailable if it's not provided. The review identifies a potential issue with field aliasing in the current implementation, which could lead to subtle bugs and inconsistent behavior. A suggestion is provided to fix this by decoupling the defaulted value from its source.
| // Default sets default values for TaskSpec fields. | ||
| func (t *TaskSpec) Default() { | ||
| if t.MinAvailable == nil { | ||
| t.MinAvailable = &t.Replicas |
There was a problem hiding this comment.
|
Please also execute |
| } | ||
|
|
||
| // Default sets default values for TaskSpec fields. | ||
| func (t *TaskSpec) Default() { |
There was a problem hiding this comment.
Can this take effect when the job CRD created?
There was a problem hiding this comment.
The Default() method will only take effect if a defaulting webhook is enabled for the Job CRD, or if the API server is set up to call it via controller-runtime's defaulting registration. If neither is set up, the method will not be invoked automatically when a Job is created.
There was a problem hiding this comment.
Can this take effect when the job CRD created?
sir waiting for the confirmation ?
There was a problem hiding this comment.
Sorry for late.
In volcano, there is a seperate webhook,so I'm curious when and where this Default method will take effect: )
done, ran successfully |
And there is no CRD definition changed, so seems the default value will not be set automatically. |
This PR adds a comment to TaskSpec.MinAvailable indicating it defaults to the task's Replicas, and implements a Default() method to set MinAvailable to Replicas if unset.