Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Commit 54eadb3

Browse files
committed
create 1.4 clientset from config and use its RESTClient
1 parent 57ec539 commit 54eadb3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkg/util/etcdutil/migrate.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ const (
2222
)
2323

2424
func Migrate() error {
25-
restcli, err := restclient.RESTClientFor(&restclient.Config{
25+
kubecli, err := clientset.NewForConfig(&restclient.Config{
2626
Host: apiserverAddr,
2727
})
2828
if err != nil {
2929
return fmt.Errorf("fail to create kube client: %v", err)
3030
}
31-
kubecli := clientset.New(restcli)
31+
httpcli := kubecli.CoreClient.RESTClient.Client
3232

33-
err = waitEtcdTPRReady(restcli.Client, 5*time.Second, 60*time.Second, apiserverAddr, api.NamespaceSystem)
33+
err = waitEtcdTPRReady(httpcli, 5*time.Second, 60*time.Second, apiserverAddr, api.NamespaceSystem)
3434
if err != nil {
3535
return err
3636
}
@@ -41,7 +41,7 @@ func Migrate() error {
4141
}
4242
glog.Infof("boot-etcd pod IP is: %s", ip)
4343

44-
if err := createMigratedEtcdCluster(restcli.Client, apiserverAddr, ip); err != nil {
44+
if err := createMigratedEtcdCluster(httpcli, apiserverAddr, ip); err != nil {
4545
glog.Errorf("fail to create migrated etcd cluster: %v", err)
4646
return err
4747
}

0 commit comments

Comments
 (0)