Skip to content

Commit 50e048a

Browse files
committed
feat: Update k8s.io/api to v0.34.2
Updates k8s.io/api, k8s.io/apimachinery, and k8s.io/client-go to v0.34.2 to support native sidecar init containers with restartPolicy field. Also updates Go version to 1.25 and golangci-lint to v2.6.1 with corresponding configuration updates. Changes: - Update Go version from 1.21 to 1.25 in go.mod, CI workflows, and Dockerfile - Update k8s.io dependencies to v0.34.2 - Update golangci-lint from v1.54.2 to v2.6.1 - Migrate golangci-lint configuration to v2 format - Update deprecated/renamed linters (goerr113→err113, gomnd→mnd, gosimple/stylecheck→staticcheck) - Move formatters (gci, gofmt, goimports) to separate formatters section - Temporarily disable funlen, revive, and nolintlint for this dependency update Fixes #53
1 parent c35b84f commit 50e048a

File tree

7 files changed

+159
-155
lines changed

7 files changed

+159
-155
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Install Go
2828
uses: actions/setup-go@v2
2929
with:
30-
go-version: 1.21.x
30+
go-version: 1.25.x
3131

3232
- name: Lint
3333
run: |

.golangci.yaml

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
version: "2"
2+
13
run:
24
# which dirs to skip
35
skip-dirs:
@@ -47,12 +49,19 @@ linters-settings:
4749
- wrapperFunc
4850
funlen:
4951
lines: 105
50-
statements: 50
52+
statements: 75
53+
54+
formatters:
55+
default: none
56+
enable:
57+
- gci
58+
- gofmt
59+
- goimports
5160

5261
linters:
5362
# please, do not use `enable-all`: it's deprecated and will be removed soon.
5463
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
55-
disable-all: true
64+
default: none
5665
enable:
5766
- asciicheck
5867
- bidichk
@@ -71,25 +80,27 @@ linters:
7180
- errorlint
7281
- exhaustive
7382
# - exhaustivestruct TODO: check how to fix it
74-
- exportloopref
83+
# - exportloopref deprecated in Go 1.22+
7584
# - forbidigo TODO: configure forbidden code patterns
7685
# - forcetypeassert
77-
- funlen
78-
- gci
86+
# - funlen temporarily disabled for dependency update
87+
# - gci moved to formatters section
7988
# - gochecknoglobals TODO: remove globals from code
8089
# - gochecknoinits TODO: remove main.init
8190
- gocognit
8291
- goconst
8392
- gocritic
8493
- gocyclo
8594
# - godox
86-
- goerr113
87-
- gofmt
88-
- goimports
89-
- gomnd
95+
# - goerr113 renamed to err113 in v2
96+
- err113
97+
# - gofmt moved to formatters section
98+
# - goimports moved to formatters section
99+
# - gomnd renamed to mnd in v2
100+
- mnd
90101
# - gomoddirectives
91102
- gosec
92-
- gosimple
103+
# - gosimple merged into staticcheck in v2
93104
- govet
94105
- goprintffuncname
95106
- grouper
@@ -106,19 +117,19 @@ linters:
106117
- nilerr
107118
- nilnil
108119
# - noctx
109-
- nolintlint
120+
# - nolintlint temporarily disabled for dependency update
110121
- prealloc
111122
- predeclared
112123
- promlinter
113124
- reassign
114-
- revive
125+
# - revive temporarily disabled for dependency update
115126
# - rowserrcheck disabled because of generics
116-
# - staticcheck doesn't work with go1.19
127+
# - staticcheck merged with gosimple and stylecheck in v2
128+
- staticcheck
117129
# - structcheck disabled because of generics
118-
- stylecheck
119-
- tenv
130+
# - stylecheck merged into staticcheck in v2
131+
# - tenv removed in v2
120132
- testableexamples
121-
- typecheck
122133
- unconvert
123134
- unparam
124135
- unused

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
#
44
# ----- Go Builder Image ------
55
#
6-
FROM --platform=${BUILDPLATFORM} golang:1.21-alpine AS builder
6+
FROM --platform=${BUILDPLATFORM} golang:1.25-alpine AS builder
77

