karmada-io / karmada

Open, Multi-Cloud, Multi-Cluster Kubernetes Orchestration
https://karmada.io
Apache License 2.0
4.37k stars 865 forks source link

Enhance the capabilities of the karmadactl get command #5254

Closed hulizhe closed 2 weeks ago

hulizhe commented 1 month ago

What type of PR is this? /kind feature

What this PR does / why we need it:

before:

$ karmadactl get secret 
No resources found in  namespace.

after:

$ karmadactl get secret 
No resources found in default namespace.

Given that the Karmada control plane has a deployment named nginx, which is propagated to member1 and member2.

// display deployment in Karmada control plane
$ _output/bin/linux/amd64/karmadactl get deployment             
NAME    CLUSTER   READY   UP-TO-DATE   AVAILABLE   AGE   ADOPTION
nginx   Karmada   0/2     4            0           17s   -

// display deployment in Karmada control plane and all member clusters
$ _output/bin/linux/amd64/karmadactl get deployment --operation-scope all
NAME    CLUSTER   READY   UP-TO-DATE   AVAILABLE   AGE   ADOPTION
nginx   Karmada   0/2     4            0           26s   -
nginx   member1   0/2     2            0           26s   Y
nginx   member2   0/2     2            0           26s   Y

// display deployment in Karmada control plane and member1
$ _output/bin/linux/amd64/karmadactl get deployment --operation-scope all -Cmember1     
NAME    CLUSTER   READY   UP-TO-DATE   AVAILABLE   AGE   ADOPTION
nginx   Karmada   0/2     4            0           37s   -
nginx   member1   0/2     2            0           37s   Y

// only display deployment in member clustes
$ _output/bin/linux/amd64/karmadactl get deployment --operation-scope members
NAME    CLUSTER   READY   UP-TO-DATE   AVAILABLE   AGE   ADOPTION
nginx   member1   2/2     2            2           65s   Y
nginx   member2   0/2     2            0           65s   Y

// only display deployment in member1
$ _output/bin/linux/amd64/karmadactl get deployment --operation-scope members -Cmember1
NAME    CLUSTER   READY   UP-TO-DATE   AVAILABLE   AGE   ADOPTION
nginx   member1   2/2     2            2           65s   Y

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

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

`karmadactl`: The `get` command can show Karmada resources now.
codecov-commenter commented 1 month ago

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

Project coverage is 29.35%. Comparing base (bcefb22) to head (37a6dc9). Report is 2 commits behind head on master.

Files Patch % Lines
pkg/karmadactl/get/get.go 0.00% 72 Missing :warning:
pkg/karmadactl/options/global.go 0.00% 29 Missing :warning:

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

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #5254 +/- ## ========================================== - Coverage 29.41% 29.35% -0.06% ========================================== Files 632 632 Lines 43835 43901 +66 ========================================== - Hits 12892 12889 -3 - Misses 30003 30071 +68 - Partials 940 941 +1 ``` | [Flag](https://app.codecov.io/gh/karmada-io/karmada/pull/5254/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=karmada-io) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/karmada-io/karmada/pull/5254/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=karmada-io) | `29.35% <0.00%> (-0.06%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=karmada-io#carryforward-flags-in-the-pull-request-comment) to find out more.

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

zhzhuang-zju commented 1 month ago

cc @XiShanYongYe-Chang @chaunceyjiang

zhzhuang-zju commented 3 weeks ago

/retest

zhzhuang-zju commented 3 weeks ago

[FAIL] [resource-status collection] resource status collection testing PodDisruptionBudget collection testing [It] pdb status collection testing

The probability of this e2e tests failing has been quite high recently.

/retest

zhzhuang-zju commented 3 weeks ago

The probability of this e2e tests failing has been quite high recently.

tracked by #5382

/retest

karmada-bot commented 2 weeks ago

[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: - ~~[pkg/karmadactl/OWNERS](https://github.com/karmada-io/karmada/blob/master/pkg/karmadactl/OWNERS)~~ [RainbowMango] - ~~[test/OWNERS](https://github.com/karmada-io/karmada/blob/master/test/OWNERS)~~ [RainbowMango] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
zhzhuang-zju commented 2 weeks ago

/retest