Skip to content

Commit

Permalink
kubeadm: always use a short timeout for clientset creation
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
neolit123 committed Nov 10, 2019
1 parent 0afc842 commit ebfdb25
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/kubeadm/app/util/kubeconfig/kubeconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down

0 comments on commit ebfdb25

Please sign in to comment.