Skip to content

Bug: kubeCmdFactory will lose WrapTransport config #620

Open
@a244591052

Description

@a244591052

func kubeCmdFactory(kubeconfig, ns string, config *rest.Config) cmdutil.Factory {
kubeConfigFlags := genericclioptions.NewConfigFlags(true)
if ns != "" {
kubeConfigFlags.Namespace = &ns
}
kubeConfigFlags.KubeConfig = &kubeconfig
kubeConfigFlags.WithDiscoveryBurst(config.Burst)
kubeConfigFlags.WithDiscoveryQPS(config.QPS)
matchVersionKubeConfigFlags := cmdutil.NewMatchVersionFlags(kubeConfigFlags)
return cmdutil.NewFactory(matchVersionKubeConfigFlags)
}

In the above code, WrapTransport is not passed, which will cause the client corresponding to the NewFactory to have no WrapTransport, which is not as expected.

In addition, RateLimiter is not passed, which will cause the NewFactory client to create a new RateLimiter using the passed in QPS. If k8s is limiting the flow for the client, then it is expected. If k8s is limiting the flow for the IP address, then RateLimiter should be passed.

fix pr: #622

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions