Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix karmadactl token that can't set --kubeconfig #2730

Merged
merged 1 commit into from
Nov 3, 2022

Conversation

lonelyCZ
Copy link
Member

@lonelyCZ lonelyCZ commented Nov 3, 2022

Signed-off-by: lonelyCZ chengzhe@zju.edu.cn

What type of PR is this?

/kind bug

What this PR does / why we need it:
Fix that setting --kubeconfig and --karmada-context flags is invalid.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

Signed-off-by: lonelyCZ <chengzhe@zju.edu.cn>
@karmada-bot karmada-bot added the kind/bug Categorizes issue or PR as related to a bug. label Nov 3, 2022
@karmada-bot karmada-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 3, 2022
@RainbowMango
Copy link
Member

How to reproduce it?

Which PR introduced this bug? We should figure out which release also needs this patch.

@lonelyCZ
Copy link
Member Author

lonelyCZ commented Nov 3, 2022

Which PR introduced this bug? We should figure out which release also needs this patch.

#2668 , it doesn't need patch.

How to reproduce it?

[root@master67 karmada]# _output/bin/linux/amd64/karmadactl token create --kubeconfig /etc/karmada/karmada-apiserver.config --karmada-context karmada-apiserver

--kubeconfig and --karmada-context is invalid, it still uses /root/.kube/config.

@codecov-commenter
Copy link

Codecov Report

Merging #2730 (54ea4f4) into master (f6780c2) will increase coverage by 0.02%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master    #2730      +/-   ##
==========================================
+ Coverage   32.73%   32.75%   +0.02%     
==========================================
  Files         199      199              
  Lines       19401    19382      -19     
==========================================
- Hits         6350     6349       -1     
+ Misses      12697    12678      -19     
- Partials      354      355       +1     
Flag Coverage Δ
unittests 32.75% <0.00%> (+0.02%) ⬆️

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

Impacted Files Coverage Δ
pkg/karmadactl/token.go 0.00% <0.00%> (ø)
pkg/util/worker.go 66.66% <0.00%> (-4.77%) ⬇️
pkg/search/proxy/store/util.go 94.73% <0.00%> (+1.16%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@RainbowMango
Copy link
Member

I don't get why the previous flags not working. We do add the flags at :

tokenOpts.GlobalCommandOptions.AddFlags(cmd.Flags())

@lonelyCZ
Copy link
Member Author

lonelyCZ commented Nov 3, 2022

I don't get why the previous flags not working. We do add the flags at :

tokenOpts.GlobalCommandOptions.AddFlags(cmd.Flags())

Because we will directly use defaultConfigFlags, and not need to checkout the kubeconfig in subcommands.

// It composes the set of values necessary for obtaining a REST client config with default values set.
defaultConfigFlags = genericclioptions.NewConfigFlags(true).WithDeprecatedPasswordFlag().WithDiscoveryBurst(300).WithDiscoveryQPS(50.0)

Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Nov 3, 2022
@karmada-bot
Copy link
Collaborator

[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 karmada-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 3, 2022
@karmada-bot karmada-bot merged commit 7c8f237 into karmada-io:master Nov 3, 2022
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/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants