karmada icon indicating copy to clipboard operation
karmada copied to clipboard

Fixed cluster affinity scheduling evaluation order when scheduling is triggered via WorkloadRebalancer

Open bharathguvvala opened this issue 1 year ago • 6 comments

What type of PR is this?

/kind bug

What this PR does / why we need it: As discussed in the community meet on 2024-07-09 , added the fix to evaluate the cluster affinities freshly when scheduling is triggered via WorkloadRebalancer.

Which issue(s) this PR fixes: Fixes #5070

Progress

  • [x] share opinion in Community Meeting
  • [ ] proposal
  • [x] implementation
  • [ ] UT test
  • [ ] e2e test

Special notes for your reviewer: Raising this PR to get early feedback on the implementation as it is still work in progress and tested manually by building the deploying the scheduler. There may be unit test failures which I will fix so please don't merge the PR until that's done.

Does this PR introduce a user-facing change?: Yes. [Rest of the section TBA]

bharathguvvala avatar Aug 26 '24 06:08 bharathguvvala

Welcome @bharathguvvala! It looks like this is your first PR to karmada-io/karmada 🎉

karmada-bot avatar Aug 26 '24 06:08 karmada-bot

hi @bharathguvvala, really glad to see your PR submission!

By the way, here may be some minor problems with the ci now, and can you please fix the ci and squash the commit records into one? thanks~

chaosi-zju avatar Aug 26 '24 07:08 chaosi-zju

@chaosi-zju Sure, will do that.

bharathguvvala avatar Aug 28 '24 06:08 bharathguvvala

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

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.

Project coverage is 48.17%. Comparing base (cf7ac41) to head (762f992).

Files with missing lines Patch % Lines
pkg/scheduler/scheduler.go 0.00% 4 Missing and 2 partials :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5425      +/-   ##
==========================================
- Coverage   48.18%   48.17%   -0.02%     
==========================================
  Files         664      664              
  Lines       54799    54805       +6     
==========================================
- Hits        26405    26402       -3     
- Misses      26680    26686       +6     
- Partials     1714     1717       +3     
Flag Coverage Δ
unittests 48.17% <0.00%> (-0.02%) :arrow_down:

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Oct 21 '24 06:10 codecov-commenter

/retest

chaosi-zju avatar Nov 04 '24 02:11 chaosi-zju

Hi, there are still two nits:

  1. The CI of this PR failed due to it wasn't signed off, usually please use git commit -s -m 'your message ' or git commit -m ' Signed-off-by: AuthorName <[email protected]> \n <other message> ' to pass DCO (detail guideline can refer to: https://probot.github.io/apps/dco/).

  2. I see this PR has 26 commit record, can you please squash these 26 commits into one commit, you can refer to: https://stackoverflow.com/questions/5189560/how-do-i-squash-my-last-n-commits-together

thanks~

chaosi-zju avatar Nov 04 '24 03:11 chaosi-zju

Adding label do-not-merge/contains-merge-commits because PR contains merge commits, which are not allowed in this repository. Use git rebase to reapply your commits on top of the target branch. Detailed instructions for doing so can be found here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

karmada-bot avatar Dec 13 '24 07:12 karmada-bot

@chaosi-zju I've tried to squash the commits and sort of messed it up. Those squashed commits aren't showing up in the branch. Can we do "squash and merge" while merging this PR?

bharathguvvala avatar Dec 13 '24 08:12 bharathguvvala

I've tried to squash the commits and sort of messed it up. Those squashed commits aren't showing up in the branch. Can we do "squash and merge" while merging this PR?

can you try one more time by following command:

git remote add upstream https://github.com/karmada-io/karmada.git
git fetch upstream
git rebase upstream/master

then if you successfully rebased, you can directly push tou commit,

but you may also encounter some rebase conflict, in that case you should manually resolve the conflict and execute git rebase --continue

chaosi-zju avatar Dec 13 '24 10:12 chaosi-zju

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please assign garrybest for approval. For more information see the Kubernetes Code Review Process.

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 /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

karmada-bot avatar Jan 14 '25 16:01 karmada-bot

@chaosi-zju can you check now?

bharathguvvala avatar Jan 14 '25 16:01 bharathguvvala

hi @bharathguvvala, I reviewed your code from earlier and found no functional issues.

However, we've been unable to move forward with this PR because your submissions consistently fail CI checks. For example, the code below failed to compile, and it includes unrelated commits (seems something unexpected happened when you do squash or conflict-resolution). Actually, all CI checks must pass for the code to be merged.

I am also eagerly anticipate the release of your feature, and I’m trying to find an efficient way to collaborate with you to ensure that all CI checks are successfully completed.

At this moment, maybe we should fix these two problem:

  1. you can check the file you submited, that docs/proposals/karmada-operator/component-priority-class-name/README.md seems is not related to this feature, could you please remove that file?
  2. the code in pkg/scheduler/scheduler.go seems to have some discrepancies, I would much appreciate you to reset the code in this file to the previous code.

maybe you can do like this:

  1. execute git reset --soft HEAD~1, this command moves the current branch pointer back by one commit, keeping the changes from that commit in the staging area (index)
  2. manually remove the change in docs/proposals/karmada-operator/component-priority-class-name/README.md and repair the code in pkg/scheduler/scheduler.go
  3. execute git commit -m "support workloadrebalance to reschedule from the first cluster affinity" and git push -f to re-commit your code.

please let me know if you have any questions, best wishes~

chaosi-zju avatar Jan 17 '25 08:01 chaosi-zju

hi @bharathguvvala, if above method is still troublesome, how about this:

  1. first, overwrite the current branch code with the latest code from master, by executing following command:
git remote add upstream https://github.com/karmada-io/karmada.git
# replace code in local rebalancefix branch with code in upstream master branch
git pull -f upstream master:rebalancefix 
  1. then we manually add what we newly added code, including only following six line: image

  2. then re-commit and push the code:

git commit -s -m "support workload rebalancer to reschedule from the first cluster affinity
git push -f

this maybe the simplest way, good luck!

chaosi-zju avatar Jan 17 '25 09:01 chaosi-zju

I can get back on this after the PR passes the CI. @bharathguvvala I can help to rebase it if you want.

RainbowMango avatar Jan 21 '25 07:01 RainbowMango