Skip to content

Commit 0f72092

Browse files
Scaffold project using kubebuiler and go-makefile-maker
1 parent 544ed71 commit 0f72092

File tree

74 files changed

+3773
-111
lines changed

Some content is hidden

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

74 files changed

+3773
-111
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
2+
# Ignore build and test binaries.
3+
bin/

.editorconfig

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# SPDX-FileCopyrightText: SAP SE or an SAP affiliate company
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
root = true
5+
6+
[*]
7+
insert_final_newline = true
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
indent_style = space
11+
indent_size = 2
12+
13+
[{Makefile,go.mod,go.sum,*.go}]
14+
indent_style = tab
15+
16+
[*.md]
17+
trim_trailing_whitespace = false
18+
19+
[{LICENSE,LICENSES/*,vendor/**}]
20+
charset = unset
21+
end_of_line = unset
22+
indent_size = unset
23+
indent_style = unset
24+
insert_final_newline = unset
25+
trim_trailing_whitespace = unset

.envrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
# SPDX-FileCopyrightText: 2019–2020 Target
3+
# SPDX-FileCopyrightText: 2021 The Nix Community
4+
# SPDX-License-Identifier: Apache-2.0
5+
if type -P lorri &>/dev/null; then
6+
eval "$(lorri direnv)"
7+
elif type -P nix &>/dev/null; then
8+
use nix
9+
else
10+
echo "Found no nix binary. Skipping activating nix-shell..."
11+
fi

.github/renovate.json

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": [
4+
"config:recommended",
5+
"default:pinDigestsDisabled",
6+
"mergeConfidence:all-badges",
7+
"docker:disable"
8+
],
9+
"assignees": [
10+
"felix-kaestner"
11+
],
12+
"commitMessageAction": "Renovate: Update",
13+
"constraints": {
14+
"go": "1.24"
15+
},
16+
"dependencyDashboardOSVVulnerabilitySummary": "all",
17+
"osvVulnerabilityAlerts": true,
18+
"postUpdateOptions": [
19+
"gomodTidy",
20+
"gomodUpdateImportPaths"
21+
],
22+
"packageRules": [
23+
{
24+
"matchPackageNames": [
25+
"golang"
26+
],
27+
"allowedVersions": "1.24.x"
28+
},
29+
{
30+
"matchPackageNames": [
31+
"/^github\\.com\\/sapcc\\/.*/"
32+
],
33+
"automerge": true,
34+
"groupName": "github.com/sapcc"
35+
},
36+
{
37+
"matchPackageNames": [
38+
"!/^github\\.com\\/sapcc\\/.*/",
39+
"/.*/"
40+
],
41+
"matchUpdateTypes": [
42+
"minor",
43+
"patch"
44+
],
45+
"groupName": "External dependencies"
46+
},
47+
{
48+
"matchPackageNames": [
49+
"/^k8s.io\\//"
50+
],
51+
"allowedVersions": "0.28.x"
52+
}
53+
],
54+
"prHourlyLimit": 0,
55+
"schedule": [
56+
"before 8am on Friday"
57+
],
58+
"semanticCommits": "disabled"
59+
}

