diff --git a/cloud/scope/clients.go b/cloud/scope/clients.go index 01b0b6b10..63ae04542 100644 --- a/cloud/scope/clients.go +++ b/cloud/scope/clients.go @@ -21,7 +21,6 @@ import ( "time" "github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud" - computebeta "google.golang.org/api/compute/v0.beta" "google.golang.org/api/compute/v1" "k8s.io/client-go/util/flowcontrol" @@ -29,8 +28,7 @@ import ( // GCPServices contains all the gcp services used by the scopes. type GCPServices struct { - Compute *compute.Service - ComputeBeta *computebeta.Service + Compute *compute.Service } // GCPRateLimiter implements cloud.RateLimiter. @@ -56,7 +54,6 @@ func (rl *GCPRateLimiter) Accept(ctx context.Context, key *cloud.RateLimitKey) e func newCloud(project string, service GCPServices) cloud.Cloud { return cloud.NewGCE(&cloud.Service{ GA: service.Compute, - Beta: service.ComputeBeta, ProjectRouter: &cloud.SingleProjectRouter{ID: project}, RateLimiter: &GCPRateLimiter{}, }) diff --git a/cloud/scope/cluster.go b/cloud/scope/cluster.go index 608b1e362..5d1a57b6d 100644 --- a/cloud/scope/cluster.go +++ b/cloud/scope/cluster.go @@ -23,7 +23,6 @@ import ( "time" "github.com/pkg/errors" - computebeta "google.golang.org/api/compute/v0.beta" "google.golang.org/api/compute/v1" "k8s.io/utils/pointer" @@ -58,19 +57,10 @@ func NewClusterScope(params ClusterScopeParams) (*ClusterScope, error) { return nil, errors.Errorf("failed to create gcp compute client: %v", err) } - computeBetaSvc, err := computebeta.NewService(context.TODO()) - if err != nil { - return nil, errors.Errorf("failed to create gcp compute beta client: %v", err) - } - if params.GCPServices.Compute == nil { params.GCPServices.Compute = computeSvc } - if params.GCPServices.ComputeBeta == nil { - params.GCPServices.ComputeBeta = computeBetaSvc - } - helper, err := patch.NewHelper(params.GCPCluster, params.Client) if err != nil { return nil, errors.Wrap(err, "failed to init patch helper") @@ -317,8 +307,8 @@ func (s *ClusterScope) InstanceGroupSpec(zone string) *compute.InstanceGroup { } // TargetTCPProxySpec returns google compute target-tcp-proxy spec. -func (s *ClusterScope) TargetTCPProxySpec() *computebeta.TargetTcpProxy { - return &computebeta.TargetTcpProxy{ +func (s *ClusterScope) TargetTCPProxySpec() *compute.TargetTcpProxy { + return &compute.TargetTcpProxy{ Name: fmt.Sprintf("%s-%s", s.Name(), infrav1.APIServerRoleTagValue), ProxyHeader: "NONE", } diff --git a/cloud/services/compute/loadbalancers/reconcile.go b/cloud/services/compute/loadbalancers/reconcile.go index d8003b02e..bb62d6a3c 100644 --- a/cloud/services/compute/loadbalancers/reconcile.go +++ b/cloud/services/compute/loadbalancers/reconcile.go @@ -20,7 +20,6 @@ import ( "context" "github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta" - computebeta "google.golang.org/api/compute/v0.beta" "google.golang.org/api/compute/v1" "k8s.io/utils/pointer" @@ -203,7 +202,7 @@ func (s *Service) createOrGetBackendService(ctx context.Context, instancegroups return backendsvc, nil } -func (s *Service) createOrGetTargetTCPProxy(ctx context.Context, service *compute.BackendService) (*computebeta.TargetTcpProxy, error) { +func (s *Service) createOrGetTargetTCPProxy(ctx context.Context, service *compute.BackendService) (*compute.TargetTcpProxy, error) { log := log.FromContext(ctx) targetSpec := s.scope.TargetTCPProxySpec() targetSpec.Service = service.SelfLink @@ -260,7 +259,7 @@ func (s *Service) createOrGetAddress(ctx context.Context) (*compute.Address, err return addr, nil } -func (s *Service) createForwardingRule(ctx context.Context, target *computebeta.TargetTcpProxy, addr *compute.Address) error { +func (s *Service) createForwardingRule(ctx context.Context, target *compute.TargetTcpProxy, addr *compute.Address) error { log := log.FromContext(ctx) spec := s.scope.ForwardingRuleSpec() key := meta.GlobalKey(spec.Name) diff --git a/cloud/services/compute/loadbalancers/service.go b/cloud/services/compute/loadbalancers/service.go index 30d5203d6..fc7eef625 100644 --- a/cloud/services/compute/loadbalancers/service.go +++ b/cloud/services/compute/loadbalancers/service.go @@ -21,7 +21,6 @@ import ( "github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/filter" "github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta" - computebeta "google.golang.org/api/compute/v0.beta" "google.golang.org/api/compute/v1" "sigs.k8s.io/cluster-api-provider-gcp/cloud" @@ -60,8 +59,8 @@ type instancegroupsInterface interface { } type targettcpproxiesInterface interface { - Get(ctx context.Context, key *meta.Key) (*computebeta.TargetTcpProxy, error) - Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetTcpProxy) error + Get(ctx context.Context, key *meta.Key) (*compute.TargetTcpProxy, error) + Insert(ctx context.Context, key *meta.Key, obj *compute.TargetTcpProxy) error Delete(ctx context.Context, key *meta.Key) error } @@ -73,7 +72,7 @@ type Scope interface { ForwardingRuleSpec() *compute.ForwardingRule HealthCheckSpec() *compute.HealthCheck InstanceGroupSpec(zone string) *compute.InstanceGroup - TargetTCPProxySpec() *computebeta.TargetTcpProxy + TargetTCPProxySpec() *compute.TargetTcpProxy } // Service implements loadbalancers reconciler. @@ -98,6 +97,6 @@ func New(scope Scope) *Service { forwardingrules: scope.Cloud().GlobalForwardingRules(), healthchecks: scope.Cloud().HealthChecks(), instancegroups: scope.Cloud().InstanceGroups(), - targettcpproxies: scope.Cloud().BetaTargetTcpProxies(), // This is temporary to use beta API. + targettcpproxies: scope.Cloud().TargetTcpProxies(), } } diff --git a/go.mod b/go.mod index 62043f714..50fa2abea 100644 --- a/go.mod +++ b/go.mod @@ -23,6 +23,6 @@ require ( ) replace ( - github.com/GoogleCloudPlatform/k8s-cloud-provider => github.com/GoogleCloudPlatform/k8s-cloud-provider v1.16.1-0.20210622065854-abbfeadc9fda + github.com/GoogleCloudPlatform/k8s-cloud-provider => github.com/GoogleCloudPlatform/k8s-cloud-provider v1.16.1-0.20210702162410-39a62816f3fa sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v0.4.0 ) diff --git a/go.sum b/go.sum index 54e7c14d4..ee90c4ce8 100644 --- a/go.sum +++ b/go.sum @@ -57,8 +57,8 @@ github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBp github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/GoogleCloudPlatform/k8s-cloud-provider v1.16.1-0.20210622065854-abbfeadc9fda h1:I18CajUZOZ9o6BOSMF7uI2/xozIK4SEfMY+GtM4QxUE= -github.com/GoogleCloudPlatform/k8s-cloud-provider v1.16.1-0.20210622065854-abbfeadc9fda/go.mod h1:8XasY4ymP2V/tn2OOV9ZadmiTE1FIB/h3W+yNlPttKw= +github.com/GoogleCloudPlatform/k8s-cloud-provider v1.16.1-0.20210702162410-39a62816f3fa h1:AjKpB9LHpRkOWBJ1hecMcjJRkLDQqA3ORoXiU8HQBnY= +github.com/GoogleCloudPlatform/k8s-cloud-provider v1.16.1-0.20210702162410-39a62816f3fa/go.mod h1:8XasY4ymP2V/tn2OOV9ZadmiTE1FIB/h3W+yNlPttKw= github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd/go.mod h1:64YHyfSL2R96J44Nlwm39UHepQbyR5q10x7iYa1ks2E= github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ= github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE=