Skip to content

Commit d65665c

Browse files
author
Jelle Dijkstra
committed
Upgraded scaffolding to 4.10.1
2 parents 6dcd3b0 + b218c63 commit d65665c

File tree

246 files changed

+33821
-1397
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

246 files changed

+33821
-1397
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": "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": {}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
name: Build
3+
env:
4+
image: pdok/mapserver-operator
5+
on:
6+
push:
7+
tags:
8+
- '*'
9+
jobs:
10+
docker:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Docker meta
14+
id: docker_meta
15+
uses: docker/metadata-action@v3
16+
with:
17+
images: ${{ env.image }}
18+
tags: |
19+
type=semver,pattern={{major}}
20+
type=semver,pattern={{major}}.{{minor}}
21+
type=semver,pattern={{version}}
22+
- name: Login to PDOK Docker Hub
23+
if: startsWith(env.image, 'pdok/')
24+
uses: docker/login-action@v1
25+
with:
26+
username: koalapdok
27+
password: ${{ secrets.DOCKERHUB_PUSH }}
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v1
30+
- name: Cache Docker layers
31+
uses: actions/cache@v4
32+
with:
33+
path: /tmp/.buildx-cache
34+
key: ${{ runner.os }}-buildx-${{ github.sha }}
35+
restore-keys: |
36+
${{ runner.os }}-buildx-
37+
- name: Build and push
38+
id: docker_build
39+
uses: docker/build-push-action@v2
40+
with:
41+
push: true
42+
tags: ${{ steps.docker_meta.outputs.tags }}
43+
labels: ${{ steps.docker_meta.outputs.labels }}
44+
cache-from: type=local,src=/tmp/.buildx-cache
45+
cache-to: type=local,dest=/tmp/.buildx-cache-new
46+
- # Temp fix to cleanup cache
47+
# https://github.com/docker/build-push-action/issues/252
48+
# https://github.com/moby/buildkit/issues/1896
49+
name: Move cache
50+
run: |
51+
rm -rf /tmp/.buildx-cache
52+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
53+
- name: Build result notification
54+
if: success() || failure()
55+
uses: 8398a7/action-slack@v3
56+
with:
57+
fields: all
58+
status: custom
59+
custom_payload: |
60+
{
61+
attachments: [{
62+
color: '${{ job.status }}' === 'success' ? 'good' : '${{ job.status }}' === 'failure' ? 'danger' : 'warning',
63+
text: `${process.env.AS_WORKFLOW} ${{ job.status }} for ${process.env.AS_REPO}!\n${process.env.AS_JOB} job on ${process.env.AS_REF} (commit: ${process.env.AS_COMMIT}, version: ${{ steps.docker_meta.outputs.version }}) by ${process.env.AS_AUTHOR} took ${process.env.AS_TOOK}`,
64+
}]
65+
}
66+
env:
67+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

.github/workflows/lint.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ name: Lint
22

33
on:
44
push:
5+
branches:
6+
- master
57
pull_request:
68

79
jobs:
810
lint:
9-
name: Run on Ubuntu
11+
name: Linting on Ubuntu
1012
runs-on: ubuntu-latest
1113
steps:
1214
- name: Clone the code

.github/workflows/test-e2e.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ name: E2E Tests
22

33
on:
44
push:
5+
branches:
6+
- master
57
pull_request:
68

79
jobs:
810
test-e2e:
9-
name: Run on Ubuntu
11+
name: End-2-End on Ubuntu
1012
runs-on: ubuntu-latest
1113
steps:
1214
- name: Clone the code

.github/workflows/test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ name: Tests
22

33
on:
44
push:
5+
branches:
6+
- master
57
pull_request:
68

79
jobs:
810
test:
9-
name: Run on Ubuntu
11+
name: Testing on Ubuntu
1012
runs-on: ubuntu-latest
1113
steps:
1214
- name: Clone the code

