Skip to content

Commit 407ad16

Browse files
committed
Rework into kubernetes controller
1 parent 21e7df3 commit 407ad16

36 files changed

Lines changed: 2213 additions & 402 deletions

.editorconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: SAP SE
1+
# SPDX-FileCopyrightText: SAP SE or an SAP affiliate company
22
# SPDX-License-Identifier: Apache-2.0
33

44
root = true
@@ -12,7 +12,7 @@ indent_size = 2
1212

1313
[{Makefile,go.mod,go.sum,*.go}]
1414
indent_style = tab
15-
indent_size = 2
15+
indent_size = unset
1616

1717
[*.md]
1818
trim_trailing_whitespace = false

.envrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env bash
2-
# SPDX-FileCopyrightText: 2019–2020 Target, Copyright 2021 The Nix Community
2+
# SPDX-FileCopyrightText: 2019–2020 Target
3+
# SPDX-FileCopyrightText: 2021 The Nix Community
34
# SPDX-License-Identifier: Apache-2.0
45
if type -P lorri &>/dev/null; then
56
eval "$(lorri direnv)"

.github/renovate.json

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
],
1212
"commitMessageAction": "Renovate: Update",
1313
"constraints": {
14-
"go": "1.24"
14+
"go": "1.25"
1515
},
1616
"dependencyDashboardOSVVulnerabilitySummary": "all",
1717
"osvVulnerabilityAlerts": true,
@@ -22,9 +22,13 @@
2222
"packageRules": [
2323
{
2424
"matchPackageNames": [
25-
"golang"
25+
"/.*/"
26+
],
27+
"matchUpdateTypes": [
28+
"minor",
29+
"patch"
2630
],
27-
"allowedVersions": "1.24.x"
31+
"groupName": "External dependencies"
2832
},
2933
{
3034
"matchPackageNames": [
@@ -35,16 +39,30 @@
3539
},
3640
{
3741
"matchPackageNames": [
38-
"!/^github\\.com\\/sapcc\\/.*/",
39-
"/.*/"
42+
"go",
43+
"golang",
44+
"actions/go-versions"
4045
],
41-
"groupName": "External dependencies"
46+
"groupName": "golang",
47+
"separateMinorPatch": true
48+
},
49+
{
50+
"matchPackageNames": [
51+
"go",
52+
"golang",
53+
"actions/go-versions"
54+
],
55+
"matchUpdateTypes": [
56+
"minor",
57+
"major"
58+
],
59+
"dependencyDashboardApproval": true
4260
},
4361
{
4462
"matchPackageNames": [
4563
"/^k8s.io\\//"
4664
],
47-
"allowedVersions": "0.28.x"
65+
"allowedVersions": "0.33.x"
4866
}
4967
],
5068
"prHourlyLimit": 0,

.github/workflows/checks.yaml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Edit Makefile.maker.yaml instead. #
44
################################################################################
55

6-
# Copyright 2024 SAP SE
6+
# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company
77
# SPDX-License-Identifier: Apache-2.0
88

99
name: Checks
@@ -18,28 +18,29 @@ name: Checks
1818
permissions:
1919
checks: write
2020
contents: read
21+
pull-requests: read
2122
jobs:
2223
checks:
2324
name: Checks
2425
runs-on: ubuntu-latest
2526
steps:
2627
- name: Check out code
27-
uses: actions/checkout@v4
28+
uses: actions/checkout@v6
2829
- name: Set up Go
29-
uses: actions/setup-go@v5
30+
uses: actions/setup-go@v6
3031
with:
3132
check-latest: true
32-
go-version: 1.24.2
33+
go-version: 1.25.4
3334
- name: Run golangci-lint
34-
uses: golangci/golangci-lint-action@v7
35+
uses: golangci/golangci-lint-action@v9
3536
with:
3637
version: latest
38+
- name: Delete pre-installed shellcheck
39+
run: sudo rm -f $(which shellcheck)
40+
- name: Run shellcheck
41+
run: make run-shellcheck
3742
- name: Dependency Licenses Review
3843
run: make check-dependency-licenses
39-
- name: Install govulncheck
40-
run: go install golang.org/x/vuln/cmd/govulncheck@latest
41-
- name: Run govulncheck
42-
run: govulncheck -format text ./...
4344
- name: Check for spelling errors
4445
uses: reviewdog/action-misspell@v1
4546
with:
@@ -49,4 +50,10 @@ jobs:
4950
ignore: importas
5051
reporter: github-check
5152
- name: Check if source code files have license header
52-
run: make check-license-headers
53+
run: make check-addlicense
54+
- name: REUSE Compliance Check
55+
uses: fsfe/reuse-action@v6
56+
- name: Install govulncheck
57+
run: go install golang.org/x/vuln/cmd/govulncheck@latest
58+
- name: Run govulncheck
59+
run: govulncheck -format text ./...

.github/workflows/ci.yaml

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Edit Makefile.maker.yaml instead. #
44
################################################################################
55

6-
# Copyright 2024 SAP SE
6+
# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company
77
# SPDX-License-Identifier: Apache-2.0
88

99
name: CI
@@ -27,26 +27,49 @@ jobs:
2727
runs-on: ubuntu-latest
2828
steps:
2929
- name: Check out code
30-
uses: actions/checkout@v4
30+
uses: actions/checkout@v6
3131
- name: Set up Go
32-
uses: actions/setup-go@v5
32+
uses: actions/setup-go@v6
3333
with:
3434
check-latest: true
35-
go-version: 1.24.2
35+
go-version: 1.25.4
3636
- name: Build all binaries
3737
run: make build-all
38+
code_coverage:
39+
name: Code coverage report
40+
if: github.event_name == 'pull_request'
41+
needs:
42+
- test
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Check out code
46+
uses: actions/checkout@v6
47+
- name: Post coverage report
48+
uses: fgrosse/go-coverage-report@v1.2.0
49+
with:
50+
coverage-artifact-name: code-coverage
51+
coverage-file-name: cover.out
52+
permissions:
53+
actions: read
54+
contents: read
55+
pull-requests: write
3856
test:
3957
name: Test
4058
needs:
4159
- build
4260
runs-on: ubuntu-latest
4361
steps:
4462
- name: Check out code
45-
uses: actions/checkout@v4
63+
uses: actions/checkout@v6
4664
- name: Set up Go
47-
uses: actions/setup-go@v5
65+
uses: actions/setup-go@v6
4866
with:
4967
check-latest: true
50-
go-version: 1.24.2
68+
go-version: 1.25.4
5169
- name: Run tests and generate coverage report
5270
run: make build/cover.out
71+
- name: Archive code coverage results
72+
uses: actions/upload-artifact@v5
73+
with:
74+
name: code-coverage
75+
path: build/cover.out

.github/workflows/codeql.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Edit Makefile.maker.yaml instead. #
44
################################################################################
55

6-
# Copyright 2024 SAP SE
6+
# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company
77
# SPDX-License-Identifier: Apache-2.0
88

99
name: CodeQL
@@ -27,18 +27,18 @@ jobs:
2727
runs-on: ubuntu-latest
2828
steps:
2929
- name: Check out code
30-
uses: actions/checkout@v4
30+
uses: actions/checkout@v6
3131
- name: Set up Go
32-
uses: actions/setup-go@v5
32+
uses: actions/setup-go@v6
3333
with:
3434
check-latest: true
35-
go-version: 1.24.2
35+
go-version: 1.25.4
3636
- name: Initialize CodeQL
37-
uses: github/codeql-action/init@v3
37+
uses: github/codeql-action/init@v4
3838
with:
3939
languages: go
4040
queries: security-extended
4141
- name: Autobuild
42-
uses: github/codeql-action/autobuild@v3
42+
uses: github/codeql-action/autobuild@v4
4343
- name: Perform CodeQL Analysis
44-
uses: github/codeql-action/analyze@v3
44+
uses: github/codeql-action/analyze@v4

.golangci.yaml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Edit Makefile.maker.yaml instead. #
44
################################################################################
55

6-
# Copyright 2024 SAP SE
6+
# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company
77
# SPDX-License-Identifier: Apache-2.0
88

99
version: "2"
@@ -55,9 +55,10 @@ linters:
5555
- govet
5656
- ineffassign
5757
- intrange
58+
- iotamixing
5859
- misspell
60+
- modernize
5961
- nilerr
60-
- noctx
6162
- nolintlint
6263
- nosprintfhostport
6364
- perfsprint
@@ -72,6 +73,9 @@ linters:
7273
- usetesting
7374
- whitespace
7475
settings:
76+
dupword:
77+
# Do not choke on SQL statements like `INSERT INTO things (foo, bar, baz) VALUES (TRUE, TRUE, TRUE)`.
78+
ignore: [ "TRUE", "FALSE", "NULL" ]
7579
errcheck:
7680
check-type-assertions: false
7781
# Report about assignment of errors to blank identifier.
@@ -125,6 +129,8 @@ linters:
125129
replace-allow-list:
126130
# for go-pmtud
127131
- github.com/mdlayher/arp
132+
# for github.com/sapcc/vpa_butler
133+
- k8s.io/client-go
128134
toolchain-forbidden: true
129135
go-version-pattern: 1\.\d+(\.0)?$
130136
gosec:
@@ -139,6 +145,13 @@ linters:
139145
enable-all: true
140146
nolintlint:
141147
require-specific: true
148+
modernize:
149+
disable:
150+
# omitzero requires removing omitempty tags in kubernetes api struct types which are nested, which is intepreted by controller-gen and breaks the CRDs.
151+
- omitzero
152+
perfsprint:
153+
# modernize generates nicer fix code
154+
concat-loop: false
142155
staticcheck:
143156
dot-import-whitelist:
144157
- github.com/majewsky/gg/option
@@ -163,13 +176,13 @@ linters:
163176
exclusions:
164177
generated: lax
165178
presets:
166-
- comments
167179
- common-false-positives
168180
- legacy
169181
- std-error-handling
170182
rules:
171183
- linters:
172184
- bodyclose
185+
- revive
173186
path: _test\.go
174187
# It is idiomatic Go to reuse the name 'err' with ':=' for subsequent errors.
175188
# Ref: https://go.dev/doc/effective_go#redeclaration

.license-scan-overrides.jsonl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
{"name": "github.com/chzyer/logex", "licenceType": "MIT"}
2+
{"name": "github.com/grpc-ecosystem/go-grpc-middleware/v2", "licenceType": "Apache-2.0"}
23
{"name": "github.com/hashicorp/vault/api/auth/approle", "licenceType": "MPL-2.0"}
34
{"name": "github.com/jpillora/longestcommon", "licenceType": "MIT"}
5+
{"name": "github.com/logrusorgru/aurora", "licenceType": "Unlicense"}
46
{"name": "github.com/mattn/go-localereader", "licenceType": "MIT"}
57
{"name": "github.com/miekg/dns", "licenceType": "BSD-3-Clause"}
8+
{"name": "github.com/pashagolub/pgxmock/v4", "licenceType": "BSD-3-Clause"}
69
{"name": "github.com/spdx/tools-golang", "licenceTextOverrideFile": "vendor/github.com/spdx/tools-golang/LICENSE.code"}
710
{"name": "github.com/xeipuuv/gojsonpointer", "licenceType": "Apache-2.0"}
811
{"name": "github.com/xeipuuv/gojsonreference", "licenceType": "Apache-2.0"}
912
{"name": "github.com/xeipuuv/gojsonschema", "licenceType": "Apache-2.0"}
10-
{"name": "github.wdf.sap.corp/cc/nxos-gnmi-go", "licenceType": "Apache-2.0"}

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
# SPDX-FileCopyrightText: 2025 SAP SE or an SAP affiliate company
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
15
# Build the manager binary
2-
FROM golang:1.24-alpine AS builder
6+
FROM golang:1.25-alpine AS builder
37

48
WORKDIR /workspace
59
ENV GOTOOLCHAIN=local

0 commit comments

Comments
 (0)