Skip to content

Commit 4e4400e

Browse files
authored
Update go pkg (#547)
* Remove old github.com/golang/protobuf * Update golangci-lint * Update envtest * Update github.com/envoyproxy/go-control-plane and github.com/envoyproxy/go-control-plane/envoy * Update github.com/onsi/gomega and github.com/onsi/ginkgo * Update github.com/gophercloud/gophercloud/v2 and github.com/gophercloud/utils/v2 * Update github.com/shirou/gopsutil/v4 * Update k8s.io/* * Update golang.org/x/time * Update github.com/spf13/pflag * Update github.com/cncf/xds/go * Update go.uber.org/zap * Update gopkg.in/ini.v1 * Update github.com/prometheus/client_golang * Update google.golang.org/grpc * Update sigs.k8s.io/controller-runtime and sigs.k8s.io/controller-tools * Add toolchain go version
1 parent f9c412e commit 4e4400e

File tree

13 files changed

+426
-396
lines changed

13 files changed

+426
-396
lines changed

.golangci.yml

Lines changed: 128 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -1,159 +1,145 @@
1-
linters-settings:
2-
dupl:
3-
threshold: 100
4-
funlen:
5-
lines: 100
6-
statements: 50
7-
gocritic:
8-
enabled-tags:
9-
- diagnostic
10-
- experimental
11-
- opinionated
12-
- performance
13-
- style
14-
disabled-checks:
15-
- dupImport # https://github.com/go-critic/go-critic/issues/845
16-
- ifElseChain
17-
- octalLiteral
18-
- whyNoLint
19-
- wrapperFunc
20-
- hugeParam
21-
22-
gocyclo:
23-
min-complexity: 30
24-
mnd:
25-
# don't include the "operation" and "assign"
26-
checks: [argument, case, condition, return]
27-
28-
revive:
29-
enable-all-rules: false
30-
rules:
31-
# enable (taken from https://github.com/mgechev/revive/blob/master/defaults.toml)
32-
- name: blank-imports
33-
- name: context-as-argument
34-
- name: context-keys-type
35-
- name: dot-imports
36-
- name: empty-block
37-
- name: error-naming
38-
- name: error-return
39-
- name: error-strings
40-
- name: errorf
41-
- name: exported
42-
- name: increment-decrement
43-
- name: indent-error-flow
44-
- name: package-comments
45-
- name: range
46-
- name: receiver-naming
47-
- name: redefines-builtin-id
48-
- name: superfluous-else
49-
- name: time-naming
50-
- name: unexported-return
51-
- name: unreachable-code
52-
- name: unused-parameter
53-
- name: var-declaration
54-
- name: var-naming
55-
# tweaks
56-
- name: dot-imports
57-
exclude: [TEST]
58-
- name: unused-parameter
59-
exclude: [TEST]
60-
61-
govet:
62-
disable:
63-
- shadow
64-
lll:
65-
line-length: 140
66-
misspell:
67-
locale: US
68-
nolintlint:
69-
allow-unused: false # report any unused nolint directives
70-
require-explanation: true # require an explanation for nolint directives
71-
require-specific: true # require nolint directives to be specific about which linter is being skipped
72-
stylecheck:
73-
# ST1003 underscore in package names and var-naming
74-
checks: ["all", "-ST1003"]
75-
1+
version: "2"
2+
run:
3+
issues-exit-code: 1
4+
tests: true
765
linters:
77-
# please, do not use `enable-all`: it's deprecated and will be removed soon.
78-
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
79-
disable-all: true
6+
default: none
807
enable:
818
- bodyclose
829
- dogsled
10+
- dupl
8311
- gocritic
84-
- gofmt
85-
- goimports
12+
- gocyclo
8613
- goprintffuncname
87-
- gosimple
14+
- gosec
8815
- govet
8916
- ineffassign
9017
- lll
9118
- misspell
9219
- nakedret
20+
- nolintlint
21+
- revive
9322
- rowserrcheck
9423
- staticcheck
95-
- stylecheck
96-
- typecheck
9724
- unconvert
9825
- unparam
9926
- unused
10027
- whitespace
101-
- revive
102-
- dupl
103-
- gocyclo
104-
- gosec
105-
- nolintlint
106-
107-
# don't enable:
108-
# - noctx
109-
# - funlen # TODO reconcile functions are way too large
110-
# - prealloc
111-
# - exportloopref
112-
# - gomnd # magic number detected -> sometimes useful
113-
# - golint # is deprecated
114-
# - goerr113 # we have some dynamic errors
115-
# - exhaustive # missing switch case statements
116-
# - asciicheck
117-
# - depguard
118-
# - errcheck # Disabled since it detects defers that do not check errors. This is a standard pattern.
119-
# see https://github.com/kisielk/errcheck/issues/55
120-
# - scopelint
121-
# - gochecknoinits
122-
# - gochecknoglobals
123-
# - gocognit
124-
# - godot
125-
# - godox
126-
# - interfacer
127-
# - nestif
128-
# - testpackage
129-
# - wsl
130-
131-
issues:
132-
# Excluding configuration per-path, per-linter, per-text and per-source
133-
exclude-rules:
134-
- path: _test\.go
135-
linters:
136-
- gomnd
137-
- gochecknoglobals
138-
- gosec
139-
- noctx
140-
- goerr113
141-
- goconst
142-
- dupl
143-
- unparam
144-
145-
# https://github.com/go-critic/go-critic/issues/926
146-
- linters:
147-
- gocritic
148-
text: "unnecessaryDefer:"
149-
150-
- text: "should not use dot imports"
151-
path: _test\.go
152-
153-
exclude:
154-
- directive `// nolint.*` should be written without leading space
155-
156-
run:
157-
timeout: 15m
158-
issues-exit-code: 1
159-
tests: true
28+
settings:
29+
dupl:
30+
threshold: 100
31+
funlen:
32+
lines: 100
33+
statements: 50
34+
gocritic:
35+
disabled-checks:
36+
- dupImport
37+
- ifElseChain
38+
- octalLiteral
39+
- whyNoLint
40+
- wrapperFunc
41+
- hugeParam
42+
enabled-tags:
43+
- diagnostic
44+
- experimental
45+
- opinionated
46+
- performance
47+
- style
48+
gocyclo:
49+
min-complexity: 30
50+
govet:
51+
disable:
52+
- shadow
53+
lll:
54+
line-length: 140
55+
misspell:
56+
locale: US
57+
mnd:
58+
checks:
59+
- argument
60+
- case
61+
- condition
62+
- return
63+
nolintlint:
64+
require-explanation: true
65+
require-specific: true
66+
allow-unused: false
67+
revive:
68+
enable-all-rules: false
69+
rules:
70+
- name: blank-imports
71+
- name: context-as-argument
72+
- name: context-keys-type
73+
- name: dot-imports
74+
- name: empty-block
75+
- name: error-naming
76+
- name: error-return
77+
- name: error-strings
78+
- name: errorf
79+
- name: exported
80+
- name: increment-decrement
81+
- name: indent-error-flow
82+
- name: package-comments
83+
- name: range
84+
- name: receiver-naming
85+
- name: redefines-builtin-id
86+
- name: superfluous-else
87+
- name: time-naming
88+
- name: unexported-return
89+
- name: unreachable-code
90+
- name: unused-parameter
91+
- name: var-declaration
92+
- name: dot-imports
93+
exclude:
94+
- TEST
95+
- name: unused-parameter
96+
exclude:
97+
- TEST
98+
staticcheck:
99+
checks:
100+
- all
101+
- -ST1003
102+
- -QF1008
103+
exclusions:
104+
generated: lax
105+
presets:
106+
- comments
107+
- common-false-positives
108+
- legacy
109+
- std-error-handling
110+
rules:
111+
- linters:
112+
- dupl
113+
- err113
114+
- gochecknoglobals
115+
- goconst
116+
- gosec
117+
- mnd
118+
- noctx
119+
- unparam
120+
path: _test\.go
121+
- linters:
122+
- gocritic
123+
text: 'unnecessaryDefer:'
124+
- path: _test\.go
125+
text: should not use dot imports
126+
- path: (.+)\.go$
127+
text: directive `// nolint.*` should be written without leading space
128+
# TODO: GetEventRecorderFor is deprecated
129+
- linters:
130+
- staticcheck
131+
text: "GetEventRecorderFor is deprecated"
132+
paths:
133+
- third_party$
134+
- builtin$
135+
- examples$
136+
formatters:
137+
enable:
138+
- gofmt
139+
- goimports
140+
exclusions:
141+
generated: lax
142+
paths:
143+
- third_party$
144+
- builtin$
145+
- examples$

Earthfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
VERSION 0.8
2-
FROM golang:1.23
2+
FROM golang:1.25
33
ARG --global DOCKER_REPO=ghcr.io/stackitcloud/yawol/
44
ARG --global BINPATH=/usr/local/bin/
55
ARG --global GOCACHE=/go-cache
66

77
ARG --global ENVOY_VERSION=v1.27.0
88
ARG --global HELM_VERSION=3.12.3
9-
ARG --global GOLANGCI_LINT_VERSION=v1.61.0
9+
ARG --global GOLANGCI_LINT_VERSION=v2.10.1
1010
ARG --global PACKER_VERSION=1.9
1111
ARG --global TERRAFORM_VERSION=1.4.6
1212

@@ -261,7 +261,7 @@ lint:
261261

262262
test:
263263
FROM +deps
264-
ARG KUBERNETES_VERSION=1.26.x
264+
ARG KUBERNETES_VERSION=1.35.x
265265
COPY +gotools/bin/setup-envtest $BINPATH
266266
COPY +envoy/envoy $BINPATH
267267
# install envtest in its own layer
@@ -276,9 +276,9 @@ test:
276276
eval "$GO_TEST ./..."
277277

278278
test-multiple-k8s-versions:
279-
BUILD +test --KUBERNETES_VERSION=1.25.x
280-
BUILD +test --KUBERNETES_VERSION=1.26.x
281-
BUILD +test --KUBERNETES_VERSION=1.27.x
279+
BUILD +test --KUBERNETES_VERSION=1.33.x
280+
BUILD +test --KUBERNETES_VERSION=1.34.x
281+
BUILD +test --KUBERNETES_VERSION=1.35.x
282282

283283
list-available-k8s-envtest-versions:
284284
FROM +deps

api/v1beta1/loadbalancer_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const (
3434
// ServiceDebugSSHKey set an sshkey
3535
ServiceDebugSSHKey = "yawol.stackit.cloud/debugsshkey"
3636
// ServiceClassName for filtering services in cloud-controller
37+
//
3738
// Deprecated: use .spec.loadBalancerClass instead
3839
ServiceClassName = "yawol.stackit.cloud/className"
3940
// ServiceReplicas for setting loadbalancer replicas in cloud-controller

controllers/yawol-cloud-controller/controlcontroller/loadbalancer_controller.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"fmt"
66
"reflect"
77
"strings"
8+
"time"
89

910
"github.com/go-logr/logr"
1011
yawolv1beta1 "github.com/stackitcloud/yawol/api/v1beta1"
@@ -68,7 +69,7 @@ func (r *LoadBalancerReconciler) Reconcile(ctx context.Context, req ctrl.Request
6869
v1.EventTypeNormal,
6970
"creation",
7071
fmt.Sprintf("LoadBalancer is successfully created with IP %v", *lb.Status.ExternalIP))
71-
return ctrl.Result{Requeue: true}, nil
72+
return ctrl.Result{RequeueAfter: 1 * time.Second}, nil
7273
}
7374
}
7475

controllers/yawol-cloud-controller/targetcontroller/service_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ func (r *ServiceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
113113
}
114114
r.Recorder.Event(svc, coreV1.EventTypeNormal, "creation", "LoadBalancer is in creation")
115115

116-
return ctrl.Result{Requeue: true}, nil
116+
return ctrl.Result{RequeueAfter: 1 * time.Second}, nil
117117
}
118118

119119
if loadBalancer.ObjectMeta.Annotations[ServiceAnnotation] != svc.Namespace+"/"+svc.Name {
120120
if err := r.addAnnotation(ctx, loadBalancer, ServiceAnnotation, svc.Namespace+"/"+svc.Name); err != nil {
121121
return ctrl.Result{}, err
122122
}
123-
return ctrl.Result{Requeue: true}, err
123+
return ctrl.Result{RequeueAfter: 1 * time.Second}, err
124124
}
125125

126126
// if port specs differ, patch svc => lb

controllers/yawol-cloud-controller/targetcontroller/service_controller_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ var _ = Describe("Check loadbalancer reconcile", Serial, Ordered, func() {
525525
Name: "class-name-service-test1",
526526
Namespace: "default",
527527
Annotations: map[string]string{
528+
// nolint: staticcheck // this tests the deprecated feature
528529
yawolv1beta1.ServiceClassName: "foo",
529530
},
530531
},
@@ -559,6 +560,7 @@ var _ = Describe("Check loadbalancer reconcile", Serial, Ordered, func() {
559560
Name: "class-name-service-test2",
560561
Namespace: "default",
561562
Annotations: map[string]string{
563+
// nolint: staticcheck // this tests the deprecated feature
562564
yawolv1beta1.ServiceClassName: "",
563565
},
564566
},
@@ -1108,7 +1110,7 @@ var _ = Describe("Check loadbalancer reconcile", Serial, Ordered, func() {
11081110
},
11091111
Spec: v1.ServiceSpec{
11101112
IPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
1111-
IPFamilyPolicy: (*v1.IPFamilyPolicyType)(ptr.To(string(v1.IPFamilyPolicyRequireDualStack))),
1113+
IPFamilyPolicy: (*v1.IPFamilyPolicy)(ptr.To(string(v1.IPFamilyPolicyRequireDualStack))),
11121114
Ports: []v1.ServicePort{
11131115
{
11141116
Name: "port1",

0 commit comments

Comments
 (0)