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

Implement flags grouping for karmada-scheduler-estimator #1493

Merged
merged 1 commit into from
Mar 17, 2022

Conversation

AllenZMC
Copy link
Member

@AllenZMC AllenZMC commented Mar 15, 2022

What type of PR is this?
/kind feature

What this PR does / why we need it:
Implement flags grouping for karmada-scheduler-estimator #1485
Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

`karmada-scheduler-estimator`: The klog flags now have been grouped for better readability.

@karmada-bot karmada-bot added release-note-none Denotes a PR that doesn't merit a release note. kind/feature Categorizes issue or PR as related to a new feature. labels Mar 15, 2022
@karmada-bot karmada-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Mar 15, 2022
@lonelyCZ
Copy link
Member

There seems some problems, let's to check it.

[root@master67 karmada]# ./karmada-scheduler-estimator -h
generic flag redefined: kubeconfig
panic: generic flag redefined: kubeconfig

goroutine 1 [running]:
github.com/spf13/pflag.(*FlagSet).AddFlag(0xc0003bac00, 0xc0000af900)
	/root/lonelyCZ/karmada-lonelyCZ/karmada/vendor/github.com/spf13/pflag/flag.go:848 +0x5f6
github.com/spf13/pflag.(*FlagSet).VarPF(0x1, {0x1f17750, 0xc000557380}, {0x1c939a4, 0xa}, {0x0, 0x0}, {0x1ce1812, 0x36})
	/root/lonelyCZ/karmada-lonelyCZ/karmada/vendor/github.com/spf13/pflag/flag.go:831 +0x151
github.com/spf13/pflag.(*FlagSet).VarP(...)
	/root/lonelyCZ/karmada-lonelyCZ/karmada/vendor/github.com/spf13/pflag/flag.go:837
github.com/spf13/pflag.(*FlagSet).StringVar(0x0, 0x1c8f814, {0x1c939a4, 0x1766466}, {0x0, 0x40d407}, {0x1ce1812, 0xa72c60})
	/root/lonelyCZ/karmada-lonelyCZ/karmada/vendor/github.com/spf13/pflag/string.go:37 +0x69
github.com/karmada-io/karmada/cmd/scheduler-estimator/app/options.(*Options).AddFlags(0xc000557380, 0xc000118360)
	/root/lonelyCZ/karmada-lonelyCZ/karmada/cmd/scheduler-estimator/app/options/options.go:40 +0x65
github.com/karmada-io/karmada/cmd/scheduler-estimator/app.NewSchedulerEstimatorCommand({0x1f2b570, 0xc00043ea00})
	/root/lonelyCZ/karmada-lonelyCZ/karmada/cmd/scheduler-estimator/app/scheduler-estimator.go:53 +0x15d
main.runSchedulerEstimatorCmd()
	/root/lonelyCZ/karmada-lonelyCZ/karmada/cmd/scheduler-estimator/main.go:23 +0x4f
main.main()
	/root/lonelyCZ/karmada-lonelyCZ/karmada/cmd/scheduler-estimator/main.go:13 +0x19

@AllenZMC
Copy link
Member Author

I will check it later.

@AllenZMC
Copy link
Member Author

AllenZMC commented Mar 16, 2022

@lonelyCZ , after I modified a kubeconfig flag name to the kubeconfig1 flag name

func (o *Options) AddFlags(fs *pflag.FlagSet) {
	if o == nil {
		return
	}
	fs.StringVar(&o.KubeConfig, "kubeconfig1", o.KubeConfig, "Path to a KubeConfig. Only required if out-of-cluster.")
  ...
}
./karmada-scheduler-estimator -h , part result :
    ...
      --kubeconfig string                                                                                                        
                Paths to a kubeconfig. Only required if out-of-cluster.
      --kubeconfig1 string                                                                                                       
                Path to a KubeConfig. Only required if out-of-cluster.
    ...

I find it in vendor sigs.k8s.io/controller-runtime/pkg/client/config/config.go

func init() {
	// TODO: Fix this to allow double vendoring this library but still register flags on behalf of users
	flag.StringVar(&kubeconfig, "kubeconfig", "",
		"Paths to a kubeconfig. Only required if out-of-cluster.")
}

So we need to rename it fs.StringVar(&o.KubeConfig, "kubeconfig", o.KubeConfig, "Path to a KubeConfig. Only required if out-of-cluster.") to fs.StringVar(&o.KarmadaKubeConfig, "karmada-kubeconfig", o.KarmadaKubeConfig, "Path to karmada control plane kubeconfig file."), or modify to flags.Lookup("kubeconfig").Usage = "Path to karmada control plane kubeconfig file." is this correct?

@AllenZMC
Copy link
Member Author

/assign @Garrybest

@AllenZMC
Copy link
Member Author

/assign @RainbowMango

…he kubeconfig description

Signed-off-by: AllenZMC <zhongming.chang@daocloud.io>

Implement flags grouping for karmada-aggregated-apiserver and modify the kubeconfig description

Signed-off-by: AllenZMC <zhongming.chang@daocloud.io>
@lonelyCZ
Copy link
Member

Seemingly, there is not CI test in this component? @RainbowMango @Garrybest

@Garrybest
Copy link
Member

Right. The estimator and descheduler do not have e2e tests, only unit tests. 🤣

@lonelyCZ
Copy link
Member

/lgtm

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Mar 17, 2022
@RainbowMango
Copy link
Member

/assign @Garrybest

@RainbowMango
Copy link
Member

LGTM by the way

@Garrybest
Copy link
Member

/lgtm

@AllenZMC
Copy link
Member Author

/lgtm

approve please😀

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.

/approve
on behalf of @Garrybest

@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 Mar 17, 2022
@karmada-bot karmada-bot merged commit 279bdeb into karmada-io:master Mar 17, 2022
@AllenZMC AllenZMC deleted the flags_scheduler_estimator branch March 17, 2022 07:37
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/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants