Skip to content

Commit 6dce34d

Browse files
authored
Merge pull request #751 from panslava/remove-client
Remove unused client argument
2 parents 8b385de + 08d1998 commit 6dce34d

File tree

2 files changed

+2
-43
lines changed

2 files changed

+2
-43
lines changed

providers/gce/gce.go

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"context"
2424
"fmt"
2525
"io"
26-
"net/http"
2726
"runtime"
2827
"strconv"
2928
"strings"
@@ -45,7 +44,6 @@ import (
4544

4645
"k8s.io/api/core/v1"
4746
"k8s.io/apimachinery/pkg/util/sets"
48-
"k8s.io/apimachinery/pkg/util/wait"
4947
"k8s.io/client-go/informers"
5048
clientset "k8s.io/client-go/kubernetes"
5149
"k8s.io/client-go/kubernetes/scheme"
@@ -488,11 +486,7 @@ func CreateGCECloud(config *CloudConfig) (*Cloud, error) {
488486
containerService.BasePath = config.ContainerAPIEndpoint
489487
}
490488

491-
client, err := newOauthClient(config.TokenSource)
492-
if err != nil {
493-
return nil, err
494-
}
495-
tpuService, err := newTPUService(client)
489+
tpuService, err := newTPUService()
496490
if err != nil {
497491
return nil, err
498492
}
@@ -960,40 +954,6 @@ func findSubnetForRegion(subnetURLs []string, region string) string {
960954
return ""
961955
}
962956

963-
func newOauthClient(tokenSource oauth2.TokenSource) (*http.Client, error) {
964-
if tokenSource == nil {
965-
var err error
966-
tokenSource, err = google.DefaultTokenSource(
967-
context.Background(),
968-
compute.CloudPlatformScope,
969-
compute.ComputeScope)
970-
klog.Infof("Using DefaultTokenSource %#v", tokenSource)
971-
if err != nil {
972-
return nil, err
973-
}
974-
} else {
975-
klog.Infof("Using existing Token Source %#v", tokenSource)
976-
}
977-
978-
backoff := wait.Backoff{
979-
// These values will add up to about a minute. See #56293 for background.
980-
Duration: time.Second,
981-
Factor: 1.4,
982-
Steps: 10,
983-
}
984-
if err := wait.ExponentialBackoff(backoff, func() (bool, error) {
985-
if _, err := tokenSource.Token(); err != nil {
986-
klog.Errorf("error fetching initial token: %v", err)
987-
return false, nil
988-
}
989-
return true, nil
990-
}); err != nil {
991-
return nil, err
992-
}
993-
994-
return oauth2.NewClient(context.Background(), tokenSource), nil
995-
}
996-
997957
func (manager *gceServiceManager) getProjectsAPIEndpoint() string {
998958
projectsAPIEndpoint := gceComputeAPIEndpoint + "projects/"
999959
if manager.gce.service != nil {

providers/gce/gce_tpu.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"context"
2424
"encoding/json"
2525
"fmt"
26-
"net/http"
2726
"time"
2827

2928
"google.golang.org/api/googleapi"
@@ -35,7 +34,7 @@ import (
3534

3635
// newTPUService returns a new tpuService using the client to communicate with
3736
// the Cloud TPU APIs.
38-
func newTPUService(client *http.Client) (*tpuService, error) {
37+
func newTPUService() (*tpuService, error) {
3938
s, err := tpuapi.NewService(context.Background())
4039
if err != nil {
4140
return nil, err

0 commit comments

Comments
 (0)