Skip to content

Commit 05f6a73

Browse files
author
Jelle Dijkstra
committed
(chore) initial scaffold from release version: v4.6.0
1 parent 4195e4a commit 05f6a73

File tree

17 files changed

+220
-202
lines changed

17 files changed

+220
-202
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.23",
3+
"image": "golang:1.24",
44
"features": {
55
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
66
"ghcr.io/devcontainers/features/git:1": {}

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ jobs:
1818
go-version-file: go.mod
1919

2020
- name: Run linter
21-
uses: golangci/golangci-lint-action@v6
21+
uses: golangci/golangci-lint-action@v8
2222
with:
23-
version: v1.63.4
23+
version: v2.1.0

.github/workflows/test-e2e.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ jobs:
2626
- name: Verify kind installation
2727
run: kind version
2828

29-
- name: Create kind cluster
30-
run: kind create cluster
31-
3229
- name: Running Test e2e
3330
run: |
3431
go mod tidy

.golangci.yml

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,15 @@
1+
version: "2"
12
run:
2-
timeout: 5m
33
allow-parallel-runners: true
4-
5-
issues:
6-
# don't skip warning about doc comments
7-
# don't exclude the default set of lint
8-
exclude-use-default: false
9-
# restore some of the defaults
10-
# (fill in the rest as needed)
11-
exclude-rules:
12-
- path: "api/*"
13-
linters:
14-
- lll
15-
- path: "internal/*"
16-
linters:
17-
- dupl
18-
- lll
194
linters:
20-
disable-all: true
5+
default: none
216
enable:
7+
- copyloopvar
228
- dupl
239
- errcheck
24-
- copyloopvar
2510
- ginkgolinter
2611
- goconst
2712
- gocyclo
28-
- gofmt
29-
- goimports
30-
- gosimple
3113
- govet
3214
- ineffassign
3315
- lll
@@ -36,12 +18,35 @@ linters:
3618
- prealloc
3719
- revive
3820
- staticcheck
39-
- typecheck
4021
- unconvert
4122
- unparam
4223
- unused
43-
44-
linters-settings:
45-
revive:
24+
settings:
25+
revive:
26+
rules:
27+
- name: comment-spacings
28+
- name: import-shadowing
29+
exclusions:
30+
generated: lax
4631
rules:
47-
- name: comment-spacings
32+
- linters:
33+
- lll
34+
path: api/*
35+
- linters:
36+
- dupl
37+
- lll
38+
path: internal/*
39+
paths:
40+
- third_party$
41+
- builtin$
42+
- examples$
43+
formatters:
44+
enable:
45+
- gofmt
46+
- goimports
47+
exclusions:
48+
generated: lax
49+
paths:
50+
- third_party$
51+
- builtin$
52+
- examples$

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the manager binary
2-
FROM docker.io/golang:1.23 AS builder
2+
FROM golang:1.24 AS builder
33
ARG TARGETOS
44
ARG TARGETARCH
55

Makefile

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,24 @@ test: manifests generate fmt vet setup-envtest ## Run tests.
6565
# The default setup assumes Kind is pre-installed and builds/loads the Manager Docker image locally.
6666
# CertManager is installed by default; skip with:
6767
# - CERT_MANAGER_INSTALL_SKIP=true
68-
.PHONY: test-e2e
69-
test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.
70-
@command -v kind >/dev/null 2>&1 || { \
68+
KIND_CLUSTER ?= atom-operator-v3-test-e2e
69+
70+
.PHONY: setup-test-e2e
71+
setup-test-e2e: ## Set up a Kind cluster for e2e tests if it does not exist
72+
@command -v $(KIND) >/dev/null 2>&1 || { \
7173
echo "Kind is not installed. Please install Kind manually."; \
7274
exit 1; \
7375
}
74-
@kind get clusters | grep -q 'kind' || { \
75-
echo "No Kind cluster is running. Please start a Kind cluster before running the e2e tests."; \
76-
exit 1; \
77-
}
78-
go test ./test/e2e/ -v -ginkgo.v
76+
$(KIND) create cluster --name $(KIND_CLUSTER)
77+
78+
.PHONY: test-e2e
79+
test-e2e: setup-test-e2e manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.
80+
KIND_CLUSTER=$(KIND_CLUSTER) go test ./test/e2e/ -v -ginkgo.v
81+
$(MAKE) cleanup-test-e2e
82+
83+
.PHONY: cleanup-test-e2e
84+
cleanup-test-e2e: ## Tear down the Kind cluster used for e2e tests
85+
@$(KIND) delete cluster --name $(KIND_CLUSTER)
7986

8087
.PHONY: lint
8188
lint: golangci-lint ## Run golangci-lint linter
@@ -165,19 +172,20 @@ $(LOCALBIN):
165172

166173
## Tool Binaries
167174
KUBECTL ?= kubectl
175+
KIND ?= kind
168176
KUSTOMIZE ?= $(LOCALBIN)/kustomize
169177
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
170178
ENVTEST ?= $(LOCALBIN)/setup-envtest
171179
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
172180

173181
## Tool Versions
174-
KUSTOMIZE_VERSION ?= v5.5.0
175-
CONTROLLER_TOOLS_VERSION ?= v0.17.2
182+
KUSTOMIZE_VERSION ?= v5.6.0
183+
CONTROLLER_TOOLS_VERSION ?= v0.18.0
176184
#ENVTEST_VERSION is the version of controller-runtime release branch to fetch the envtest setup script (i.e. release-0.20)
177185
ENVTEST_VERSION ?= $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller-runtime | awk -F'[v.]' '{printf "release-%d.%d", $$2, $$3}')
178186
#ENVTEST_K8S_VERSION is the version of Kubernetes to use for setting up ENVTEST binaries (i.e. 1.31)
179187
ENVTEST_K8S_VERSION ?= $(shell go list -m -f "{{ .Version }}" k8s.io/api | awk -F'[v.]' '{printf "1.%d", $$3}')
180-
GOLANGCI_LINT_VERSION ?= v1.63.4
188+
GOLANGCI_LINT_VERSION ?= v2.1.0
181189

182190
.PHONY: kustomize
183191
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
@@ -205,7 +213,7 @@ $(ENVTEST): $(LOCALBIN)
205213
.PHONY: golangci-lint
206214
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
207215
$(GOLANGCI_LINT): $(LOCALBIN)
208-
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
216+
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
209217

210218
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
211219
# $1 - target path with name of binary

PROJECT

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# This file is used to track the info used to scaffold your project
33
# and allow the plugins properly work.
44
# More info: https://book.kubebuilder.io/reference/project-config.html
5+
cliVersion: 4.6.0
56
domain: pdok.nl
67
layout:
78
- go.kubebuilder.io/v4

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
## Getting Started
88

99
### Prerequisites
10-
- go version v1.23.0+
10+
- go version v1.24.0+
1111
- docker version 17.03+.
1212
- kubectl version v1.11.3+.
1313
- Access to a Kubernetes v1.11.3+ cluster.

cmd/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import (
4040
pdoknlv2beta1 "github.com/pdok/atom-operator/api/v2beta1"
4141
pdoknlv3 "github.com/pdok/atom-operator/api/v3"
4242
"github.com/pdok/atom-operator/internal/controller"
43-
webhookpdoknlv3 "github.com/pdok/atom-operator/internal/webhook/v3"
43+
webhookv3 "github.com/pdok/atom-operator/internal/webhook/v3"
4444
// +kubebuilder:scaffold:imports
4545
)
4646

@@ -138,7 +138,7 @@ func main() {
138138

139139
// Metrics endpoint is enabled in 'config/default/kustomization.yaml'. The Metrics options configure the server.
140140
// More info:
141-
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.20.2/pkg/metrics/server
141+
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.21.0/pkg/metrics/server
142142
// - https://book.kubebuilder.io/reference/metrics.html
143143
metricsServerOptions := metricsserver.Options{
144144
BindAddress: metricsAddr,
@@ -150,7 +150,7 @@ func main() {
150150
// FilterProvider is used to protect the metrics endpoint with authn/authz.
151151
// These configurations ensure that only authorized users and service accounts
152152
// can access the metrics endpoint. The RBAC are configured in 'config/rbac/kustomization.yaml'. More info:
153-
// https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.20.2/pkg/metrics/filters#WithAuthenticationAndAuthorization
153+
// https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.21.0/pkg/metrics/filters#WithAuthenticationAndAuthorization
154154
metricsServerOptions.FilterProvider = filters.WithAuthenticationAndAuthorization
155155
}
156156

@@ -205,7 +205,7 @@ func main() {
205205
os.Exit(1)
206206
}
207207

208-
if err = (&controller.AtomReconciler{
208+
if err := (&controller.AtomReconciler{
209209
Client: mgr.GetClient(),
210210
Scheme: mgr.GetScheme(),
211211
}).SetupWithManager(mgr); err != nil {
@@ -214,7 +214,7 @@ func main() {
214214
}
215215
// nolint:goconst
216216
if os.Getenv("ENABLE_WEBHOOKS") != "false" {
217-
if err = webhookpdoknlv3.SetupAtomWebhookWithManager(mgr); err != nil {
217+
if err := webhookv3.SetupAtomWebhookWithManager(mgr); err != nil {
218218
setupLog.Error(err, "unable to create webhook", "webhook", "Atom")
219219
os.Exit(1)
220220
}

config/crd/bases/pdok.nl_atoms.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.17.2
6+
controller-gen.kubebuilder.io/version: v0.18.0
77
name: atoms.pdok.nl
88
spec:
99
group: pdok.nl

0 commit comments

Comments
 (0)