mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Fix default config flags
This is a follow up to #105520 which only changed the new default config flags in the `NewKubectlCommand` function if `kubeConfigFlags == nil`. However they are not nil because they were initialized before here:
2fe968deb6/staging/src/k8s.io/kubectl/pkg/cmd/cmd.go (L97)
This fix uses the same defaults for both functions
Signed-off-by: Jonny Langefeld <jonny.langefeld@gmail.com>
This commit is contained in:
parent
489fb9bee3
commit
c4fbd35cf4
@ -89,12 +89,14 @@ type KubectlOptions struct {
|
|||||||
genericclioptions.IOStreams
|
genericclioptions.IOStreams
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var defaultConfigFlags = genericclioptions.NewConfigFlags(true).WithDeprecatedPasswordFlag().WithDiscoveryBurst(300).WithDiscoveryQPS(50.0)
|
||||||
|
|
||||||
// NewDefaultKubectlCommand creates the `kubectl` command with default arguments
|
// NewDefaultKubectlCommand creates the `kubectl` command with default arguments
|
||||||
func NewDefaultKubectlCommand() *cobra.Command {
|
func NewDefaultKubectlCommand() *cobra.Command {
|
||||||
return NewDefaultKubectlCommandWithArgs(KubectlOptions{
|
return NewDefaultKubectlCommandWithArgs(KubectlOptions{
|
||||||
PluginHandler: NewDefaultPluginHandler(plugin.ValidPluginFilenamePrefixes),
|
PluginHandler: NewDefaultPluginHandler(plugin.ValidPluginFilenamePrefixes),
|
||||||
Arguments: os.Args,
|
Arguments: os.Args,
|
||||||
ConfigFlags: genericclioptions.NewConfigFlags(true).WithDeprecatedPasswordFlag(),
|
ConfigFlags: defaultConfigFlags,
|
||||||
IOStreams: genericclioptions.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr},
|
IOStreams: genericclioptions.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -294,7 +296,7 @@ func NewKubectlCommand(o KubectlOptions) *cobra.Command {
|
|||||||
|
|
||||||
kubeConfigFlags := o.ConfigFlags
|
kubeConfigFlags := o.ConfigFlags
|
||||||
if kubeConfigFlags == nil {
|
if kubeConfigFlags == nil {
|
||||||
kubeConfigFlags = genericclioptions.NewConfigFlags(true).WithDeprecatedPasswordFlag().WithDiscoveryBurst(300).WithDiscoveryQPS(50.0)
|
kubeConfigFlags = defaultConfigFlags
|
||||||
}
|
}
|
||||||
kubeConfigFlags.AddFlags(flags)
|
kubeConfigFlags.AddFlags(flags)
|
||||||
matchVersionKubeConfigFlags := cmdutil.NewMatchVersionFlags(kubeConfigFlags)
|
matchVersionKubeConfigFlags := cmdutil.NewMatchVersionFlags(kubeConfigFlags)
|
||||||
|
Loading…
Reference in New Issue
Block a user