karmada icon indicating copy to clipboard operation
karmada copied to clipboard

karmadactl supports top node

Open zhzhuang-zju opened this issue 1 year ago • 4 comments

What type of PR is this? /kind feature

What this PR does / why we need it: karmadactl supports top node

Which issue(s) this PR fixes: Parts of #4217

Special notes for your reviewer: none

Does this PR introduce a user-facing change?:

Add command karmadactl top node to query the resource status of the cluster node. Like
➜  karmada git:(top) ✗ karmadactl top node -Cmember1
NAME                    CLUSTER   CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%   
member1-control-plane   member1   90m          2%     876Mi           5% 

zhzhuang-zju avatar Nov 13 '23 02:11 zhzhuang-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 191 lines in your changes missing coverage. Please review.

Project coverage is 29.52%. Comparing base (6318541) to head (3af667c).

Files Patch % Lines
pkg/karmadactl/top/top_node.go 0.00% 143 Missing :warning:
pkg/karmadactl/top/metrics_printer.go 0.00% 31 Missing :warning:
pkg/karmadactl/top/metrics_sorter.go 0.00% 16 Missing :warning:
pkg/karmadactl/top/top.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    #4224      +/-   ##
==========================================
- Coverage   29.67%   29.52%   -0.15%     
==========================================
  Files         632      633       +1     
  Lines       43936    44127     +191     
==========================================
- Hits        13037    13029       -8     
- Misses      29954    30152     +198     
- Partials      945      946       +1     
Flag Coverage Δ
unittests 29.52% <0.00%> (-0.15%) :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 Nov 13 '23 02:11 codecov-commenter

/assign

chaunceyjiang avatar Nov 15 '23 02:11 chaunceyjiang

kindly ping @chaunceyjiang @RainbowMango

zhzhuang-zju avatar Apr 19 '24 10:04 zhzhuang-zju

@hulizhe @RainbowMango The previous proposal envisioned that the top pod and top node commands would provide the ability to view the usage of resources in the control plane and member clusters. However, due to the existence of the component metrics-adapter, when the operation scope of the top command is set to karmada, it returns the resources of all member clusters instead, just like:

$ kubectl --kubeconfig $HOME/.kube/karmada.config --context karmada-apiserver top pod   
NAME    CPU(cores)   MEMORY(bytes)   
nginx   0m           3Mi             
nginx   0m           2Mi             
nginx   0m           3Mi             
$ kubectl --kubeconfig $HOME/.kube/karmada.config --context karmada-apiserver top node
NAME                    CPU(cores)   CPU%    MEMORY(bytes)   MEMORY%   
member1-control-plane   85m          725Mi   
member2-control-plane   87m          715Mi   
member3-control-plane   94m          786Mi 

So, it would be better to limit the operation-scope of the top command to members.

zhzhuang-zju avatar Aug 21 '24 03:08 zhzhuang-zju

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RainbowMango

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 avatar Aug 26 '24 04:08 karmada-bot