.golangci.bck.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
run:
3+
# Timeout for analysis.
4+
timeout: 5m
5+
6+
# Modules download mode (do not modify go.mod)
7+
modules-download-mode: readonly
8+
9+
# Include test files (see below to exclude certain linters)
10+
tests: true
11+
12+
issues:
13+
exclude-rules:
14+
# Exclude certain linters for test code
15+
- path: "_test\\.go"
16+
linters:
17+
- bodyclose
18+
- dupl
19+
- dogsled
20+
- funlen
21+
- gosec
22+
23+
output:
24+
formats:
25+
- format: colored-line-number
26+
path: stdout
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+
disable-all: true
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+
- gosimple # specializes in simplifying a code
60+
- govet # reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
61+
- ineffassign # detects when assignments to existing variables are not used
62+
- staticcheck # is a go vet on steroids, applying a ton of static analysis checks
63+
- typecheck # like the front-end of a Go compiler, parses and type-checks Go code
64+
- unused # checks for unused constants, variables, functions and types
65+
# extra enabled by us
66+
- asasalint # checks for pass []any as any in variadic func(...any)
67+
- asciicheck # checks that your code does not contain non-ASCII identifiers
68+
- bidichk # checks for dangerous unicode character sequences
69+
- bodyclose # checks whether HTTP response body is closed successfully
70+
- cyclop # checks function and package cyclomatic complexity
71+
- dupl # tool for code clone detection
72+
- durationcheck # checks for two durations multiplied together
73+
- dogsled # find assignments/declarations with too many blank identifiers
74+
- errname # checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error
75+
- errorlint # finds code that will cause problems with the error wrapping scheme introduced in Go 1.13
76+
- exhaustive # checks exhaustiveness of enum switch statements
77+
- exptostd # detects functions from golang.org/x/exp/ that can be replaced by std functions
78+
- copyloopvar # checks for pointers to enclosing loop variables
79+
- fatcontext # detects nested contexts in loops and function literals
80+
- forbidigo # forbids identifiers
81+
- funlen # tool for detection of long functions
82+
- gocheckcompilerdirectives # validates go compiler directive comments (//go:)
83+
- goconst # finds repeated strings that could be replaced by a constant
84+
- gocritic # provides diagnostics that check for bugs, performance and style issues
85+
- gofmt # checks if the code is formatted according to 'gofmt' command
86+
- goimports # in addition to fixing imports, goimports also formats your code in the same style as gofmt
87+
- gomoddirectives # manages the use of 'replace', 'retract', and 'excludes' directives in go.mod
88+
- 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
89+
- goprintffuncname # checks that printf-like functions are named with f at the end
90+
- gosec # inspects source code for security problems
91+
- loggercheck # checks key value pairs for common logger libraries (kitlog,klog,logr,zap)
92+
- makezero # finds slice declarations with non-zero initial length
93+
- mirror # reports wrong mirror patterns of bytes/strings usage
94+
- misspell # finds commonly misspelled English words
95+
- nakedret # finds naked returns in functions greater than a specified function length
96+
- nestif # reports deeply nested if statements
97+
- nilerr # finds the code that returns nil even if it checks that the error is not nil
98+
- nolintlint # reports ill-formed or insufficient nolint directives
99+
- nosprintfhostport # checks for misuse of Sprintf to construct a host with port in a URL
100+
- perfsprint # Golang linter for performance, aiming at usages of fmt.Sprintf which have faster alternatives
101+
- predeclared # finds code that shadows one of Go's predeclared identifiers
102+
- promlinter # checks Prometheus metrics naming via promlint
103+
- reassign # checks that package variables are not reassigned
104+
- revive # fast, configurable, extensible, flexible, and beautiful linter for Go, drop-in replacement of golint
105+
- rowserrcheck # checks whether Err of rows is checked successfully
106+
- sqlclosecheck # checks that sql.Rows and sql.Stmt are closed
107+
- sloglint # A Go linter that ensures consistent code style when using log/slog
108+
- tagliatelle # checks the struct tags.
109+
- testableexamples # checks if examples are testable (have an expected output)
110+
- tparallel # detects inappropriate usage of t.Parallel() method in your Go test codes
111+
- usetesting # detects using os.Setenv instead of t.Setenv since Go1.17
112+
- unconvert # removes unnecessary type conversions
113+
- unparam # reports unused function parameters
114+
- usestdlibvars # detects the possibility to use variables/constants from the Go standard library
115+
- wastedassign # finds wasted assignment statements
116+
fast: false

.golangci.yml

