Skip to content

Commit b218c63

Browse files
author
Jelle Dijkstra
committed
(chore) original code from master to keep changes
1 parent c13bf7c commit b218c63

File tree

245 files changed

+33933
-1435
lines changed

Some content is hidden

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

245 files changed

+33933
-1435
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": "docker.io/golang:1.24",
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: 4 additions & 2 deletions
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
@@ -20,4 +22,4 @@ jobs:
2022
- name: Run linter
2123
uses: golangci/golangci-lint-action@v6
2224
with:
23-
version: v1.63.4
25+
version: v1.64.8

.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.yml

Lines changed: 106 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,116 @@
1+
---
12
run:
3+
# Timeout for analysis.
24
timeout: 5m
3-
allow-parallel-runners: true
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
411

512
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)
1113
exclude-rules:
12-
- path: "api/*"
13-
linters:
14-
- lll
15-
- path: "internal/*"
14+
# Exclude certain linters for test code
15+
- path: "_test\\.go"
1616
linters:
17+
- bodyclose
1718
- dupl
18-
- lll
19-
linters:
20-
disable-all: true
21-
enable:
22-
- dupl
23-
- errcheck
24-
- copyloopvar
25-
- ginkgolinter
26-
- goconst
27-
- gocyclo
28-
- gofmt
29-
- goimports
30-
- gosimple
31-
- govet
32-
- ineffassign
33-
- lll
34-
- misspell
35-
- nakedret
36-
- prealloc
37-
- revive
38-
- staticcheck
39-
- typecheck
40-
- unconvert
41-
- unparam
42-
- unused
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
4329

4430
linters-settings:
45-
revive:
31+
depguard:
4632
rules:
47-
- name: comment-spacings
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

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: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# Build the manager binary
2-
FROM docker.io/golang:1.23 AS builder
2+
FROM docker.io/golang:1.24 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

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024-2025 Publieke Dienstverlening op de Kaart
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ help: ## Display this help.
4343

4444
.PHONY: manifests
4545
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
46-
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
46+
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:allowDangerousTypes=true webhook paths="./..." output:crd:artifacts:config=config/crd/bases
47+
go run config/crd/update_openapi.go config/crd/bases
48+
## allowDangerousTypes=true for v2beta structs
4749

4850
.PHONY: generate
4951
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
@@ -63,7 +65,8 @@ test: manifests generate fmt vet setup-envtest ## Run tests.
6365

6466
# TODO(user): To use a different vendor for e2e tests, modify the setup under 'tests/e2e'.
6567
# The default setup assumes Kind is pre-installed and builds/loads the Manager Docker image locally.
66-
# CertManager is installed by default; skip with:
68+
# Prometheus and CertManager are installed by default; skip with:
69+
# - PROMETHEUS_INSTALL_SKIP=true
6770
# - CERT_MANAGER_INSTALL_SKIP=true
6871
.PHONY: test-e2e
6972
test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.
@@ -172,12 +175,12 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
172175

173176
## Tool Versions
174177
KUSTOMIZE_VERSION ?= v5.5.0
175-
CONTROLLER_TOOLS_VERSION ?= v0.17.2
178+
CONTROLLER_TOOLS_VERSION ?= v0.17.1
176179
#ENVTEST_VERSION is the version of controller-runtime release branch to fetch the envtest setup script (i.e. release-0.20)
177180
ENVTEST_VERSION ?= $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller-runtime | awk -F'[v.]' '{printf "release-%d.%d", $$2, $$3}')
178181
#ENVTEST_K8S_VERSION is the version of Kubernetes to use for setting up ENVTEST binaries (i.e. 1.31)
179182
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
183+
GOLANGCI_LINT_VERSION ?= v1.64.8
181184

182185
.PHONY: kustomize
183186
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.

0 commit comments

Comments
 (0)