Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: "v1.55"
version: v1.58
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

# Build the manager binary
FROM golang:1.21.7@sha256:549dd88a1a53715f177b41ab5fee25f7a376a6bb5322ac7abe263480d9554021 as builder
FROM golang:1.21.10@sha256:45f2cab1eebfb90d214ab8ce896cefc320e5c8768b4b34bb402652d90c670875 as builder
WORKDIR /workspace

# Run this with docker build --build_arg $(go env GOPROXY) to override the goproxy
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ ENVSUBST_VER := v1.4.2
ENVSUBST_BIN := envsubst
ENVSUBST := $(TOOLS_BIN_DIR)/$(ENVSUBST_BIN)

GOLANGCI_LINT_VER := v1.55.2
GOLANGCI_LINT_VER := v1.58.0
GOLANGCI_LINT_BIN := golangci-lint
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER)

Expand All @@ -87,7 +87,7 @@ RELEASE_NOTES_VER := v0.11.0
RELEASE_NOTES_BIN := release-notes
RELEASE_NOTES := $(TOOLS_BIN_DIR)/$(RELEASE_NOTES_BIN)-$(RELEASE_NOTES_VER)

GINKGO_VER := v2.15.0
GINKGO_VER := v2.17.3
GINKGO_BIN := ginkgo
GINKGO := $(TOOLS_BIN_DIR)/$(GINKGO_BIN)-$(GINKGO_VER)
GINKGO_PKG := github.com/onsi/ginkgo/v2/ginkgo
Expand Down Expand Up @@ -140,7 +140,7 @@ endif
# Build time versioning details.
LDFLAGS := $(shell hack/version.sh)

GOLANG_VERSION := 1.21.6
GOLANG_VERSION := 1.21.10

# CI
CAPG_WORKER_CLUSTER_KUBECONFIG ?= "/tmp/kubeconfig"
Expand Down Expand Up @@ -464,7 +464,7 @@ create-management-cluster: $(KUSTOMIZE) $(ENVSUBST) $(KIND) $(KUBECTL)
./hack/install-cert-manager.sh

# Deploy CAPI
curl --retry $(CURL_RETRIES) -sSL https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.6.2/cluster-api-components.yaml | $(ENVSUBST) | $(KUBECTL) apply -f -
curl --retry $(CURL_RETRIES) -sSL https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.6.5/cluster-api-components.yaml | $(ENVSUBST) | $(KUBECTL) apply -f -

# Deploy CAPG
$(KIND) load docker-image $(CONTROLLER_IMG)-$(ARCH):$(TAG) --name=clusterapi
Expand Down
2 changes: 1 addition & 1 deletion Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ settings = {
"deploy_cert_manager": True,
"preload_images_for_kind": True,
"kind_cluster_name": "capg",
"capi_version": "v1.6.2",
"capi_version": "v1.6.5",
"cert_manager_version": "v1.11.0",
"kubernetes_version": "v1.28.6",
}
Expand Down
4 changes: 2 additions & 2 deletions cloud/providerid/providerid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestProviderID_New(t *testing.T) {
}

for _, tc := range testCases {
t.Run(tc.testname, func(t *testing.T) {
t.Run(tc.testname, func(_ *testing.T) {
providerID, err := providerid.New(tc.project, tc.location, tc.name)

if tc.expectError {
Expand Down Expand Up @@ -102,7 +102,7 @@ func TestProviderID_NewFromResourceURL(t *testing.T) {
}

for _, tc := range testCases {
t.Run(tc.testname, func(t *testing.T) {
t.Run(tc.testname, func(_ *testing.T) {
providerID, err := providerid.NewFromResourceURL(tc.resourceURL)

if tc.expectError {
Expand Down
10 changes: 6 additions & 4 deletions cloud/services/compute/firewalls/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,18 @@ package firewalls
import (
"context"

k8scloud "github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud"
"github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta"
"google.golang.org/api/compute/v1"

"sigs.k8s.io/cluster-api-provider-gcp/cloud"
)

type firewallsInterface interface {
Get(ctx context.Context, key *meta.Key) (*compute.Firewall, error)
Insert(ctx context.Context, key *meta.Key, obj *compute.Firewall) error
Update(ctx context.Context, key *meta.Key, obj *compute.Firewall) error
Delete(ctx context.Context, key *meta.Key) error
Get(ctx context.Context, key *meta.Key, options ...k8scloud.Option) (*compute.Firewall, error)
Insert(ctx context.Context, key *meta.Key, obj *compute.Firewall, options ...k8scloud.Option) error
Update(ctx context.Context, key *meta.Key, obj *compute.Firewall, options ...k8scloud.Option) error
Delete(ctx context.Context, key *meta.Key, options ...k8scloud.Option) error
}

// Scope is an interfaces that hold used methods.
Expand Down
2 changes: 1 addition & 1 deletion cloud/services/compute/instances/reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func TestService_createOrGetInstance(t *testing.T) {
mockInstance: &cloud.MockInstances{
ProjectRouter: &cloud.SingleProjectRouter{ID: "proj-id"},
Objects: map[meta.Key]*cloud.MockInstancesObj{},
GetHook: func(ctx context.Context, key *meta.Key, m *cloud.MockInstances) (bool, *compute.Instance, error) {
GetHook: func(_ context.Context, _ *meta.Key, _ *cloud.MockInstances, _ ...cloud.Option) (bool, *compute.Instance, error) {
return true, &compute.Instance{}, &googleapi.Error{Code: http.StatusBadRequest}
},
},
Expand Down
14 changes: 8 additions & 6 deletions cloud/services/compute/instances/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,24 @@ import (

"github.com/go-logr/logr"

k8scloud "github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud"
"github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/filter"
"github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta"
"google.golang.org/api/compute/v1"

"sigs.k8s.io/cluster-api-provider-gcp/cloud"
)

type instancesInterface interface {
Get(ctx context.Context, key *meta.Key) (*compute.Instance, error)
Insert(ctx context.Context, key *meta.Key, obj *compute.Instance) error
Delete(ctx context.Context, key *meta.Key) error
Get(ctx context.Context, key *meta.Key, options ...k8scloud.Option) (*compute.Instance, error)
Insert(ctx context.Context, key *meta.Key, obj *compute.Instance, options ...k8scloud.Option) error
Delete(ctx context.Context, key *meta.Key, options ...k8scloud.Option) error
}

type instancegroupsInterface interface {
AddInstances(ctx context.Context, key *meta.Key, req *compute.InstanceGroupsAddInstancesRequest) error
ListInstances(ctx context.Context, key *meta.Key, req *compute.InstanceGroupsListInstancesRequest, fl *filter.F) ([]*compute.InstanceWithNamedPorts, error)
RemoveInstances(ctx context.Context, key *meta.Key, req *compute.InstanceGroupsRemoveInstancesRequest) error
AddInstances(ctx context.Context, key *meta.Key, req *compute.InstanceGroupsAddInstancesRequest, options ...k8scloud.Option) error
ListInstances(ctx context.Context, key *meta.Key, req *compute.InstanceGroupsListInstancesRequest, fl *filter.F, options ...k8scloud.Option) ([]*compute.InstanceWithNamedPorts, error)
RemoveInstances(ctx context.Context, key *meta.Key, req *compute.InstanceGroupsRemoveInstancesRequest, options ...k8scloud.Option) error
}

// Scope is an interfaces that hold used methods.
Expand Down
2 changes: 2 additions & 0 deletions cloud/services/compute/loadbalancers/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ import (

"github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta"
"google.golang.org/api/compute/v1"

"k8s.io/utils/ptr"

"sigs.k8s.io/cluster-api-provider-gcp/cloud/gcperrors"
"sigs.k8s.io/controller-runtime/pkg/log"
)
Expand Down
42 changes: 22 additions & 20 deletions cloud/services/compute/loadbalancers/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,48 +19,50 @@ package loadbalancers
import (
"context"

k8scloud "github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud"
"github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/filter"
"github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta"
"google.golang.org/api/compute/v1"

"sigs.k8s.io/cluster-api-provider-gcp/cloud"
)

type addressesInterface interface {
Get(ctx context.Context, key *meta.Key) (*compute.Address, error)
Insert(ctx context.Context, key *meta.Key, obj *compute.Address) error
Delete(ctx context.Context, key *meta.Key) error
Get(ctx context.Context, key *meta.Key, options ...k8scloud.Option) (*compute.Address, error)
Insert(ctx context.Context, key *meta.Key, obj *compute.Address, options ...k8scloud.Option) error
Delete(ctx context.Context, key *meta.Key, options ...k8scloud.Option) error
}

type backendservicesInterface interface {
Get(ctx context.Context, key *meta.Key) (*compute.BackendService, error)
Insert(ctx context.Context, key *meta.Key, obj *compute.BackendService) error
Update(context.Context, *meta.Key, *compute.BackendService) error
Delete(ctx context.Context, key *meta.Key) error
Get(ctx context.Context, key *meta.Key, options ...k8scloud.Option) (*compute.BackendService, error)
Insert(ctx context.Context, key *meta.Key, obj *compute.BackendService, options ...k8scloud.Option) error
Update(ctx context.Context, key *meta.Key, obj *compute.BackendService, options ...k8scloud.Option) error
Delete(ctx context.Context, key *meta.Key, options ...k8scloud.Option) error
}

type forwardingrulesInterface interface {
Get(ctx context.Context, key *meta.Key) (*compute.ForwardingRule, error)
Insert(ctx context.Context, key *meta.Key, obj *compute.ForwardingRule) error
Delete(ctx context.Context, key *meta.Key) error
Get(ctx context.Context, key *meta.Key, options ...k8scloud.Option) (*compute.ForwardingRule, error)
Insert(ctx context.Context, key *meta.Key, obj *compute.ForwardingRule, options ...k8scloud.Option) error
Delete(ctx context.Context, key *meta.Key, options ...k8scloud.Option) error
}

type healthchecksInterface interface {
Get(ctx context.Context, key *meta.Key) (*compute.HealthCheck, error)
Insert(ctx context.Context, key *meta.Key, obj *compute.HealthCheck) error
Delete(ctx context.Context, key *meta.Key) error
Get(ctx context.Context, key *meta.Key, options ...k8scloud.Option) (*compute.HealthCheck, error)
Insert(ctx context.Context, key *meta.Key, obj *compute.HealthCheck, options ...k8scloud.Option) error
Delete(ctx context.Context, key *meta.Key, options ...k8scloud.Option) error
}

type instancegroupsInterface interface {
Get(ctx context.Context, key *meta.Key) (*compute.InstanceGroup, error)
List(ctx context.Context, zone string, fl *filter.F) ([]*compute.InstanceGroup, error)
Insert(ctx context.Context, key *meta.Key, obj *compute.InstanceGroup) error
Delete(ctx context.Context, key *meta.Key) error
Get(ctx context.Context, key *meta.Key, options ...k8scloud.Option) (*compute.InstanceGroup, error)
List(ctx context.Context, zone string, fl *filter.F, options ...k8scloud.Option) ([]*compute.InstanceGroup, error)
Insert(ctx context.Context, key *meta.Key, obj *compute.InstanceGroup, options ...k8scloud.Option) error
Delete(ctx context.Context, key *meta.Key, options ...k8scloud.Option) error
}

type targettcpproxiesInterface interface {
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
Get(ctx context.Context, key *meta.Key, options ...k8scloud.Option) (*compute.TargetTcpProxy, error)
Insert(ctx context.Context, key *meta.Key, obj *compute.TargetTcpProxy, options ...k8scloud.Option) error
Delete(ctx context.Context, key *meta.Key, options ...k8scloud.Option) error
}

// Scope is an interfaces that hold used methods.
Expand Down
14 changes: 8 additions & 6 deletions cloud/services/compute/networks/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,23 @@ package networks
import (
"context"

k8scloud "github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud"
"github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta"
"google.golang.org/api/compute/v1"

"sigs.k8s.io/cluster-api-provider-gcp/cloud"
)

type networksInterface interface {
Get(ctx context.Context, key *meta.Key) (*compute.Network, error)
Insert(ctx context.Context, key *meta.Key, obj *compute.Network) error
Delete(ctx context.Context, key *meta.Key) error
Get(ctx context.Context, key *meta.Key, options ...k8scloud.Option) (*compute.Network, error)
Insert(ctx context.Context, key *meta.Key, obj *compute.Network, options ...k8scloud.Option) error
Delete(ctx context.Context, key *meta.Key, options ...k8scloud.Option) error
}

type routersInterface interface {
Get(ctx context.Context, key *meta.Key) (*compute.Router, error)
Insert(ctx context.Context, key *meta.Key, obj *compute.Router) error
Delete(ctx context.Context, key *meta.Key) error
Get(ctx context.Context, key *meta.Key, options ...k8scloud.Option) (*compute.Router, error)
Insert(ctx context.Context, key *meta.Key, obj *compute.Router, options ...k8scloud.Option) error
Delete(ctx context.Context, key *meta.Key, options ...k8scloud.Option) error
}

// Scope is an interfaces that hold used methods.
Expand Down
2 changes: 1 addition & 1 deletion cloud/services/compute/subnets/reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func TestService_Reconcile(t *testing.T) {
mockSubnetworks: &cloud.MockSubnetworks{
ProjectRouter: &cloud.SingleProjectRouter{ID: "my-proj"},
Objects: map[meta.Key]*cloud.MockSubnetworksObj{},
GetHook: func(ctx context.Context, key *meta.Key, m *cloud.MockSubnetworks) (bool, *compute.Subnetwork, error) {
GetHook: func(_ context.Context, _ *meta.Key, _ *cloud.MockSubnetworks, _ ...cloud.Option) (bool, *compute.Subnetwork, error) {
return true, &compute.Subnetwork{}, &googleapi.Error{Code: http.StatusBadRequest}
},
},
Expand Down
8 changes: 5 additions & 3 deletions cloud/services/compute/subnets/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@ package subnets
import (
"context"

k8scloud "github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud"
"github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta"
"google.golang.org/api/compute/v1"

"sigs.k8s.io/cluster-api-provider-gcp/cloud"
)

type subnetsInterface interface {
Get(ctx context.Context, key *meta.Key) (*compute.Subnetwork, error)
Insert(ctx context.Context, key *meta.Key, obj *compute.Subnetwork) error
Delete(ctx context.Context, key *meta.Key) error
Get(ctx context.Context, key *meta.Key, options ...k8scloud.Option) (*compute.Subnetwork, error)
Insert(ctx context.Context, key *meta.Key, obj *compute.Subnetwork, options ...k8scloud.Option) error
Delete(ctx context.Context, key *meta.Key, options ...k8scloud.Option) error
}

// Scope is an interfaces that hold used methods.
Expand Down
2 changes: 1 addition & 1 deletion exp/controllers/gcpmanagedmachinepool_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func GetOwnerClusterKey(obj metav1.ObjectMeta) (*client.ObjectKey, error) {
}

func machinePoolToInfrastructureMapFunc(gvk schema.GroupVersionKind) handler.MapFunc {
return func(ctx context.Context, o client.Object) []reconcile.Request {
return func(_ context.Context, o client.Object) []reconcile.Request {
m, ok := o.(*expclusterv1.MachinePool)
if !ok {
panic(fmt.Sprintf("Expected a MachinePool but got a %T", o))
Expand Down
Loading