Lines changed: 79 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,107 @@
11
version: "2"
22
run:
3-
allow-parallel-runners: true
3+
modules-download-mode: readonly
4+
tests: true
5+
output:
6+
formats:
7+
text:
8+
path: stdout
9+
print-linter-name: true
10+
print-issued-lines: true
411
linters:
512
default: none
613
enable:
14+
- asasalint
15+
- asciicheck
16+
- bidichk
17+
- bodyclose
718
- copyloopvar
19+
- cyclop
20+
- dogsled
821
- dupl
22+
- durationcheck
923
- errcheck
10-
- ginkgolinter
24+
- errname
25+
- errorlint
26+
- exhaustive
27+
- exptostd
28+
- fatcontext
29+
- forbidigo
30+
- funlen
31+
- gocheckcompilerdirectives
1132
- goconst
12-
- gocyclo
33+
- gocritic
34+
- gomoddirectives
35+
- gomodguard
36+
- goprintffuncname
37+
- gosec
1338
- govet
1439
- ineffassign
15-
- lll
40+
- loggercheck
41+
- makezero
42+
- mirror
1643
- misspell
1744
- nakedret
18-
- prealloc
45+
- nestif
46+
- nilerr
47+
- nolintlint
48+
- nosprintfhostport
49+
- perfsprint
50+
- predeclared
51+
- promlinter
52+
- reassign
1953
- revive
54+
- rowserrcheck
55+
- sloglint
56+
- sqlclosecheck
2057
- staticcheck
58+
- tagliatelle
59+
- testableexamples
60+
- tparallel
2161
- unconvert
2262
- unparam
2363
- unused
64+
- usestdlibvars
65+
- usetesting
66+
- wastedassign
2467
settings:
25-
revive:
68+
cyclop:
69+
max-complexity: 15
70+
depguard:
2671
rules:
27-
- name: comment-spacings
28-
- name: import-shadowing
72+
main:
73+
deny:
74+
- pkg: github.com/pkg/errors
75+
desc: Should be replaced by standard lib errors package
76+
forbidigo:
77+
forbid:
78+
- pattern: http\.NotFound.*
79+
- pattern: http\.Error.*
80+
funlen:
81+
lines: 100
82+
gomoddirectives:
83+
replace-allow-list:
84+
- github.com/abbot/go-http-auth
85+
nestif:
86+
min-complexity: 6
2987
exclusions:
3088
generated: lax
89+
presets:
90+
- comments
91+
- common-false-positives
92+
- legacy
93+
- std-error-handling
3194
rules:
3295
- linters:
33-
- lll
34-
path: api/*
35-
- linters:
96+
- bodyclose
97+
- dogsled
3698
- dupl
37-
- lll
38-
path: internal/*
99+
- funlen
100+
- gosec
101+
path: _test\.go
102+
- linters:
103+
- cyclop
104+
path: (.+)_test\.go
39105
paths:
40106
- third_party$
41107
- builtin$

DEVELOPMENT.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## Local testing
2+
3+
- Start an empty cluster using `k8s-clusters/local-test/empty-cluster.sh`
4+
- Build and push the controller to the cluster using `build-and-push-locally.sh <controller-version>`
5+
- Deploy a service to the cluster, for example (running from `k8s-clusters/local-test`): `OWNER=kadaster TECHNICAL_NAME=ad docker-compose -f ./docker-compose.yaml -f ./bundle-pollers/docker-compose.services.yaml up kustomize-init`

Dockerfile

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
# Build the manager binary
2-
FROM golang:1.24 AS builder
2+
FROM docker.io/golang:1.25 AS builder
33
ARG TARGETOS
44
ARG TARGETARCH
55

6+
#COPY --from=repos ./smooth-operator /smooth-operator
7+
#COPY --from=repos ./ogc-specifications /ogc-specifications
8+
69
WORKDIR /workspace
710
# Copy the Go Modules manifests
811
COPY go.mod go.mod
912
COPY go.sum go.sum
13+
1014
# cache deps before building and copying source so that we don't need to re-download as much
1115
# and so that source changes don't invalidate our downloaded layer
1216
RUN go mod download
1317

14-
# Copy the Go source (relies on .dockerignore to filter)
15-
COPY . .
18+
# Copy the go source
19+
COPY cmd/main.go cmd/main.go
20+
COPY api/ api/
21+
COPY internal/ internal/
1622

1723
# Build
18-
# the GOARCH has no default value to allow the binary to be built according to the host where the command
24+
# the GOARCH has not a default value to allow the binary be built according to the host where the command
1925
# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO
2026
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
2127
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.

0 commit comments

Comments
 (0)