.github/workflows/checks.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
################################################################################
2+
# This file is AUTOGENERATED with <https://github.com/sapcc/go-makefile-maker> #
3+
# Edit Makefile.maker.yaml instead. #
4+
################################################################################
5+
6+
# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company
7+
# SPDX-License-Identifier: Apache-2.0
8+
9+
name: Checks
10+
"on":
11+
push:
12+
branches:
13+
- main
14+
pull_request:
15+
branches:
16+
- '*'
17+
workflow_dispatch: {}
18+
permissions:
19+
checks: write
20+
contents: read
21+
jobs:
22+
checks:
23+
name: Checks
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Check out code
27+
uses: actions/checkout@v4
28+
- name: Set up Go
29+
uses: actions/setup-go@v5
30+
with:
31+
check-latest: true
32+
go-version: 1.24.4
33+
- name: Run prepare make target
34+
run: make generate
35+
- name: Run golangci-lint
36+
uses: golangci/golangci-lint-action@v8
37+
with:
38+
version: latest
39+
- name: Run shellcheck
40+
uses: ludeeus/action-shellcheck@2.0.0
41+
- name: Dependency Licenses Review
42+
run: make check-dependency-licenses
43+
- name: Check for spelling errors
44+
uses: reviewdog/action-misspell@v1
45+
with:
46+
exclude: ./vendor/*
47+
fail_on_error: true
48+
github_token: ${{ secrets.GITHUB_TOKEN }}
49+
ignore: importas
50+
reporter: github-check
51+
- name: Check if source code files have license header
52+
run: make check-addlicense
53+
- name: Install govulncheck
54+
run: go install golang.org/x/vuln/cmd/govulncheck@latest
55+
- name: Run govulncheck
56+
run: govulncheck -format text ./...

.github/workflows/ci.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
################################################################################
2+
# This file is AUTOGENERATED with <https://github.com/sapcc/go-makefile-maker> #
3+
# Edit Makefile.maker.yaml instead. #
4+
################################################################################
5+
6+
# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company
7+
# SPDX-License-Identifier: Apache-2.0
8+
9+
name: CI
10+
"on":
11+
push:
12+
branches:
13+
- main
14+
paths-ignore:
15+
- '**.md'
16+
pull_request:
17+
branches:
18+
- '*'
19+
paths-ignore:
20+
- '**.md'
21+
workflow_dispatch: {}
22+
permissions:
23+
contents: read
24+
jobs:
25+
build:
26+
name: Build
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Check out code
30+
uses: actions/checkout@v4
31+
- name: Set up Go
32+
uses: actions/setup-go@v5
33+
with:
34+
check-latest: true
35+
go-version: 1.24.4
36+
- name: Run prepare make target
37+
run: make generate
38+
- name: Build all binaries
39+
run: make build-all
40+
test:
41+
name: Test
42+
needs:
43+
- build
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Check out code
47+
uses: actions/checkout@v4
48+
- name: Set up Go
49+
uses: actions/setup-go@v5
50+
with:
51+
check-latest: true
52+
go-version: 1.24.4
53+
- name: Run prepare make target
54+
run: make generate
55+
- name: Run tests and generate coverage report
56+
run: make build/cover.out

.github/workflows/goreleaser.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
################################################################################
2+
# This file is AUTOGENERATED with <https://github.com/sapcc/go-makefile-maker> #
3+
# Edit Makefile.maker.yaml instead. #
4+
################################################################################
5+
6+
# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company
7+
# SPDX-License-Identifier: Apache-2.0
8+
9+
name: goreleaser
10+
"on":
11+
push:
12+
tags:
13+
- '*'
14+
permissions:
15+
contents: write
16+
packages: write
17+
jobs:
18+
release:
19+
name: goreleaser
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Check out code
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
- name: Set up Go
27+
uses: actions/setup-go@v5
28+
with:
29+
check-latest: true
30+
go-version: 1.24.4
31+
- name: Run prepare make target
32+
run: make generate
33+
- name: Generate release info
34+
run: |
35+
go install github.com/sapcc/go-bits/tools/release-info@latest
36+
mkdir -p build
37+
release-info CHANGELOG.md "$(git describe --tags --abbrev=0)" > build/release-info
38+
- name: Run GoReleaser
39+
uses: goreleaser/goreleaser-action@v6
40+
with:
41+
args: release --clean --release-notes=./build/release-info
42+
version: latest
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/reuse.yaml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
# SPDX-FileCopyrightText: Copyright 2024 SAP SE or an SAP affiliate company and cobaltcore-dev contributors
2-
#
1+
# SPDX-FileCopyrightText: 2025 SAP SE or an SAP affiliate company and IronCore contributors
32
# SPDX-License-Identifier: Apache-2.0
43

5-
name: REUSE Compliance Check
6-
7-
on: [push, pull_request]
8-
4+
name: REUSE Compliance
5+
on:
6+
push:
7+
branches:
8+
- main
9+
pull_request:
10+
branches:
11+
- '*'
12+
workflow_dispatch: {}
13+
permissions:
14+
contents: read
915
jobs:
1016
test:
17+
name: Check
1118
runs-on: ubuntu-latest
1219
steps:
1320
- uses: actions/checkout@v4

.github/workflows/stale.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# SPDX-FileCopyrightText: Copyright 2024 SAP SE or an SAP affiliate company and cobaltcore-dev contributors
2-
#
1+
# SPDX-FileCopyrightText: 2025 SAP SE or an SAP affiliate company and IronCore contributors
32
# SPDX-License-Identifier: Apache-2.0
43

54
name: Close inactive issues

.github/workflows/test-chart.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# SPDX-FileCopyrightText: 2025 SAP SE or an SAP affiliate company and IronCore contributors
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: Test
5+
on:
6+
push:
7+
branches:
8+
- main
9+
paths-ignore:
10+
- '**.md'
11+
pull_request:
12+
branches:
13+
- '*'
14+
paths-ignore:
15+
- '**.md'
16+
workflow_dispatch: {}
17+
permissions:
18+
contents: read
19+
jobs:
20+
test-chart:
21+
name: Chart
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Check out code
25+
uses: actions/checkout@v4
26+
- name: Set up Go
27+
uses: actions/setup-go@v5
28+
with:
29+
check-latest: true
30+
go-version: 1.24.4
31+
- name: Fetch latest kubectl version
32+
id: kubectl
33+
run: |
34+
KUBECTL_VERSION=$(curl -sL https://dl.k8s.io/release/stable.txt)
35+
echo "version=$KUBECTL_VERSION" >> $GITHUB_OUTPUT
36+
- name: Fetch latest kind version
37+
id: kind
38+
run: |
39+
KIND_VERSION=$(curl -s https://api.github.com/repos/kubernetes-sigs/kind/releases/latest | grep '"tag_name":' | cut -d'"' -f4)
40+
echo "version=$KIND_VERSION" >> $GITHUB_OUTPUT
41+
- name: Create k8s kind cluster
42+
uses: helm/kind-action@v1
43+
with:
44+
version: ${{ steps.kind.outputs.version }}
45+
cluster_name: kind
46+
kubectl_version: ${{ steps.kubectl.outputs.version }}
47+
- name: Prepare network-operator
48+
run: |
49+
go mod tidy
50+
make docker-build IMG=network-operator:v0.1.0
51+
kind load docker-image network-operator:v0.1.0
52+
- name: Install Helm
53+
run: |
54+
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
55+
- name: Verify Helm installation
56+
run: helm version
57+
- name: Lint Helm Chart
58+
run: |
59+
helm lint ./charts/network-operator
60+
# TODO: Uncomment if cert-manager is enabled
61+
# - name: Install cert-manager via Helm
62+
# run: |
63+
# helm repo add jetstack https://charts.jetstack.io
64+
# helm repo update
65+
# helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --set installCRDs=true
66+
# - name: Wait for cert-manager to be ready
67+
# run: |
68+
# kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager
69+
# kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-cainjector
70+
# kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-webhook
71+
# TODO: Uncomment if Prometheus is enabled
72+
# - name: Install Prometheus Operator CRDs
73+
# run: |
74+
# helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
75+
# helm repo update
76+
# helm install prometheus-crds prometheus-community/prometheus-operator-crds
77+
# - name: Install Prometheus via Helm
78+
# run: |
79+
# helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
80+
# helm repo update
81+
# helm install prometheus prometheus-community/prometheus --namespace monitoring --create-namespace
82+
# - name: Wait for Prometheus to be ready
83+
# run: |
84+
# kubectl wait --namespace monitoring --for=condition=available --timeout=300s deployment/prometheus-server
85+
- name: Install Helm chart for project
86+
run: |
87+
helm install my-release ./charts/network-operator --create-namespace --namespace network-operator-system
88+
- name: Check Helm release status
89+
run: |
90+
helm status my-release --namespace network-operator-system
91+
# TODO: Uncomment if prometheus.enabled is set to true to confirm that the ServiceMonitor gets created
92+
# - name: Check Presence of ServiceMonitor
93+
# run: |
94+
# kubectl wait --namespace network-operator-system --for=jsonpath='{.kind}'=ServiceMonitor servicemonitor/network-operator-controller-manager-metrics-monitor

0 commit comments

Comments
 (0)