Skip to content

Commit cc8798c

Browse files
Merge pull request #107 from leaseweb/feat/k8s-1-35-support
feat: K8s 1.35 Support
2 parents 64f764a + ba7061f commit cc8798c

File tree

11 files changed

+253
-227
lines changed

11 files changed

+253
-227
lines changed

.github/workflows/charts-lint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Set up Helm
1616
uses: azure/setup-helm@v4.3.1
1717
with:
18-
version: v3.18.6
18+
version: v3.19.4
1919

2020
- uses: actions/setup-python@v6
2121
with:

.github/workflows/pr-check.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
name: Test & Build
1212
runs-on: ubuntu-24.04
1313
steps:
14-
- name: Setup up Go 1.24
14+
- name: Setup up Go 1.25
1515
uses: actions/setup-go@v6
1616
with:
17-
go-version: "1.24"
17+
go-version: "1.25"
1818

1919
- name: Check out code
2020
uses: actions/checkout@v6

.golangci.yml

Lines changed: 72 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,83 @@
1-
linters-settings:
2-
gci:
3-
sections:
4-
- standard
5-
- default
6-
- prefix(github.com/apache/cloudstack-kubernetes-provider)
7-
gofumpt:
8-
module-path: "github.com/apache/cloudstack-kubernetes-provider"
9-
nolintlint:
10-
# https://github.com/golangci/golangci-lint/issues/3228
11-
allow-unused: true
12-
1+
version: "2"
2+
run:
3+
allow-parallel-runners: true
134
linters:
5+
default: all
146
disable:
15-
- goheader
7+
- cyclop
168
- depguard
17-
- mnd
18-
- varnamelen
19-
- testpackage
20-
- tagliatelle
21-
- paralleltest
22-
- ireturn
9+
- dupl
2310
- err113
24-
- gochecknoglobals
25-
- wsl
2611
- exhaustive
27-
- nosprintfhostport
28-
- nonamedreturns
29-
- interfacebloat
3012
- exhaustruct
31-
- lll
32-
- gomoddirectives
33-
- godox
34-
- gochecknoinits
3513
- funlen
36-
- dupl
37-
- cyclop
14+
- gochecknoglobals
15+
- gochecknoinits
16+
- godox
17+
- goheader
18+
- gomoddirectives
3819
- inamedparam
39-
# deprecated linters
40-
- tenv
41-
enable-all: true
42-
20+
- interfacebloat
21+
- ireturn
22+
- lll
23+
- mnd
24+
- nonamedreturns
25+
- nosprintfhostport
26+
- paralleltest
27+
- tagliatelle
28+
- testpackage
29+
- varnamelen
30+
- wsl
31+
# TODO: Following Lint issues need to be fixed:
32+
- embeddedstructfieldcheck
33+
- funcorder
34+
- wsl_v5
35+
- noinlineerr
36+
settings:
37+
nolintlint:
38+
allow-unused: true
39+
exclusions:
40+
generated: lax
41+
presets:
42+
- comments
43+
- common-false-positives
44+
- legacy
45+
- std-error-handling
46+
rules:
47+
- linters:
48+
- dupl
49+
- errcheck
50+
- forbidigo
51+
- gocognit
52+
- goconst
53+
- gocyclo
54+
- gosec
55+
- maintidx
56+
path: (.+)_test.go$
57+
paths:
58+
- third_party$
59+
- builtin$
60+
- examples$
4361
issues:
44-
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
4562
max-issues-per-linter: 0
46-
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
4763
max-same-issues: 0
48-
exclude-rules:
49-
- path: (.+)_test.go$
50-
linters:
51-
- gocognit
52-
- goconst
53-
- gocyclo
54-
- errcheck
55-
- dupl
56-
- gosec
57-
- forbidigo
58-
- maintidx
59-
60-
run:
61-
timeout: 10m
62-
allow-parallel-runners: true
63-
64+
formatters:
65+
enable:
66+
- gci
67+
- gofmt
68+
- gofumpt
69+
- goimports
70+
settings:
71+
gci:
72+
sections:
73+
- standard
74+
- default
75+
- prefix(github.com/apache/cloudstack-kubernetes-provider)
76+
gofumpt:
77+
module-path: github.com/apache/cloudstack-kubernetes-provider
78+
exclusions:
79+
generated: lax
80+
paths:
81+
- third_party$
82+
- builtin$
83+
- examples$

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
FROM golang:1.24 AS builder
18+
FROM golang:1.25 AS builder
1919
WORKDIR /app
2020
COPY . .
2121
RUN make clean && GOARCH=amd64 GOOS=linux CGO_ENABLED=0 make all

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ BIN_DIR ?= bin
4040
GO_INSTALL := ./hack/go_install.sh
4141