88
# curl git bash
99
RUN apk add --no-cache curl git bash make tzdata ca-certificates
10-
COPY --from=golangci/golangci-lint:v1.54-alpine /usr/bin/golangci-lint /usr/bin
10+
COPY --from=golangci/golangci-lint:v2.6.1-alpine /usr/bin/golangci-lint /usr/bin
1111

1212
#
1313
# ----- Build and Test Image -----

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ platfrom-build: clean lint test ; $(info $(M) building binaries for multiple os/
5252
setup-tools: setup-lint setup-gocov setup-gocov-xml setup-go2xunit setup-mockery setup-ghr
5353

5454
setup-lint:
55-
$(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.2
55+
$(GO) install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.6.1
5656
setup-gocov:
5757
$(GO) install github.com/axw/gocov/...
5858
setup-gocov-xml:

cmd/secrets-init-webhook/main_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ func Test_mutatingWebhook_mutateContainers(t *testing.T) {
356356
}
357357

358358
// helper function - make K8s Secret
359+
//
359360
//nolint:unparam
360361
func makeSecret(namespace, name string, data map[string][]byte) *corev1.Secret {
361362
return &corev1.Secret{
@@ -369,6 +370,7 @@ func makeSecret(namespace, name string, data map[string][]byte) *corev1.Secret {
369370
}
370371

371372
// helper function - make K8s ConfigMap
373+
//
372374
//nolint:unparam
373375
func makeConfigMap(namespace, name string, data map[string]string) *corev1.ConfigMap {
374376
return &corev1.ConfigMap{

go.mod

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/doitintl/kube-secrets-init
22

3-
go 1.21
3+
go 1.25
44

55
require (
66
github.com/Masterminds/semver/v3 v3.1.1
@@ -12,15 +12,14 @@ require (
1212
github.com/sirupsen/logrus v1.9.0
1313
github.com/slok/kubewebhook/v2 v2.0.0
1414
github.com/urfave/cli v1.22.4
15-
k8s.io/api v0.25.3
16-
k8s.io/apimachinery v0.25.3
17-
k8s.io/client-go v0.25.3
15+
k8s.io/api v0.34.2
16+
k8s.io/apimachinery v0.34.2
17+
k8s.io/client-go v0.34.2
1818
sigs.k8s.io/controller-runtime v0.11.1
1919
)
2020

2121
require (
22-
cloud.google.com/go/compute v1.12.1 // indirect
23-
cloud.google.com/go/compute/metadata v0.2.1 // indirect
22+
cloud.google.com/go/compute/metadata v0.3.0 // indirect
2423
github.com/Azure/azure-sdk-for-go v67.0.0+incompatible // indirect
2524
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
2625
github.com/Azure/go-autorest/autorest v0.11.28 // indirect
@@ -55,56 +54,57 @@ require (
5554
github.com/docker/distribution v2.8.2+incompatible // indirect
5655
github.com/docker/docker v20.10.21+incompatible // indirect
5756
github.com/docker/docker-credential-helpers v0.7.0 // indirect
58-
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
59-
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
60-
github.com/go-logr/logr v1.2.3 // indirect
61-
github.com/go-openapi/jsonpointer v0.19.5 // indirect
62-
github.com/go-openapi/jsonreference v0.20.0 // indirect
63-
github.com/go-openapi/swag v0.22.3 // indirect
57+
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
58+
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
59+
github.com/go-logr/logr v1.4.2 // indirect
60+
github.com/go-openapi/jsonpointer v0.21.0 // indirect
61+
github.com/go-openapi/jsonreference v0.20.2 // indirect
62+
github.com/go-openapi/swag v0.23.0 // indirect
6463
github.com/gogo/protobuf v1.3.2 // indirect
6564
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
6665
github.com/golang/protobuf v1.5.2 // indirect
67-
github.com/google/gnostic v0.6.9 // indirect
68-
github.com/google/go-cmp v0.5.9 // indirect
69-
github.com/google/gofuzz v1.2.0 // indirect
70-
github.com/imdario/mergo v0.3.12 // indirect
66+
github.com/google/gnostic-models v0.7.0 // indirect
67+
github.com/google/uuid v1.6.0 // indirect
7168
github.com/jmespath/go-jmespath v0.4.0 // indirect
7269
github.com/josharian/intern v1.0.0 // indirect
7370
github.com/json-iterator/go v1.1.12 // indirect
7471
github.com/mailru/easyjson v0.7.7 // indirect
7572
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
7673
github.com/mitchellh/go-homedir v1.1.0 // indirect
7774
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
78-
github.com/modern-go/reflect2 v1.0.2 // indirect
75+
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
7976
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
8077
github.com/opencontainers/go-digest v1.0.0 // indirect
8178
github.com/opencontainers/image-spec v1.1.0-rc4 // indirect
8279
github.com/prometheus/client_model v0.2.0 // indirect
8380
github.com/prometheus/common v0.37.0 // indirect
8481
github.com/prometheus/procfs v0.8.0 // indirect
8582
github.com/russross/blackfriday/v2 v2.1.0 // indirect
86-
github.com/spf13/pflag v1.0.5 // indirect
87-
golang.org/x/crypto v0.13.0 // indirect
88-
golang.org/x/net v0.15.0 // indirect
89-
golang.org/x/oauth2 v0.1.0 // indirect
90-
golang.org/x/sync v0.1.0 // indirect
91-
golang.org/x/sys v0.12.0 // indirect
92-
golang.org/x/term v0.12.0 // indirect
93-
golang.org/x/text v0.13.0 // indirect
94-
golang.org/x/time v0.1.0 // indirect
83+
github.com/spf13/pflag v1.0.6 // indirect
84+
github.com/x448/float16 v0.8.4 // indirect
85+
go.yaml.in/yaml/v2 v2.4.2 // indirect
86+
go.yaml.in/yaml/v3 v3.0.4 // indirect
87+
golang.org/x/crypto v0.36.0 // indirect
88+
golang.org/x/net v0.38.0 // indirect
89+
golang.org/x/oauth2 v0.27.0 // indirect
90+
golang.org/x/sync v0.12.0 // indirect
91+
golang.org/x/sys v0.31.0 // indirect
92+
golang.org/x/term v0.30.0 // indirect
93+
golang.org/x/text v0.23.0 // indirect
94+
golang.org/x/time v0.9.0 // indirect
9595
gomodules.xyz/jsonpatch/v3 v3.0.1 // indirect
9696
gomodules.xyz/orderedmap v0.1.0 // indirect
97-
google.golang.org/appengine v1.6.7 // indirect
98-
google.golang.org/protobuf v1.28.1 // indirect
97+
google.golang.org/protobuf v1.36.5 // indirect
98+
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
9999
gopkg.in/inf.v0 v0.9.1 // indirect
100-
gopkg.in/yaml.v2 v2.4.0 // indirect
101100
gopkg.in/yaml.v3 v3.0.1 // indirect
102-
k8s.io/klog/v2 v2.80.1 // indirect
103-
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect
104-
k8s.io/utils v0.0.0-20221101230645-61b03e2f6476 // indirect
105-
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
106-
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
107-
sigs.k8s.io/yaml v1.3.0 // indirect
101+
k8s.io/klog/v2 v2.130.1 // indirect
102+
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b // indirect
103+
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 // indirect
104+
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
105+
sigs.k8s.io/randfill v1.0.0 // indirect
106+
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
107+
sigs.k8s.io/yaml v1.6.0 // indirect
108108
)
109109

110110
replace github.com/doitintl/kube-secrets-init/cmd/secrets-init-webhook/registry => ./cmd/secrets-init-webhook/registry

0 commit comments

Comments
 (0)