Fix CronFederatedHPA missing targetReplicas panic#7727
Conversation
|
[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 |
Summary of ChangesHello, 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 addresses a runtime panic in the CronFederatedHPA controller. By validating the presence of targetReplicas before attempting to scale workloads, the controller now gracefully handles misconfigured scaling rules by returning a descriptive error instead of crashing. 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 the 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 counterproductive. 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds a nil check for TargetReplicas in the ScaleWorkloads function of the ScalingJob controller to prevent potential issues when scaling workloads. It also introduces a corresponding unit test TestScaleWorkloadsNilTargetReplicas to verify that an appropriate error is returned when TargetReplicas is nil. There are no review comments, so I have no additional feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7727 +/- ##
=======================================
Coverage 42.06% 42.06%
=======================================
Files 879 879
Lines 54831 54833 +2
=======================================
+ Hits 23065 23067 +2
+ Misses 30022 30021 -1
- Partials 1744 1745 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Signed-off-by: rootp1 <arnav.iitr@gmail.com>
642b40f to
2213303
Compare
What type of PR is this?
/kind bug
What this PR does / why we need it:
Summary
ScalingJob.ScaleWorkloads()so invalid direct workload scaling rules return an error instead of panickingtargetReplicasruleLinked Issue
Fixes #7726
What Changed
targetReplicasTargetReplicaspath incronfederatedhpa_job_test.goVerification
go test ./pkg/controllers/cronfederatedhpa— passedmake test— passedmake verify— not run cleanly: the target was executed twice; the first run failed becausegolangci-lintwas installed into~/go/binbut that path was not onPATH, and the rerun progressed further but failed in repository verification cleanup/codegen with existing API-rule output and permission errors removing the generated local_gotoolchain directoryScope
Which issue(s) this PR fixes:
Fixes #7726
Special notes for your reviewer:
make verifydid not complete successfully in this local environment for reasons described above.Does this PR introduce a user-facing change?: