Skip to content

Commit 45d0600

Browse files
authored
Update to go-1.24 and golangci-lint v2 (#72)
1 parent 786b6ee commit 45d0600

File tree

14 files changed

+142
-154
lines changed

14 files changed

+142
-154
lines changed

.github/workflows/docker.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ jobs:
3131
- name: Checkout
3232
uses: actions/checkout@v4
3333

34-
- name: Set up Go 1.23
34+
- name: Set up Go 1.24
3535
uses: actions/setup-go@v5
3636
with:
37-
go-version: '1.23'
37+
go-version: '1.24'
3838
cache: false
3939

4040
- name: Lint
41-
uses: golangci/golangci-lint-action@v6
41+
uses: golangci/golangci-lint-action@v7
4242
with:
43-
args: --build-tags integration -p bugs -p unused --timeout=10m
43+
args: --build-tags integration --timeout=10m
4444

4545
- name: Make tag
4646
run: |
@@ -63,10 +63,10 @@ jobs:
6363
- name: Checkout
6464
uses: actions/checkout@v4
6565

66-
- name: Set up Go 1.23
66+
- name: Set up Go 1.24
6767
uses: actions/setup-go@v5
6868
with:
69-
go-version: '1.23'
69+
go-version: '1.24'
7070

7171
- name: Test
7272
run: |

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the firewall-controller-manager binary
2-
FROM golang:1.23 AS builder
2+
FROM golang:1.24 AS builder
33

44
WORKDIR /work
55
COPY . .

Dockerfile.dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM alpine:3.19
1+
FROM alpine:3.21
22
COPY bin/firewall-controller-manager /firewall-controller-manager
33
USER 65534
44
ENTRYPOINT ["/firewall-controller-manager"]

api/v2/helper/seed_access.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
configv1 "k8s.io/client-go/tools/clientcmd/api/v1"
1616

1717
"k8s.io/apimachinery/pkg/runtime"
18-
"sigs.k8s.io/controller-runtime/pkg/client"
1918
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
2019
)
2120

@@ -313,7 +312,7 @@ func GetAccessKubeconfig(c *AccessConfig) ([]byte, error) {
313312
Namespace: c.Namespace,
314313
},
315314
}
316-
err = cl.Get(c.Ctx, client.ObjectKeyFromObject(saSecret), saSecret, &client.GetOptions{})
315+
err = cl.Get(c.Ctx, controllerclient.ObjectKeyFromObject(saSecret), saSecret, &controllerclient.GetOptions{})
317316
if err != nil {
318317
return nil, err
319318
}

api/v2/helper/shoot_access.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1414
"k8s.io/apimachinery/pkg/runtime"
1515
"k8s.io/client-go/rest"
16-
"sigs.k8s.io/controller-runtime/pkg/client"
1716
controllerclient "sigs.k8s.io/controller-runtime/pkg/client"
1817

1918
"k8s.io/client-go/tools/clientcmd"
@@ -22,7 +21,7 @@ import (
2221
)
2322

