karmada icon indicating copy to clipboard operation
karmada copied to clipboard

karmadactl support rebalance command to trigger a fresh rescheduling

Open chaosi-zju opened this issue 1 year ago • 5 comments

What type of PR is this?

/kind feature

What this PR does / why we need it:

karmadactl support rebalance command to trigger a fresh rescheduling

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

karmadactl support rebalance command to trigger a fresh rescheduling

chaosi-zju avatar Sep 02 '24 09:09 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 lonelycz 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 Sep 02 '24 09:09 karmada-bot

test report:

$ karmadactl rebalance -h              
Actively triggerring a fresh rescheduling, which disregards the previous assignment entirely and seeks to establish an
entirely new replica distribution across clusters.

Examples:
  # Rebalance deployment(default/nginx)
  karmadactl rebalance deployment nginx -n default
  
  # Rebalance deployment(default/nginx) with gvk
  karmadactl rebalance deployment.v1.apps nginx -n default

Options:
    --dry-run=false:
        Run the command in dry-run mode, without making any server requests.

    --karmada-context='':
        The name of the kubeconfig context to use

    --kubeconfig='':
        Path to the kubeconfig file to use for CLI requests.

    -n, --namespace='':
        If present, the namespace scope for this CLI request

Usage:
  karmadactl rebalance <RESOURCE_TYPE> <RESOURCE_NAME> -n <NAME_SPACE> [options]

Use "karmadactl options" for a list of global command-line options (applies to all commands).

$ karmadactl rebalance deployment nginx
successfully rebalance Deployment default/nginx

$ karmadactl rebalance deployment.v1.apps nginx
successfully rebalance Deployment default/nginx

$ karmadactl rebalance deployment nginxxx      
error: failed to get resource in Karmada. err: the deployment or nginxxx don't exist in Karmada

chaosi-zju avatar Sep 02 '24 09:09 chaosi-zju

: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 134 lines in your changes missing coverage. Please review.

Project coverage is 42.90%. Comparing base (ed3f48c) to head (ec0acfd).

Files with missing lines Patch % Lines
pkg/karmadactl/rebalance/rebalance.go 0.00% 133 Missing :warning:
pkg/karmadactl/karmadactl.go 0.00% 1 Missing :warning:

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

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5471      +/-   ##
==========================================
- Coverage   43.00%   42.90%   -0.11%     
==========================================
  Files         656      657       +1     
  Lines       55921    56055     +134     
==========================================
+ Hits        24051    24052       +1     
- Misses      30324    30457     +133     
  Partials     1546     1546              
Flag Coverage Δ
unittests 42.90% <0.00%> (-0.11%) :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 Sep 02 '24 09:09 codecov-commenter

Is there any further comments? If anyone has other suggestions, please let me know~

chaosi-zju avatar Sep 11 '24 03:09 chaosi-zju

Is there any further comments? If anyone has other suggestions, please let me know~

chaosi-zju avatar Sep 23 '24 02:09 chaosi-zju

all comments fixed @zhzhuang-zju

chaosi-zju avatar Nov 11 '24 12:11 chaosi-zju

/lgtm assign @RainbowMango

zhzhuang-zju avatar Nov 12 '24 01:11 zhzhuang-zju

@RainbowMango can this PR bring to release-1.12 ?

chaosi-zju avatar Nov 28 '24 09:11 chaosi-zju

I'm not sure if I have enough bandwidth. Will see.

RainbowMango avatar Nov 28 '24 13:11 RainbowMango