diff --git a/hack/.staticcheck_failures b/hack/.staticcheck_failures index 5d9532402a2..44479ad24a5 100644 --- a/hack/.staticcheck_failures +++ b/hack/.staticcheck_failures @@ -48,7 +48,6 @@ pkg/volume/vsphere_volume test/e2e/apps test/e2e/autoscaling test/e2e/instrumentation/logging/stackdriver -test/e2e/instrumentation/monitoring test/integration/deployment test/integration/etcd test/integration/examples diff --git a/test/e2e/instrumentation/monitoring/BUILD b/test/e2e/instrumentation/monitoring/BUILD index e5b7a11aa18..cab20dd7c9c 100644 --- a/test/e2e/instrumentation/monitoring/BUILD +++ b/test/e2e/instrumentation/monitoring/BUILD @@ -48,6 +48,7 @@ go_library( "//vendor/github.com/onsi/gomega:go_default_library", "//vendor/golang.org/x/oauth2/google:go_default_library", "//vendor/google.golang.org/api/monitoring/v3:go_default_library", + "//vendor/google.golang.org/api/option:go_default_library", ], ) diff --git a/test/e2e/instrumentation/monitoring/accelerator.go b/test/e2e/instrumentation/monitoring/accelerator.go index e7019193581..11d65301e79 100644 --- a/test/e2e/instrumentation/monitoring/accelerator.go +++ b/test/e2e/instrumentation/monitoring/accelerator.go @@ -35,6 +35,7 @@ import ( "github.com/onsi/ginkgo" "golang.org/x/oauth2/google" gcm "google.golang.org/api/monitoring/v3" + "google.golang.org/api/option" ) // Stackdriver container accelerator metrics, as described here: @@ -63,8 +64,9 @@ func testStackdriverAcceleratorMonitoring(f *framework.Framework) { ctx := context.Background() client, err := google.DefaultClient(ctx, gcm.CloudPlatformScope) + framework.ExpectNoError(err) - gcmService, err := gcm.New(client) + gcmService, err := gcm.NewService(ctx, option.WithHTTPClient(client)) framework.ExpectNoError(err) diff --git a/test/e2e/instrumentation/monitoring/custom_metrics_stackdriver.go b/test/e2e/instrumentation/monitoring/custom_metrics_stackdriver.go index 360fc8b8180..762450e06fd 100644 --- a/test/e2e/instrumentation/monitoring/custom_metrics_stackdriver.go +++ b/test/e2e/instrumentation/monitoring/custom_metrics_stackdriver.go @@ -38,6 +38,7 @@ import ( "github.com/onsi/ginkgo" "golang.org/x/oauth2/google" + "google.golang.org/api/option" ) const ( @@ -99,8 +100,9 @@ func testCustomMetrics(f *framework.Framework, kubeClient clientset.Interface, c ctx := context.Background() client, err := google.DefaultClient(ctx, gcm.CloudPlatformScope) + framework.ExpectNoError(err) - gcmService, err := gcm.New(client) + gcmService, err := gcm.NewService(ctx, option.WithHTTPClient(client)) if err != nil { framework.Failf("Failed to create gcm service, %v", err) } @@ -145,8 +147,9 @@ func testExternalMetrics(f *framework.Framework, kubeClient clientset.Interface, ctx := context.Background() client, err := google.DefaultClient(ctx, gcm.CloudPlatformScope) + framework.ExpectNoError(err) - gcmService, err := gcm.New(client) + gcmService, err := gcm.NewService(ctx, option.WithHTTPClient(client)) if err != nil { framework.Failf("Failed to create gcm service, %v", err) } diff --git a/test/e2e/instrumentation/monitoring/stackdriver.go b/test/e2e/instrumentation/monitoring/stackdriver.go index d9ca5c250be..dbc5e51c20d 100644 --- a/test/e2e/instrumentation/monitoring/stackdriver.go +++ b/test/e2e/instrumentation/monitoring/stackdriver.go @@ -32,6 +32,7 @@ import ( "github.com/onsi/ginkgo" "golang.org/x/oauth2/google" gcm "google.golang.org/api/monitoring/v3" + "google.golang.org/api/option" ) var ( @@ -76,6 +77,7 @@ func testStackdriverMonitoring(f *framework.Framework, pods, allPodsCPU int, per ctx := context.Background() client, err := google.DefaultClient(ctx, gcm.CloudPlatformScope) + framework.ExpectNoError(err) // Hack for running tests locally // If this is your use case, create application default credentials: @@ -90,7 +92,7 @@ func testStackdriverMonitoring(f *framework.Framework, pods, allPodsCPU int, per client := oauth2.NewClient(oauth2.NoContext, ts) */ - gcmService, err := gcm.New(client) + gcmService, err := gcm.NewService(ctx, option.WithHTTPClient(client)) // set this env var if accessing Stackdriver test endpoint (default is prod): // $ export STACKDRIVER_API_ENDPOINT_OVERRIDE=https://test-monitoring.sandbox.googleapis.com/