2423
type ShootAccessHelper struct {
25-
seed client.Client
24+
seed controllerclient.Client
2625
access *v2.ShootAccess
2726
tokenPath string
2827

@@ -31,7 +30,7 @@ type ShootAccessHelper struct {
3130

3231
// NewShootAccessHelper provides shoot access functions based on shoot access secrets,
3332
// i.e. Gardener's generic kubeconfig and token secret.
34-
func NewShootAccessHelper(seed client.Client, access *v2.ShootAccess) *ShootAccessHelper {
33+
func NewShootAccessHelper(seed controllerclient.Client, access *v2.ShootAccess) *ShootAccessHelper {
3534
return &ShootAccessHelper{
3635
seed: seed,
3736
access: access,
@@ -90,7 +89,7 @@ func (s *ShootAccessHelper) Config(ctx context.Context) (*configv1.Config, error
9089
},
9190
}
9291

93-
err := s.seed.Get(ctx, client.ObjectKeyFromObject(kubeconfigTemplate), kubeconfigTemplate)
92+
err := s.seed.Get(ctx, controllerclient.ObjectKeyFromObject(kubeconfigTemplate), kubeconfigTemplate)
9493
if err != nil {
9594
return nil, fmt.Errorf("unable to read generic kubeconfig secret: %w", err)
9695
}
@@ -152,7 +151,7 @@ func (s *ShootAccessHelper) RESTConfig(ctx context.Context) (*rest.Config, error
152151
return restConfig, nil
153152
}
154153

155-
func (s *ShootAccessHelper) Client(ctx context.Context) (client.Client, error) {
154+
func (s *ShootAccessHelper) Client(ctx context.Context) (controllerclient.Client, error) {
156155
var (
157156
config *rest.Config
158157
err error
@@ -185,7 +184,7 @@ func (s *ShootAccessHelper) readTokenSecret(ctx context.Context) (string, error)
185184
},
186185
}
187186

188-
err := s.seed.Get(ctx, client.ObjectKeyFromObject(tokenSecret), tokenSecret)
187+
err := s.seed.Get(ctx, controllerclient.ObjectKeyFromObject(tokenSecret), tokenSecret)
189188
if err != nil {
190189
return "", fmt.Errorf("unable to read token secret: %w", err)
191190
}

controllers/firewall/status.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,10 @@ func SetFirewallStatusFromMonitor(fw *v2.Firewall, mon *v2.FirewallMonitor) {
161161
cond := v2.NewCondition(v2.FirewallControllerConnected, v2.ConditionFalse, "NotConnected", "Controller has not yet connected to shoot.")
162162
fw.Status.Conditions.Set(cond)
163163
} else if time.Since(connection.Updated.Time) > 5*time.Minute {
164-
cond := v2.NewCondition(v2.FirewallControllerConnected, v2.ConditionFalse, "StoppedReconciling", fmt.Sprintf("Controller has stopped reconciling since %s to shoot.", connection.Updated.Time.String()))
164+
cond := v2.NewCondition(v2.FirewallControllerConnected, v2.ConditionFalse, "StoppedReconciling", fmt.Sprintf("Controller has stopped reconciling since %s to shoot.", connection.Updated.String()))
165165
fw.Status.Conditions.Set(cond)
166166
} else {
167-
cond := v2.NewCondition(v2.FirewallControllerConnected, v2.ConditionTrue, "Connected", fmt.Sprintf("Controller reconciled shoot at %s.", connection.Updated.Time.String()))
167+
cond := v2.NewCondition(v2.FirewallControllerConnected, v2.ConditionTrue, "Connected", fmt.Sprintf("Controller reconciled shoot at %s.", connection.Updated.String()))
168168
fw.Status.Conditions.Set(cond)
169169
}
170170

@@ -173,10 +173,10 @@ func SetFirewallStatusFromMonitor(fw *v2.Firewall, mon *v2.FirewallMonitor) {
173173
cond := v2.NewCondition(v2.FirewallControllerSeedConnected, v2.ConditionFalse, "NotConnected", "Controller has not yet connected to seed.")
174174
fw.Status.Conditions.Set(cond)
175175
} else if time.Since(connection.SeedUpdated.Time) > 5*time.Minute {
176-
cond := v2.NewCondition(v2.FirewallControllerSeedConnected, v2.ConditionFalse, "StoppedReconciling", fmt.Sprintf("Controller has stopped reconciling since %s to seed.", connection.SeedUpdated.Time.String()))
176+
cond := v2.NewCondition(v2.FirewallControllerSeedConnected, v2.ConditionFalse, "StoppedReconciling", fmt.Sprintf("Controller has stopped reconciling since %s to seed.", connection.SeedUpdated.String()))
177177
fw.Status.Conditions.Set(cond)
178178
} else {
179-
cond := v2.NewCondition(v2.FirewallControllerSeedConnected, v2.ConditionTrue, "Connected", fmt.Sprintf("Controller reconciled firewall at %s.", connection.SeedUpdated.Time.String()))
179+
cond := v2.NewCondition(v2.FirewallControllerSeedConnected, v2.ConditionTrue, "Connected", fmt.Sprintf("Controller reconciled firewall at %s.", connection.SeedUpdated.String()))
180180
fw.Status.Conditions.Set(cond)
181181
}
182182

controllers/generic_controller.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,6 @@ func (g GenericController[O]) Reconcile(ctx context.Context, req ctrl.Request) (
161161
if statusErr != nil {
162162
log.Error(statusErr, "status could not be updated")
163163
}
164-
165-
return
166164
}()
167165
}
168166

controllers/set/controller_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ var _ = Context("firewall set controller", Ordered, func() {
101101
for _, fw := range fws.Items {
102102
fw := fw
103103

104-
fmt.Fprintf(GinkgoWriter, "Having %s with creation timestamp: %s\n", fw.Name, fw.CreationTimestamp.String())
104+
_, _ = fmt.Fprintf(GinkgoWriter, "Having %s with creation timestamp: %s\n", fw.Name, fw.CreationTimestamp.String())
105105

106106
if newest == nil {
107107
newest = &fw
@@ -112,7 +112,7 @@ var _ = Context("firewall set controller", Ordered, func() {
112112
}
113113

114114
Expect(newest).NotTo(BeNil())
115-
fmt.Fprintf(GinkgoWriter, "The latest firewall is: %s\n", newest.Name)
115+
_, _ = fmt.Fprintf(GinkgoWriter, "The latest firewall is: %s\n", newest.Name)
116116

117117
Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(set), set)).To(Succeed())
118118
set.Spec.Replicas = 1

controllers/update/reconcile_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ func Test_controller_autoUpdateOS(t *testing.T) {
220220
var ownedFirewalls []v2.Firewall
221221
for _, existingFw := range tt.existingFws {
222222
ownedFirewall := existingFw.DeepCopy()
223-
ownedFirewall.ObjectMeta.OwnerReferences = []metav1.OwnerReference{
223+
ownedFirewall.OwnerReferences = []metav1.OwnerReference{
224224
*metav1.NewControllerRef(&latestSet, v2.GroupVersion.WithKind("FirewallSet")),
225225
}
226226
ownedFirewalls = append(ownedFirewalls, *ownedFirewall)

go.mod

Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
module github.com/metal-stack/firewall-controller-manager
22

3-
go 1.23
3+
go 1.24
4+
5+
toolchain go1.24.2
46

57
require (
68
github.com/Masterminds/semver/v3 v3.3.1
79
github.com/flatcar/container-linux-config-transpiler v0.9.4
810
github.com/go-logr/logr v1.4.2
911
github.com/go-openapi/strfmt v0.23.0
10-
github.com/google/go-cmp v0.6.0
12+
github.com/google/go-cmp v0.7.0
1113
github.com/google/uuid v1.6.0
12-
github.com/metal-stack/metal-go v0.39.7
13-
github.com/metal-stack/metal-lib v0.19.1
14+
github.com/metal-stack/metal-go v0.41.0
15+
github.com/metal-stack/metal-lib v0.21.0
1416
github.com/metal-stack/v v1.0.3
15-
github.com/onsi/ginkgo/v2 v2.22.2
16-
github.com/onsi/gomega v1.36.2
17-
github.com/prometheus/client_golang v1.20.5
17+
github.com/onsi/ginkgo/v2 v2.23.4
18+
github.com/onsi/gomega v1.37.0
19+
github.com/prometheus/client_golang v1.22.0
1820
github.com/stretchr/testify v1.10.0
1921
k8s.io/api v0.29.3
20-
k8s.io/apimachinery v0.31.0
22+
k8s.io/apimachinery v0.32.3
2123
k8s.io/client-go v0.29.3
2224
sigs.k8s.io/controller-runtime v0.16.5
2325
)
@@ -30,18 +32,18 @@ require (
3032
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
3133
github.com/beorn7/perks v1.0.1 // indirect
3234
github.com/cespare/xxhash/v2 v2.3.0 // indirect
33-
github.com/coreos/go-oidc/v3 v3.12.0 // indirect
35+
github.com/coreos/go-oidc/v3 v3.13.0 // indirect
3436
github.com/coreos/go-semver v0.3.1 // indirect
3537
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect
3638
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
3739
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
38-
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
40+
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
3941
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
4042
github.com/evanphx/json-patch/v5 v5.8.0 // indirect
4143
github.com/fatih/color v1.18.0 // indirect
4244
github.com/flatcar/ignition v0.36.2 // indirect
4345
github.com/fsnotify/fsnotify v1.8.0 // indirect
44-
github.com/go-jose/go-jose/v4 v4.0.4 // indirect
46+
github.com/go-jose/go-jose/v4 v4.0.5 // indirect
4547
github.com/go-logr/stdr v1.2.2 // indirect
4648
github.com/go-openapi/analysis v0.23.0 // indirect
4749
github.com/go-openapi/errors v0.22.0 // indirect
@@ -53,34 +55,32 @@ require (
5355
github.com/go-openapi/swag v0.23.0 // indirect
5456
github.com/go-openapi/validate v0.24.0 // indirect
5557
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
58+
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
5659
github.com/goccy/go-json v0.10.4 // indirect
57-
github.com/goccy/go-yaml v1.12.0 // indirect
60+
github.com/goccy/go-yaml v1.16.0 // indirect
5861
github.com/gogo/protobuf v1.3.2 // indirect
59-
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
62+
github.com/golang-jwt/jwt/v5 v5.2.2 // indirect
6063
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
6164
github.com/golang/protobuf v1.5.4 // indirect
6265
github.com/google/gnostic-models v0.6.9 // indirect
6366
github.com/google/gofuzz v1.2.0 // indirect
64-
github.com/google/pprof v0.0.0-20250202011525-fc3143867406 // indirect
67+
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect
6568
github.com/gorilla/mux v1.8.1 // indirect
66-
github.com/hashicorp/hcl v1.0.0 // indirect
6769
github.com/imdario/mergo v0.3.16 // indirect
6870
github.com/inconshreveable/mousetrap v1.1.0 // indirect
6971
github.com/josharian/intern v1.0.0 // indirect
7072
github.com/json-iterator/go v1.1.12 // indirect
71-
github.com/klauspost/compress v1.17.11 // indirect
7273
github.com/lestrrat-go/blackmagic v1.0.2 // indirect
7374
github.com/lestrrat-go/httpcc v1.0.1 // indirect
7475
github.com/lestrrat-go/httprc v1.0.6 // indirect
7576
github.com/lestrrat-go/iter v1.0.2 // indirect
7677
github.com/lestrrat-go/jwx/v2 v2.1.3 // indirect
7778
github.com/lestrrat-go/option v1.0.1 // indirect
78-
github.com/magiconair/properties v1.8.9 // indirect
7979
github.com/mailru/easyjson v0.9.0 // indirect
8080
github.com/mattn/go-colorable v0.1.14 // indirect
8181
github.com/mattn/go-isatty v0.0.20 // indirect
8282
github.com/mattn/go-runewidth v0.0.16 // indirect
83-
github.com/metal-stack/security v0.9.2 // indirect
83+
github.com/metal-stack/security v0.9.3 // indirect
8484
github.com/mitchellh/mapstructure v1.5.0 // indirect
8585
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
8686
github.com/modern-go/reflect2 v1.0.2 // indirect
@@ -96,47 +96,45 @@ require (
9696
github.com/prometheus/procfs v0.15.1 // indirect
9797
github.com/rivo/uniseg v0.4.7 // indirect
9898
github.com/sagikazarmark/locafero v0.7.0 // indirect
99-
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
10099
github.com/segmentio/asm v1.2.0 // indirect
101100
github.com/sourcegraph/conc v0.3.0 // indirect
102-
github.com/spf13/afero v1.12.0 // indirect
101+
github.com/spf13/afero v1.14.0 // indirect
103102
github.com/spf13/cast v1.7.1 // indirect
104-
github.com/spf13/cobra v1.8.1 // indirect
103+
github.com/spf13/cobra v1.9.1 // indirect
105104
github.com/spf13/pflag v1.0.6 // indirect
106-
github.com/spf13/viper v1.19.0 // indirect
105+
github.com/spf13/viper v1.20.0 // indirect
107106
github.com/stretchr/objx v0.5.2 // indirect
108107
github.com/subosito/gotenv v1.6.0 // indirect
109108
github.com/vincent-petithory/dataurl v1.0.0 // indirect
110109
go.mongodb.org/mongo-driver v1.17.2 // indirect
111110
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
112-
go.opentelemetry.io/otel v1.34.0 // indirect
113-
go.opentelemetry.io/otel/metric v1.34.0 // indirect
114-
go.opentelemetry.io/otel/trace v1.34.0 // indirect
111+
go.opentelemetry.io/otel v1.35.0 // indirect
112+
go.opentelemetry.io/otel/metric v1.35.0 // indirect
113+
go.opentelemetry.io/otel/trace v1.35.0 // indirect
114+
go.uber.org/automaxprocs v1.6.0 // indirect
115115
go.uber.org/multierr v1.11.0 // indirect
116116
go4.org v0.0.0-20230225012048-214862532bf5 // indirect
117-
golang.org/x/crypto v0.32.0 // indirect
118-
golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c // indirect
119-
golang.org/x/net v0.34.0 // indirect
120-
golang.org/x/oauth2 v0.26.0 // indirect
121-
golang.org/x/sync v0.11.0 // indirect
122-
golang.org/x/sys v0.30.0 // indirect
123-
golang.org/x/term v0.29.0 // indirect
124-
golang.org/x/text v0.22.0 // indirect
125-
golang.org/x/time v0.10.0 // indirect
126-
golang.org/x/tools v0.29.0 // indirect
127-
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
117+
golang.org/x/crypto v0.37.0 // indirect
118+
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect
119+
golang.org/x/net v0.39.0 // indirect
120+
golang.org/x/oauth2 v0.29.0 // indirect
121+
golang.org/x/sync v0.13.0 // indirect
122+
golang.org/x/sys v0.32.0 // indirect
123+
golang.org/x/term v0.31.0 // indirect
124+
golang.org/x/text v0.24.0 // indirect
125+
golang.org/x/time v0.11.0 // indirect
126+
golang.org/x/tools v0.32.0 // indirect
128127
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
129-
google.golang.org/protobuf v1.36.4 // indirect
128+
google.golang.org/protobuf v1.36.6 // indirect
130129
gopkg.in/inf.v0 v0.9.1 // indirect
131-
gopkg.in/ini.v1 v1.67.0 // indirect
132130
gopkg.in/yaml.v2 v2.4.0 // indirect
133131
gopkg.in/yaml.v3 v3.0.1 // indirect
134132
k8s.io/apiextensions-apiserver v0.29.0 // indirect
135133
k8s.io/component-base v0.29.0 // indirect
136134
k8s.io/klog/v2 v2.130.1 // indirect
137135
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
138136
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
139-
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
137+
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
140138
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
141139
sigs.k8s.io/yaml v1.4.0 // indirect
142140
)

0 commit comments

Comments
 (0)