4242
GOLANGCI_LINT_BIN := golangci-lint
43-
GOLANGCI_LINT_VER := v1.64.8
43+
GOLANGCI_LINT_VER := v2.7.2
4444
GOLANGCI_LINT := $(abspath $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER))
45-
GOLANGCI_LINT_PKG := github.com/golangci/golangci-lint/cmd/golangci-lint
45+
GOLANGCI_LINT_PKG := github.com/golangci/golangci-lint/v2/cmd/golangci-lint
4646

4747
##@ Linting
4848
## --------------------------------------

cloudstack/cloudstack_loadbalancer.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,18 +1437,18 @@ func getLoadBalancerNetworkID(service *corev1.Service) string {
14371437

14381438
// setServiceAnnotation is used to create/set or update an annotation on the Service object.
14391439
func setServiceAnnotation(service *corev1.Service, key, value string) {
1440-
if service.ObjectMeta.Annotations == nil {
1441-
service.ObjectMeta.Annotations = map[string]string{}
1440+
if service.Annotations == nil {
1441+
service.Annotations = map[string]string{}
14421442
}
1443-
service.ObjectMeta.Annotations[key] = value
1443+
service.Annotations[key] = value
14441444
}
14451445

14461446
// deleteServiceAnnotation removes an annotation from the Service object.
14471447
func deleteServiceAnnotation(service *corev1.Service, key string) {
1448-
if service.ObjectMeta.Annotations == nil {
1448+
if service.Annotations == nil {
14491449
return
14501450
}
1451-
delete(service.ObjectMeta.Annotations, key)
1451+
delete(service.Annotations, key)
14521452
}
14531453

14541454
// deleteLoadBalancerAnnotations removes all CloudStack load balancer annotations from the service.

cloudstack/cloudstack_loadbalancer_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ func TestRulesMapToString(t *testing.T) {
733733
}
734734
for _, expectedRule := range expectedRules {
735735
found := false
736-
for _, part := range parts {
736+
for _, part := range parts { //nolint:modernize
737737
if part == expectedRule {
738738
found = true
739739

cloudstack/constants.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ const (
44
// ProviderName is the name of this cloud provider.
55
ProviderName = "cloudstack"
66

7-
// CloudStack protocol names.
8-
ProtoTCP = "tcp"
9-
ProtoUDP = "udp"
10-
ProtoICMP = "icmp"
7+
// ProtoTCP is the CloudStack protocol name for TCP.
8+
ProtoTCP = "tcp"
9+
// ProtoUDP is the CloudStack protocol name for UDP.
10+
ProtoUDP = "udp"
11+
// ProtoICMP is the CloudStack protocol name for ICMP.
12+
ProtoICMP = "icmp"
13+
// ProtoTCPProxy is the CloudStack protocol name for TCP proxy.
1114
ProtoTCPProxy = "tcp-proxy"
1215
)

cloudstack/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func sanitizeLabel(value string) string {
7474
}
7575

7676
// Sprintf255 behaves like fmt.Sprintf but limits the output to 255 characters.
77-
func Sprintf255(format string, a ...interface{}) string {
77+
func Sprintf255(format string, a ...any) string {
7878
result := fmt.Sprintf(format, a...)
7979
if len(result) > 255 {
8080
return result[:255]

0 commit comments

Comments
 (0)