Skip to content

Commit 71818e9

Browse files
committed
Abandon deprecated GCP SDK APIs
1 parent e1fee86 commit 71818e9

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

pkg/namedports/namedports.go

+2-8
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"cloud.google.com/go/compute/metadata"
99
"github.com/sirupsen/logrus"
1010
"golang.org/x/net/context"
11-
"golang.org/x/oauth2/google"
1211
compute "google.golang.org/api/compute/v0.beta"
1312
container "google.golang.org/api/container/v1"
1413
)
@@ -74,17 +73,12 @@ func getServices(ctx context.Context) (*container.Service, *compute.Service, err
7473
// We'll use the current host ServiceAccount if possible. If not available,
7574
// pass auth according to https://cloud.google.com/docs/authentication/
7675
// (ie. via GOOGLE_APPLICATION_CREDENTIALS environment or otherwise).
77-
hc, err := google.DefaultClient(ctx, container.CloudPlatformScope, compute.CloudPlatformScope)
78-
if err != nil {
79-
return nil, nil, fmt.Errorf("could not get authenticated client: %v", err)
80-
}
81-
82-
svc, err := container.New(hc)
76+
svc, err := container.NewService(ctx)
8377
if err != nil {
8478
return nil, nil, fmt.Errorf("could not initialize gke client: %v", err)
8579
}
8680

87-
csvc, err := compute.New(hc)
81+
csvc, err := compute.NewService(ctx)
8882
if err != nil {
8983
return nil, nil, fmt.Errorf("could not initialize compute client: %v", err)
9084
}

0 commit comments

Comments
 (0)