Skip to content

Commit d17e1f4

Browse files
Merge pull request #68 from PDOK/jd/kubebuilder-4.10.1
Kubebuilder upgrade
2 parents 0d97bfb + 5427a01 commit d17e1f4

File tree

21 files changed

+466
-363
lines changed

21 files changed

+466
-363
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Kubebuilder DevContainer",
3-
"image": "docker.io/golang:1.24",
3+
"image": "docker.io/golang:1.25",
44
"features": {
55
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
66
"ghcr.io/devcontainers/features/git:1": {}

.devcontainer/post-install.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
#!/bin/bash
22
set -x
33

4-
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
4+
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-$(go env GOARCH)
55
chmod +x ./kind
66
mv ./kind /usr/local/bin/kind
77

8-
curl -L -o kubebuilder https://go.kubebuilder.io/dl/latest/linux/amd64
8+
curl -L -o kubebuilder https://go.kubebuilder.io/dl/latest/linux/$(go env GOARCH)
99
chmod +x kubebuilder
1010
mv kubebuilder /usr/local/bin/
1111

1212
KUBECTL_VERSION=$(curl -L -s https://dl.k8s.io/release/stable.txt)
13-
curl -LO "https://dl.k8s.io/release/$KUBECTL_VERSION/bin/linux/amd64/kubectl"
13+
curl -LO "https://dl.k8s.io/release/$KUBECTL_VERSION/bin/linux/$(go env GOARCH)/kubectl"
1414
chmod +x kubectl
1515
mv kubectl /usr/local/bin/kubectl
1616

.dockerignore

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
2-
# Ignore build and test binaries.
3-
bin/
2+
# Ignore everything by default and re-include only needed files
3+
**
4+
5+
# Re-include Go source files (but not *_test.go)
6+
!**/*.go
7+
**/*_test.go
8+
9+
# Re-include Go module files
10+
!go.mod
11+
!go.sum

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ jobs:
2020
go-version-file: go.mod
2121

2222
- name: Run linter
23-
uses: golangci/golangci-lint-action@v3
23+
uses: golangci/golangci-lint-action@v8
2424
with:
25-
version: v1.64.5
25+
version: v2.5.0

.github/workflows/test-e2e.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,13 @@ jobs:
2121

2222
- name: Install the latest version of kind
2323
run: |
24-
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
24+
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-$(go env GOARCH)
2525
chmod +x ./kind
2626
sudo mv ./kind /usr/local/bin/kind
2727
2828
- name: Verify kind installation
2929
run: kind version
3030

31-
- name: Create kind cluster
32-
run: kind create cluster
33-
3431
- name: Running Test e2e
3532
run: |
3633
go mod tidy

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,7 @@ go.work
2626
*.swo
2727
*~
2828

29+
# Kubeconfig might contain secrets
30+
*.kubeconfig
31+
2932
/certs

.golangci.bck.yml

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
run:
2+
# Timeout for analysis.
3+
timeout: 5m
4+
5+
# Modules download mode (do not modify go.mod)
6+
module-download-mode: readonly
7+
8+
# Include test files (see below to exclude certain linters)
9+
tests: true
10+
11+
issues:
12+
exclude-rules:
13+
# Exclude certain linters for test code
14+
- path: "_test\\.go"
15+
linters:
16+
- bodyclose
17+
- dupl
18+
- dogsled
19+
- funlen
20+
- gosec
21+
22+
output:
23+
formats:
24+
text:
25+
path: stdout
26+
colors: true
27+
print-issued-lines: true
28+
print-linter-name: true
29+
30+
linters-settings:
31+
depguard:
32+
rules:
33+
main:
34+
# Packages that are not allowed where the value is a suggestion.
35+
deny:
36+
- pkg: "github.com/pkg/errors"
37+
desc: Should be replaced by standard lib errors package
38+
cyclop:
39+
# The maximal code complexity to report.
40+
max-complexity: 15
41+
skip-tests: true
42+
funlen:
43+
lines: 100
44+
nestif:
45+
min-complexity: 6
46+
forbidigo:
47+
forbid:
48+
- http\.NotFound.* # return RFC 7807 problem details instead
49+
- http\.Error.* # return RFC 7807 problem details instead
50+
gomoddirectives:
51+
replace-allow-list:
52+
- github.com/abbot/go-http-auth # https://github.com/traefik/traefik/issues/6873#issuecomment-637654361
53+
54+
linters:
55+
default: none
56+
enable:
57+
# enabled by default by golangci-lint
58+
- errcheck # checking for unchecked errors, these unchecked errors can be critical bugs in some cases
59+
- govet # reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
60+
- ineffassign # detects when assignments to existing variables are not used
61+
- staticcheck # is a go vet on steroids, applying a ton of static analysis checks
62+
- typecheck # like the front-end of a Go compiler, parses and type-checks Go code
63+
- unused # checks for unused constants, variables, functions and types
64+
# extra enabled by us
65+
- asasalint # checks for pass []any as any in variadic func(...any)
66+
- asciicheck # checks that your code does not contain non-ASCII identifiers
67+
- bidichk # checks for dangerous unicode character sequences
68+
- bodyclose # checks whether HTTP response body is closed successfully
69+
- cyclop # checks function and package cyclomatic complexity
70+
- dupl # tool for code clone detection
71+
- durationcheck # checks for two durations multiplied together
72+
- dogsled # find assignments/declarations with too many blank identifiers
73+
- errname # checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error
74+
- errorlint # finds code that will cause problems with the error wrapping scheme introduced in Go 1.13
75+
- exhaustive # checks exhaustiveness of enum switch statements
76+
- exptostd # detects functions from golang.org/x/exp/ that can be replaced by std functions
77+
- copyloopvar # checks for pointers to enclosing loop variables
78+
- fatcontext # detects nested contexts in loops and function literals
79+
- forbidigo # forbids identifiers
80+
- funlen # tool for detection of long functions
81+
- gocheckcompilerdirectives # validates go compiler directive comments (//go:)
82+
- goconst # finds repeated strings that could be replaced by a constant
83+
- gocritic # provides diagnostics that check for bugs, performance and style issues
84+
- gomoddirectives # manages the use of 'replace', 'retract', and 'excludes' directives in go.mod
85+
- gomodguard # allow and block lists linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations
86+
- goprintffuncname # checks that printf-like functions are named with f at the end
87+
- gosec # inspects source code for security problems
88+
- loggercheck # checks key value pairs for common logger libraries (kitlog,klog,logr,zap)
89+
- makezero # finds slice declarations with non-zero initial length
90+
- mirror # reports wrong mirror patterns of bytes/strings usage
91+
- misspell # finds commonly misspelled English words
92+
- nakedret # finds naked returns in functions greater than a specified function length
93+
- nestif # reports deeply nested if statements
94+
- nilerr # finds the code that returns nil even if it checks that the error is not nil
95+
- nolintlint # reports ill-formed or insufficient nolint directives
96+
- nosprintfhostport # checks for misuse of Sprintf to construct a host with port in a URL
97+
- perfsprint # Golang linter for performance, aiming at usages of fmt.Sprintf which have faster alternatives
98+
- predeclared # finds code that shadows one of Go's predeclared identifiers
99+
- promlinter # checks Prometheus metrics naming via promlint
100+
- reassign # checks that package variables are not reassigned
101+
- revive # fast, configurable, extensible, flexible, and beautiful linter for Go, drop-in replacement of golint
102+
- rowserrcheck # checks whether Err of rows is checked successfully
103+
- sqlclosecheck # checks that sql.Rows and sql.Stmt are closed
104+
- sloglint # A Go linter that ensures consistent code style when using log/slog
105+
- tagliatelle # checks the struct tags.
106+
- testableexamples # checks if examples are testable (have an expected output)
107+
- tparallel # detects inappropriate usage of t.Parallel() method in your Go test codes
108+
- usetesting # detects using os.Setenv instead of t.Setenv since Go1.17
109+
- unconvert # removes unnecessary type conversions
110+
- unparam # reports unused function parameters
111+
- usestdlibvars # detects the possibility to use variables/constants from the Go standard library
112+
- wastedassign # finds wasted assignment statements
113+
114+
formatters:
115+
enable:
116+
- gofmt # checks if the code is formatted according to 'gofmt' command
117+
- goimports # in addition to fixing imports, goimports also formats your code in the same style as gofmt

0 commit comments

Comments
 (0)