-
Notifications
You must be signed in to change notification settings - Fork 1k
add volcanojob interpreter #6790
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: master
Are you sure you want to change the base?
Conversation
Welcome @dekaihu! It looks like this is your first PR to karmada-io/karmada 🎉 |
Summary of ChangesHello @dekaihu, 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 integrates support for Volcano Jobs ( Highlights
Using Gemini Code AssistThe 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 by creating a comment using either
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 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. 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
|
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 resource interpreter for Volcano jobs. The implementation is a good start, but I've found several issues, primarily within the Lua scripts for status aggregation and component resource discovery. There are cases where values are overwritten instead of being aggregated, which would lead to incorrect behavior. I've also identified a critical typo that would cause a runtime error. My review includes specific suggestions to address these points and improve the robustness of the interpreter.
.../default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/customizations.yaml
Show resolved
Hide resolved
.../default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/customizations.yaml
Outdated
Show resolved
Hide resolved
.../default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/customizations.yaml
Show resolved
Hide resolved
.../default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/customizations.yaml
Outdated
Show resolved
Hide resolved
.../default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/customizations.yaml
Outdated
Show resolved
Hide resolved
.../default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/customizations.yaml
Outdated
Show resolved
Hide resolved
11d31f9
to
0876da6
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6790 +/- ##
==========================================
+ Coverage 45.73% 45.84% +0.11%
==========================================
Files 689 690 +1
Lines 57104 57300 +196
==========================================
+ Hits 26114 26269 +155
- Misses 29358 29401 +43
+ Partials 1632 1630 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
/assign
/gemini review |
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 adds support for Volcano Job resource interpretation in Karmada by implementing a ResourceInterpreterCustomization for batch.volcano.sh/v1alpha1/Job resources.
- Implements comprehensive resource interpretation including replica revision, health checks, component resource analysis, and status aggregation/reflection
- Adds test infrastructure with test configuration and status test data
- Provides Lua scripts for handling Volcano Job lifecycle operations in multi-cluster environments
Reviewed Changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
customizations.yaml | Main ResourceInterpreterCustomization with Lua scripts for Volcano Job interpretation |
customizations_tests.yaml | Test configuration file (currently commented out) for validating the interpreter |
status-file.yaml | Test data representing aggregated status information for testing status operations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
...lt/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/testdata/status-file.yaml
Outdated
Show resolved
Hide resolved
.../default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/customizations.yaml
Show resolved
Hide resolved
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 resource interpreter for VolcanoJob (batch.volcano.sh/v1alpha1.Job
). The implementation covers replica revision, health interpretation, component resource discovery, status aggregation, and status reflection using Lua scripts.
My review has identified a few issues:
- A potential runtime error in the
InterpretHealth
function. - A bug in the
durationVal
function withinstatusAggregation
that would lead to incorrect duration comparisons. - Some redundant code in the
statusReflection
function. - The tests for the interpreter are currently commented out, and required test data files are missing, which prevents verification of the implementation.
I've provided specific comments and suggestions to address these points. Please enable and complete the tests to ensure the interpreter is robust.
.../default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/customizations.yaml
Outdated
Show resolved
Hide resolved
.../default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/customizations.yaml
Show resolved
Hide resolved
...lt/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/customizations_tests.yaml
Outdated
Show resolved
Hide resolved
.../default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/customizations.yaml
Show resolved
Hide resolved
.../default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/customizations.yaml
Outdated
Show resolved
Hide resolved
.../default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/customizations.yaml
Outdated
Show resolved
Hide resolved
.../default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/customizations.yaml
Outdated
Show resolved
Hide resolved
[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.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
fadcbf7
to
4963cf3
Compare
Test Steps:
The results on the Karmada control plane are as follows:
Results on the member cluster control plane:
The results on the Karmada control plane are as follows:
Results on the member cluster control plane:
member2:
|
faee451
to
8f06d4c
Compare
.../default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/customizations.yaml
Show resolved
Hide resolved
.../default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/customizations.yaml
Outdated
Show resolved
Hide resolved
status.unknown = status.unknown + (s.unknown or 0) | ||
status.version = math.max(status.version, s.version or 0) | ||
status.retryCount = status.retryCount + (s.retryCount or 0) | ||
status.state = s.state |
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 state
might be overwritten unexpectly, for instance, we are aggreatingstate
s from two member clusters, the second state would overrite the first one.
But it good enough for current stage, as Karmada not supports split Volcano Jobs currently.
It's hard to aggreate the state, we have met this situation when aggreating Kubernetes Jobs at https://github.com/karmada-io/karmada/blob/adef1e59748e1e1d31cb75fffe406b5dd69a66d7/pkg/util/helper/job.go#L76-L9.
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.
@dekaihu Any idea about how to handle the state
aggregation?
b39d0bd
to
abdb0c4
Compare
Signed-off-by: hudekai <[email protected]>
53fff15
to
bc07584
Compare
What type of PR is this?
/kind feature
What this PR does / why we need it:
Which issue(s) this PR fixes:
Part of #6589
Special notes for your reviewer:
Does this PR introduce a user-facing change?: