Skip to content

Conversation

@RainbowMango
Copy link
Member

@RainbowMango RainbowMango commented Oct 20, 2025

What type of PR is this?

/kind feature

What this PR does / why we need it:

This pull request refines the ReplicaEstimator interface and its associated implementations by removing unnecessary pointer types for the ComponentSetEstimationRequest and its Components field. This change aims to simplify the API and internal logic, making the code cleaner and potentially more efficient by avoiding pointer indirection where not strictly required for value types.

Which issue(s) this PR fixes:
Part of #6734

Special notes for your reviewer:
My bad for suggesting using the pointer type at #6765 (comment).
I don't see any benefit from using a pointer type. :) See the inconvenience in #6857.

Does this PR introduce a user-facing change?:

NONE

Copilot AI review requested due to automatic review settings October 20, 2025 12:46
@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Oct 20, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Updates the ReplicaEstimator interface to change parameter types from pointer to value types, removing unnecessary pointer indirection for ComponentSetEstimationRequest and Component slices.

  • Changed ComponentSetEstimationRequest parameter from pointer to value type in interface method
  • Changed Components field from slice of pointers to slice of values
  • Updated all implementing methods to match the new interface signature

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
pkg/estimator/client/interface.go Updates interface signature and struct field to remove pointer types
pkg/estimator/client/general.go Updates GeneralEstimator implementation to match new interface signature
pkg/estimator/client/accurate.go Updates SchedulerEstimator implementation to match new interface signature

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@gemini-code-assist
Copy link

Summary of Changes

Hello @RainbowMango, 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 refines the ReplicaEstimator interface and its associated implementations by removing unnecessary pointer types for the ComponentSetEstimationRequest and its Components field. This change aims to simplify the API and internal logic, making the code cleaner and potentially more efficient by avoiding pointer indirection where not strictly required for value types. It is part of a larger effort to implement feature #6734.

Highlights

  • Interface Signature Update: The MaxAvailableComponentSets method in the ReplicaEstimator interface now accepts ComponentSetEstimationRequest by value instead of by pointer, simplifying the API.
  • ComponentSetEstimationRequest Field Type Refinement: The Components field within the ComponentSetEstimationRequest struct has been updated from a slice of pointers ([]*workv1alpha2.Component) to a slice of values ([]workv1alpha2.Component), promoting clearer data handling.
  • Internal Function Signature Alignment: Several internal helper functions, including maxAvailableComponentSets, getMaximumSetsBasedOnResourceModels, podsInSet, and perSetRequirement, have been modified to align with the non-pointer Components slice type, ensuring consistency across the codebase.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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. 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

  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.

@karmada-bot karmada-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Oct 20, 2025
Copy link

@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 updates the ReplicaEstimator interface signature by removing unnecessary pointer types for the ComponentSetEstimationRequest parameter in the MaxAvailableComponentSets method. This change affects the accurate.go, general.go, and interface.go files, ensuring that the estimator implementations use the value of the request object directly, rather than a pointer to it. This simplifies the code and reduces the risk of nil pointer dereferences.

@RainbowMango RainbowMango force-pushed the pr_amend_component_scheduling_interface_type branch from d958a57 to 2743369 Compare October 20, 2025 12:57
@karmada-bot karmada-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Oct 20, 2025
@RainbowMango RainbowMango force-pushed the pr_amend_component_scheduling_interface_type branch from 2743369 to ed58e7b Compare October 20, 2025 13:05
@RainbowMango
Copy link
Member Author

cc @mszacillo

PS: Please ignore the failing tests as the GitHub Action seems not stable today. I will handle it later.

@codecov-commenter
Copy link

codecov-commenter commented Oct 20, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 50.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 45.64%. Comparing base (b0cb266) to head (a61df36).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
pkg/estimator/client/general.go 60.00% 2 Missing ⚠️
pkg/estimator/client/accurate.go 0.00% 1 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6859   +/-   ##
=======================================
  Coverage   45.64%   45.64%           
=======================================
  Files         692      692           
  Lines       57703    57703           
=======================================
+ Hits        26337    26339    +2     
+ Misses      29720    29718    -2     
  Partials     1646     1646           
Flag Coverage Δ
unittests 45.64% <50.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@RainbowMango
Copy link
Member Author

ERROR: failed to build: failed to solve: alpine:3.22.2: failed to resolve source metadata for docker.io/library/alpine:3.22.2: unexpected status from HEAD request to https://registry-1.docker.io/v2/library/alpine/manifests/3.22.2: 500 Internal Server Error
make: *** [Makefile:58: image-karmada-scheduler] Error 1
make: Leaving directory '/home/runner/work/karmada/karmada'

/retest

@RainbowMango RainbowMango force-pushed the pr_amend_component_scheduling_interface_type branch from ed58e7b to a61df36 Compare October 21, 2025 02:00
@karmada-bot karmada-bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 21, 2025
@RainbowMango RainbowMango added this to the v1.16 milestone Oct 21, 2025
Copy link
Member

@XiShanYongYe-Chang XiShanYongYe-Chang left a comment

Choose a reason for hiding this comment

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

Thanks~
/lgtm
/approve

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Oct 21, 2025
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: XiShanYongYe-Chang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@karmada-bot karmada-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 21, 2025
@karmada-bot karmada-bot merged commit ce66819 into karmada-io:master Oct 21, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants