Skip to content

Commit 71bc0af

Browse files
authored
upgrade go to 1.22.5, capi to 1.8.1, linter to 1.57.2 (#137)
Signed-off-by: nasusoba <[email protected]> add event filter for kthreesconfig
1 parent cdadf3c commit 71bc0af

File tree

9 files changed

+200
-462
lines changed

9 files changed

+200
-462
lines changed

.golangci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,14 @@ linters-settings:
148148
- name: unused-parameter
149149
disabled: true
150150
staticcheck:
151-
go: "1.21"
151+
go: "1.22"
152152
stylecheck:
153-
go: "1.21"
153+
go: "1.22"
154154
tagliatelle:
155155
case:
156156
rules:
157157
# Any struct tag type can be used.
158158
# Support string case: `camel`, `pascal`, `kebab`, `snake`, `goCamel`, `goPascal`, `goKebab`, `goSnake`, `upper`, `lower`, `header`
159159
json: goCamel
160160
unused:
161-
go: "1.21"
161+
go: "1.22"

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
# Build the manager binary
16-
FROM --platform=${BUILDPLATFORM} docker.io/library/golang:1.21.9 as build
16+
FROM --platform=${BUILDPLATFORM} docker.io/library/golang:1.22.5 as build
1717
ARG TARGETOS TARGETARCH
1818
ARG package
1919

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ SHELL:=/usr/bin/env bash
2020

2121
.DEFAULT_GOAL:=help
2222

23-
GO_VERSION ?= 1.21.9
23+
GO_VERSION ?= 1.22.5
2424
GO_CONTAINER_IMAGE ?= docker.io/library/golang:$(GO_VERSION)
2525

2626
ARCH ?= $(shell go env GOARCH)
@@ -79,7 +79,7 @@ ENVSUBST_BIN := envsubst
7979
ENVSUBST := $(TOOLS_BIN_DIR)/$(ENVSUBST_BIN)
8080

8181
# Bump as necessary/desired to latest that supports our version of go at https://github.com/golangci/golangci-lint/releases
82-
GOLANGCI_LINT_VER := v1.55.2
82+
GOLANGCI_LINT_VER := v1.57.2
8383
GOLANGCI_LINT_BIN := golangci-lint
8484
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER)
8585

bootstrap/controllers/kthreesconfig_controller.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import (
3636
"sigs.k8s.io/cluster-api/util/annotations"
3737
"sigs.k8s.io/cluster-api/util/conditions"
3838
"sigs.k8s.io/cluster-api/util/patch"
39+
"sigs.k8s.io/cluster-api/util/predicates"
3940
ctrl "sigs.k8s.io/controller-runtime"
4041
"sigs.k8s.io/controller-runtime/pkg/client"
4142
"sigs.k8s.io/controller-runtime/pkg/reconcile"
@@ -505,6 +506,7 @@ func (r *KThreesConfigReconciler) SetupWithManager(mgr ctrl.Manager) error {
505506

506507
return ctrl.NewControllerManagedBy(mgr).
507508
For(&bootstrapv1.KThreesConfig{}).
509+
WithEventFilter(predicates.ResourceNotPaused(r.Log)).
508510
Complete(r)
509511
}
510512

controlplane/controllers/kthreescontrolplane_controller.go

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ import (
4141
"sigs.k8s.io/cluster-api/util/patch"
4242
"sigs.k8s.io/cluster-api/util/predicates"
4343
ctrl "sigs.k8s.io/controller-runtime"
44+
"sigs.k8s.io/controller-runtime/pkg/builder"
4445
"sigs.k8s.io/controller-runtime/pkg/client"
4546
"sigs.k8s.io/controller-runtime/pkg/controller"
4647
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
4748
"sigs.k8s.io/controller-runtime/pkg/handler"
4849
"sigs.k8s.io/controller-runtime/pkg/reconcile"
49-
"sigs.k8s.io/controller-runtime/pkg/source"
5050

5151
controlplanev1 "github.com/k3s-io/cluster-api-k3s/controlplane/api/v1beta2"
5252
k3s "github.com/k3s-io/cluster-api-k3s/pkg/k3s"
@@ -288,21 +288,18 @@ func (r *KThreesControlPlaneReconciler) SetupWithManager(ctx context.Context, mg
288288
For(&controlplanev1.KThreesControlPlane{}).
289289
Owns(&clusterv1.Machine{}).
290290
// WithOptions(options).
291-
// WithEventFilter(predicates.ResourceNotPaused(r.Log)).
292-
Build(r)
291+
WithEventFilter(predicates.ResourceNotPaused(r.Log)).
292+
Watches(
293+
&clusterv1.Cluster{},
294+
handler.EnqueueRequestsFromMapFunc(r.ClusterToKThreesControlPlane(ctx, log)),
295+
builder.WithPredicates(
296+
predicates.ClusterUnpausedAndInfrastructureReady(r.Log),
297+
),
298+
).Build(r)
293299
if err != nil {
294300
return fmt.Errorf("failed setting up with a controller manager: %w", err)
295301
}
296302

297-
err = c.Watch(
298-
source.Kind(mgr.GetCache(), &clusterv1.Cluster{}),
299-
handler.EnqueueRequestsFromMapFunc(r.ClusterToKThreesControlPlane(ctx, log)),
300-
predicates.ClusterUnpausedAndInfrastructureReady(r.Log),
301-
)
302-
if err != nil {
303-
return fmt.Errorf("failed adding Watch for Clusters to controller manager: %w", err)
304-
}
305-
306303
r.Scheme = mgr.GetScheme()
307304
r.controller = c
308305
r.recorder = mgr.GetEventRecorderFor("k3s-control-plane-controller")

controlplane/controllers/machine_controller.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"sigs.k8s.io/cluster-api/util/collections"
1717
"sigs.k8s.io/cluster-api/util/conditions"
1818
"sigs.k8s.io/cluster-api/util/patch"
19+
"sigs.k8s.io/cluster-api/util/predicates"
1920
ctrl "sigs.k8s.io/controller-runtime"
2021
"sigs.k8s.io/controller-runtime/pkg/client"
2122

@@ -45,6 +46,7 @@ type MachineReconciler struct {
4546
func (r *MachineReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, log *logr.Logger) error {
4647
_, err := ctrl.NewControllerManagedBy(mgr).
4748
For(&clusterv1.Machine{}).
49+
WithEventFilter(predicates.ResourceNotPaused(r.Log)).
4850
Build(r)
4951

5052
if r.managementCluster == nil {

go.mod

Lines changed: 62 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
module github.com/k3s-io/cluster-api-k3s
22

3-
go 1.21
3+
go 1.22.0
4+
5+
toolchain go1.22.6
46

57
require (
6-
github.com/coredns/corefile-migration v1.0.21
8+
github.com/coredns/corefile-migration v1.0.23
79
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
8-
github.com/go-logr/logr v1.4.1
9-
github.com/google/uuid v1.4.0
10+
github.com/go-logr/logr v1.4.2
11+
github.com/google/uuid v1.6.0
1012
github.com/onsi/ginkgo v1.16.5
11-
github.com/onsi/ginkgo/v2 v2.17.1
12-
github.com/onsi/gomega v1.32.0
13+
github.com/onsi/ginkgo/v2 v2.19.1
14+
github.com/onsi/gomega v1.34.0
1315
github.com/pkg/errors v0.9.1
14-
go.etcd.io/etcd/api/v3 v3.5.13
15-
go.etcd.io/etcd/client/v3 v3.5.13
16+
go.etcd.io/etcd/api/v3 v3.5.15
17+
go.etcd.io/etcd/client/v3 v3.5.15
1618
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
17-
google.golang.org/grpc v1.60.1
18-
google.golang.org/protobuf v1.33.0
19-
k8s.io/api v0.29.3
20-
k8s.io/apimachinery v0.29.3
21-
k8s.io/apiserver v0.29.3
22-
k8s.io/client-go v0.29.3
23-
k8s.io/klog/v2 v2.110.1
19+
google.golang.org/grpc v1.62.2
20+
google.golang.org/protobuf v1.34.1
21+
k8s.io/api v0.30.3
22+
k8s.io/apimachinery v0.30.3
23+
k8s.io/apiserver v0.30.3
24+
k8s.io/client-go v0.30.3
25+
k8s.io/klog/v2 v2.120.1
2426
k8s.io/utils v0.0.0-20240102154912-e7106e64919e
25-
sigs.k8s.io/cluster-api v1.7.1
26-
sigs.k8s.io/cluster-api/test v1.7.1
27-
sigs.k8s.io/controller-runtime v0.17.3
27+
sigs.k8s.io/cluster-api v1.8.1
28+
sigs.k8s.io/cluster-api/test v1.8.1
29+
sigs.k8s.io/controller-runtime v0.18.5
2830
sigs.k8s.io/yaml v1.4.0
2931
)
3032

@@ -36,23 +38,24 @@ require (
3638
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
3739
github.com/Microsoft/go-winio v0.5.0 // indirect
3840
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect
39-
github.com/adrg/xdg v0.4.0 // indirect
41+
github.com/adrg/xdg v0.5.0 // indirect
4042
github.com/alessio/shellescape v1.4.1 // indirect
4143
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df // indirect
4244
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
4345
github.com/beorn7/perks v1.0.1 // indirect
4446
github.com/blang/semver/v4 v4.0.0 // indirect
47+
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
4548
github.com/cespare/xxhash/v2 v2.2.0 // indirect
4649
github.com/cloudflare/circl v1.3.7 // indirect
47-
github.com/coredns/caddy v1.1.0 // indirect
50+
github.com/coredns/caddy v1.1.1 // indirect
4851
github.com/coreos/go-semver v0.3.1 // indirect
4952
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
50-
github.com/distribution/reference v0.5.0 // indirect
51-
github.com/docker/docker v25.0.5+incompatible // indirect
53+
github.com/distribution/reference v0.6.0 // indirect
54+
github.com/docker/docker v27.1.1+incompatible // indirect
5255
github.com/docker/go-connections v0.5.0 // indirect
5356
github.com/docker/go-units v0.4.0 // indirect
5457
github.com/drone/envsubst/v2 v2.0.0-20210730161058-179042472c46 // indirect
55-
github.com/emicklei/go-restful/v3 v3.12.0 // indirect
58+
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
5659
github.com/evanphx/json-patch v5.7.0+incompatible // indirect
5760
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
5861
github.com/felixge/httpsnoop v1.0.4 // indirect
@@ -62,19 +65,21 @@ require (
6265
github.com/go-openapi/jsonpointer v0.19.6 // indirect
6366
github.com/go-openapi/jsonreference v0.20.2 // indirect
6467
github.com/go-openapi/swag v0.22.3 // indirect
65-
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
68+
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
6669
github.com/gobuffalo/flect v1.0.2 // indirect
6770
github.com/gogo/protobuf v1.3.2 // indirect
6871
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
6972
github.com/golang/protobuf v1.5.4 // indirect
70-
github.com/google/cel-go v0.17.7 // indirect
73+
github.com/google/cel-go v0.17.8 // indirect
7174
github.com/google/gnostic-models v0.6.8 // indirect
7275
github.com/google/go-cmp v0.6.0 // indirect
7376
github.com/google/go-github/v53 v53.2.0 // indirect
7477
github.com/google/go-querystring v1.1.0 // indirect
7578
github.com/google/gofuzz v1.2.0 // indirect
76-
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
79+
github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 // indirect
7780
github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2 // indirect
81+
github.com/gorilla/websocket v1.5.0 // indirect
82+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
7883
github.com/hashicorp/hcl v1.0.0 // indirect
7984
github.com/huandu/xstrings v1.3.3 // indirect
8085
github.com/imdario/mergo v0.3.13 // indirect
@@ -88,6 +93,7 @@ require (
8893
github.com/mitchellh/copystructure v1.2.0 // indirect
8994
github.com/mitchellh/mapstructure v1.5.0 // indirect
9095
github.com/mitchellh/reflectwalk v1.0.2 // indirect
96+
github.com/moby/docker-image-spec v1.3.1 // indirect
9197
github.com/moby/spdystream v0.2.0 // indirect
9298
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
9399
github.com/modern-go/reflect2 v1.0.2 // indirect
@@ -97,9 +103,9 @@ require (
97103
github.com/opencontainers/go-digest v1.0.0 // indirect
98104
github.com/opencontainers/image-spec v1.0.2 // indirect
99105
github.com/pelletier/go-toml v1.9.5 // indirect
100-
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
106+
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
101107
github.com/prometheus/client_golang v1.18.0 // indirect
102-
github.com/prometheus/client_model v0.5.0 // indirect
108+
github.com/prometheus/client_model v0.6.0 // indirect
103109
github.com/prometheus/common v0.45.0 // indirect
104110
github.com/prometheus/procfs v0.12.0 // indirect
105111
github.com/sagikazarmark/locafero v0.4.0 // indirect
@@ -108,43 +114,46 @@ require (
108114
github.com/sourcegraph/conc v0.3.0 // indirect
109115
github.com/spf13/afero v1.11.0 // indirect
110116
github.com/spf13/cast v1.6.0 // indirect
111-
github.com/spf13/cobra v1.8.0 // indirect
117+
github.com/spf13/cobra v1.8.1 // indirect
112118
github.com/spf13/pflag v1.0.5 // indirect
113-
github.com/spf13/viper v1.18.2 // indirect
119+
github.com/spf13/viper v1.19.0 // indirect
114120
github.com/stoewer/go-strcase v1.2.0 // indirect
115121
github.com/subosito/gotenv v1.6.0 // indirect
116122
github.com/valyala/fastjson v1.6.4 // indirect
117-
go.etcd.io/etcd/client/pkg/v3 v3.5.13 // indirect
118-
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0 // indirect
119-
go.opentelemetry.io/otel v1.22.0 // indirect
120-
go.opentelemetry.io/otel/metric v1.22.0 // indirect
121-
go.opentelemetry.io/otel/trace v1.22.0 // indirect
123+
go.etcd.io/etcd/client/pkg/v3 v3.5.15 // indirect
124+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
125+
go.opentelemetry.io/otel v1.24.0 // indirect
126+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0 // indirect
127+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 // indirect
128+
go.opentelemetry.io/otel/metric v1.24.0 // indirect
129+
go.opentelemetry.io/otel/sdk v1.22.0 // indirect
130+
go.opentelemetry.io/otel/trace v1.24.0 // indirect
131+
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
122132
go.uber.org/multierr v1.11.0 // indirect
123-
go.uber.org/zap v1.26.0 // indirect
124-
golang.org/x/crypto v0.21.0 // indirect
125-
golang.org/x/net v0.23.0 // indirect
126-
golang.org/x/oauth2 v0.18.0 // indirect
127-
golang.org/x/sync v0.6.0 // indirect
128-
golang.org/x/sys v0.18.0 // indirect
129-
golang.org/x/term v0.18.0 // indirect
130-
golang.org/x/text v0.14.0 // indirect
133+
go.uber.org/zap v1.27.0 // indirect
134+
golang.org/x/crypto v0.25.0 // indirect
135+
golang.org/x/net v0.27.0 // indirect
136+
golang.org/x/oauth2 v0.21.0 // indirect
137+
golang.org/x/sync v0.7.0 // indirect
138+
golang.org/x/sys v0.22.0 // indirect
139+
golang.org/x/term v0.22.0 // indirect
140+
golang.org/x/text v0.16.0 // indirect
131141
golang.org/x/time v0.5.0 // indirect
132-
golang.org/x/tools v0.17.0 // indirect
142+
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
133143
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
134-
google.golang.org/appengine v1.6.8 // indirect
135-
google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 // indirect
136-
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect
137-
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
144+
google.golang.org/genproto/googleapis/api v0.0.0-20240311132316-a219d84964c2 // indirect
145+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240314234333-6e1732d8331c // indirect
138146
gopkg.in/inf.v0 v0.9.1 // indirect
139147
gopkg.in/ini.v1 v1.67.0 // indirect
140148
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
141149
gopkg.in/yaml.v2 v2.4.0 // indirect
142150
gopkg.in/yaml.v3 v3.0.1 // indirect
143-
k8s.io/apiextensions-apiserver v0.29.3 // indirect
144-
k8s.io/cluster-bootstrap v0.29.3 // indirect
145-
k8s.io/component-base v0.29.3 // indirect
146-
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
151+
k8s.io/apiextensions-apiserver v0.30.3 // indirect
152+
k8s.io/cluster-bootstrap v0.30.3 // indirect
153+
k8s.io/component-base v0.30.3 // indirect
154+
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
155+
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.0 // indirect
147156
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
148-
sigs.k8s.io/kind v0.22.0 // indirect
157+
sigs.k8s.io/kind v0.23.0 // indirect
149158
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
150159
)

0 commit comments

Comments
 (0)