mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
kubeadm: always use a short timeout for clientset creation
ToClientSet() in kubeconfig.go creates a clientset from the passed Config object (kubeconfig). For IP addresses that are not reachable e.g. Get() calls for ConfigMaps can block for a few minutes with the default timeout. Modify the timeout to a shorter value by passing an override.
This commit is contained in:
parent
0afc8423f8
commit
ebfdb25c05
@ -80,7 +80,8 @@ func ClientSetFromFile(path string) (*clientset.Clientset, error) {
|
||||
|
||||
// ToClientSet converts a KubeConfig object to a client
|
||||
func ToClientSet(config *clientcmdapi.Config) (*clientset.Clientset, error) {
|
||||
clientConfig, err := clientcmd.NewDefaultClientConfig(*config, &clientcmd.ConfigOverrides{}).ClientConfig()
|
||||
overrides := clientcmd.ConfigOverrides{Timeout: "10s"}
|
||||
clientConfig, err := clientcmd.NewDefaultClientConfig(*config, &overrides).ClientConfig()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to create API client configuration from kubeconfig")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user