Skip to content

Commit 77cf276

Browse files
authored
Merge pull request #3 from datum-cloud/chore/repo-setup
chore: complete repository setup
2 parents 89e167e + b818fb9 commit 77cf276

35 files changed

Lines changed: 2887 additions & 1887 deletions

.crd-ref-docs.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
processor:
2+
docPaths: []
3+
ignoreTypes:
4+
- ".*List$"
5+
ignoreFields: []
6+
7+
render:
8+
kubernetes: {}
9+
markdown:
10+
mediaWidth: 80
11+
anchorLink: true
12+
tableHideEmpty: true

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @datum-cloud/engineering

.github/renovate.json

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": [
4+
"config:recommended",
5+
":disableDependencyDashboard",
6+
":semanticCommits"
7+
],
8+
"schedule": ["before 6am on Monday"],
9+
"timezone": "America/New_York",
10+
"labels": ["dependencies"],
11+
"minimumReleaseAge": "3 days",
12+
"packageRules": [
13+
{
14+
"description": "Disable Go version upgrades in go.mod (go directive and toolchain directive)",
15+
"matchManagers": ["gomod"],
16+
"matchDepNames": ["go"],
17+
"enabled": false
18+
},
19+
{
20+
"description": "Disable go-version upgrades in GitHub Actions (actions/setup-go)",
21+
"matchManagers": ["github-actions"],
22+
"matchDepNames": ["go"],
23+
"enabled": false
24+
},
25+
{
26+
"description": "Group all Go dependencies (excluding k8s core, which has its own cadence)",
27+
"matchManagers": ["gomod"],
28+
"excludePackageNames": [
29+
"sigs.k8s.io/controller-runtime",
30+
"k8s.io/apimachinery"
31+
],
32+
"groupName": "Go dependencies",
33+
"groupSlug": "go-deps"
34+
},
35+
{
36+
"description": "k8s core — grouped, slower cadence",
37+
"matchManagers": ["gomod"],
38+
"matchPackageNames": [
39+
"sigs.k8s.io/controller-runtime",
40+
"k8s.io/apimachinery"
41+
],
42+
"groupName": "k8s core libraries",
43+
"groupSlug": "k8s-core",
44+
"schedule": ["before 6am on the first day of the month"]
45+
},
46+
{
47+
"description": "Group all GitHub Actions version bumps",
48+
"matchManagers": ["github-actions"],
49+
"groupName": "GitHub Actions",
50+
"groupSlug": "gha"
51+
},
52+
{
53+
"description": "Automerge patch/minor for non-k8s Go deps",
54+
"matchManagers": ["gomod"],
55+
"matchUpdateTypes": ["patch", "minor"],
56+
"excludePackageNames": [
57+
"sigs.k8s.io/controller-runtime",
58+
"k8s.io/apimachinery"
59+
],
60+
"automerge": true,
61+
"automergeType": "pr",
62+
"platformAutomerge": true
63+
},
64+
{
65+
"description": "Never automerge majors",
66+
"matchUpdateTypes": ["major"],
67+
"automerge": false,
68+
"labels": ["dependencies", "major-update"]
69+
}
70+
],
71+
"vulnerabilityAlerts": {
72+
"enabled": true,
73+
"labels": ["security"],
74+
"schedule": ["at any time"]
75+
},
76+
"constraints": {
77+
"go": "1.26"
78+
},
79+
"prConcurrentLimit": 5,
80+
"prHourlyLimit": 2
81+
}

.github/workflows/ci.yaml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
---
2+
name: CI
3+
4+
on:
5+
push:
6+
branches: [main]
7+
pull_request:
8+
branches: [main]
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
env:
15+
GO_VERSION: '1.26'
16+
17+
jobs:
18+
build:
19+
name: Build
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- uses: actions/setup-go@v5
28+
with:
29+
go-version: ${{ env.GO_VERSION }}
30+
cache: true
31+
32+
- name: Install task
33+
uses: arduino/setup-task@v2
34+
with:
35+
version: 3.x
36+
repo-token: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Build
39+
run: task build
40+
41+
test:
42+
name: Unit Tests
43+
runs-on: ubuntu-latest
44+
needs: build
45+
permissions:
46+
contents: read
47+
48+
steps:
49+
- uses: actions/checkout@v4
50+
51+
- uses: actions/setup-go@v5
52+
with:
53+
go-version: ${{ env.GO_VERSION }}
54+
cache: true
55+
56+
- name: Install task
57+
uses: arduino/setup-task@v2
58+
with:
59+
version: 3.x
60+
repo-token: ${{ secrets.GITHUB_TOKEN }}
61+
62+
- name: Unit Tests
63+
run: task test:unit
64+
65+
- name: Upload coverage
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: coverage
69+
path: cover.out
70+
71+
lint:
72+
name: Lint
73+
runs-on: ubuntu-latest
74+
needs: build
75+
permissions:
76+
contents: read
77+
78+
steps:
79+
- uses: actions/checkout@v4
80+
81+
- uses: actions/setup-go@v5
82+
with:
83+
go-version: ${{ env.GO_VERSION }}
84+
cache: true
85+
86+
- name: Install task
87+
uses: arduino/setup-task@v2
88+
with:
89+
version: 3.x
90+
repo-token: ${{ secrets.GITHUB_TOKEN }}
91+
92+
- name: Install dev tools
93+
run: task install:golangci-lint install:yamlfmt
94+
95+
- name: Lint
96+
run: task lint
97+
98+
e2e:
99+
name: E2E Tests
100+
runs-on: ubuntu-latest
101+
needs: [test, lint]
102+
timeout-minutes: 30
103+
permissions:
104+
contents: read
105+
106+
steps:
107+
- uses: actions/checkout@v4
108+
109+
- uses: actions/setup-go@v5
110+
with:
111+
go-version: ${{ env.GO_VERSION }}
112+
cache: true
113+
114+
- name: Install task
115+
uses: arduino/setup-task@v2
116+
with:
117+
version: 3.x
118+
repo-token: ${{ secrets.GITHUB_TOKEN }}
119+
120+
- name: Install dev tools
121+
run: |
122+
task install:chainsaw
123+
go install sigs.k8s.io/kind@latest
124+
helm repo add cilium https://helm.cilium.io/
125+
126+
- name: Run E2E suite
127+
run: |
128+
export PATH="$GITHUB_WORKSPACE/bin:$PATH"
129+
task test:e2e

.golangci.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
version: "2"
2+
3+
run:
4+
allow-parallel-runners: true
5+
6+
linters:
7+
enable:
8+
- copyloopvar
9+
- errcheck
10+
- errname
11+
- errorlint
12+
- gocyclo
13+
- govet
14+
- ineffassign
15+
- intrange
16+
- misspell
17+
- nakedret
18+
- perfsprint
19+
- prealloc
20+
- revive
21+
- staticcheck
22+
- unconvert
23+
- unparam
24+
- unused
25+
settings:
26+
gocyclo:
27+
min-complexity: 30
28+
nakedret:
29+
max-func-lines: 30
30+
revive:
31+
rules:
32+
- name: comment-spacings
33+
- name: import-shadowing
34+
staticcheck:
35+
checks:
36+
- all
37+
- "-ST1000" # don't flag missing doc comments (already covered by conventions)
38+
39+
issues:
40+
max-issues-per-linter: 0
41+
max-same-issues: 0
42+
43+
formatters:
44+
enable:
45+
- gci
46+
- gofmt
47+
settings:
48+
gci:
49+
sections:
50+
- standard
51+
- prefix(go.datum.net)
52+
- default

.yamlfmt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
formatter:
2+
type: basic
3+
indent: 2
4+
line_ending: lf
5+
trim_trailing_whitespace: true
6+
eof_newline: true
7+
keep_line_progressions: true
8+
indent_anchors: true
9+
formatter_version: "2"
10+
include:
11+
- "**/*.yaml"
12+
exclude:
13+
- ".git/**"
14+
- "vendor/**"

AGENTS.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,18 @@ Module: `go.datum.net/network`
1313
This project uses [Task](https://taskfile.dev/) (`task`), not `make`.
1414

1515
```bash
16-
task tools # Install all dev tools into ./bin/ (run first)
16+
task install # Install all dev tools into ./bin/ (run first)
1717
task build # go fmt + go vet + go build ./...
1818
task test:unit # Run unit tests with coverage (excludes /e2e)
1919
task test:e2e # Create kind cluster, deploy CRDs, run Chainsaw tests, teardown
20-
task lint # golangci-lint + yamlfmt check
21-
task lint-fix # Same with auto-fix applied
22-
task generate # Regenerate zz_generated.deepcopy.go files
23-
task manifests # Regenerate CRD YAML in config/crd/ from Go types
24-
task ci # Full local pipeline: build → lint → test:unit → test:e2e
25-
task clean # Remove ./bin/ and cover.out
20+
task lint # golangci-lint + yamlfmt check
21+
task lint-fix # Same with auto-fix applied
22+
task generate # Run all generators (methods, manifests, docs)
23+
task generate:methods # Regenerate zz_generated.deepcopy.go files
24+
task generate:manifests # Regenerate CRD YAML in config/crd/ from Go types
25+
task generate:docs # Regenerate docs/api/bgp.md from Go types
26+
task ci # Full local pipeline: build → lint → test:unit → test:e2e
27+
task clean # Remove ./bin/ and cover.out
2628
```
2729

2830
Run a single unit test package:
@@ -58,15 +60,17 @@ The `RouterTarget` struct (in `shared_types.go`) is embedded by resources that s
5860
- **Kubernetes 1.28+ required** — CEL functions `isIP()` and `isCIDR()` are used for field validation.
5961
- **Status conditions** follow `metav1.Condition` conventions. Condition type constants (e.g., `ConditionTypeReady`, `ConditionTypeAccepted`) are defined alongside the resource type they belong to.
6062
- **YAML files must use `.yaml` extension**, never `.yml` — the lint task enforces this.
63+
- **Never hand-edit generated files**`docs/api/bgp.md`, `config/crd/*.yaml`, and `zz_generated.deepcopy.go` are all generated. Always regenerate via `task generate` (or the individual `generate:methods`, `generate:manifests`, `generate:docs` targets). Editing them directly will be overwritten and drifts from source of truth.
6164

6265
### Code generation
6366

6467
After changing kubebuilder markers (`// +kubebuilder:...`) or adding new types:
6568

66-
1. `task generate` — regenerates `zz_generated.deepcopy.go`
67-
2. `task manifests` — regenerates CRDs in `config/crd/`
69+
1. `task generate:methods` — regenerates `zz_generated.deepcopy.go`
70+
2. `task generate:manifests` — regenerates CRDs in `config/crd/`
71+
3. `task generate:docs` — regenerates `docs/api/bgp.md` from Go types (config in `.crd-ref-docs.yaml`)
6872

69-
Both are generated; never edit `zz_generated.deepcopy.go` or CRD YAML directly.
73+
Or run `task generate` to execute all three in order. All three are generated; never edit `zz_generated.deepcopy.go`, CRD YAML, or `docs/api/bgp.md` directly.
7074

7175
### Testing
7276

CLAUDE.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,18 @@ Module: `go.datum.net/network`
1313
This project uses [Task](https://taskfile.dev/) (`task`), not `make`.
1414

1515
```bash
16-
task tools # Install all dev tools into ./bin/ (run first)
16+
task install # Install all dev tools into ./bin/ (run first)
1717
task build # go fmt + go vet + go build ./...
1818
task test:unit # Run unit tests with coverage (excludes /e2e)
1919
task test:e2e # Create kind cluster, deploy CRDs, run Chainsaw tests, teardown
20-
task lint # golangci-lint + yamlfmt check
21-
task lint-fix # Same with auto-fix applied
22-
task generate # Regenerate zz_generated.deepcopy.go files
23-
task manifests # Regenerate CRD YAML in config/crd/ from Go types
24-
task ci # Full local pipeline: build → lint → test:unit → test:e2e
25-
task clean # Remove ./bin/ and cover.out
20+
task lint # golangci-lint + yamlfmt check
21+
task lint-fix # Same with auto-fix applied
22+
task generate # Run all generators (methods, manifests, docs)
23+
task generate:methods # Regenerate zz_generated.deepcopy.go files
24+
task generate:manifests # Regenerate CRD YAML in config/crd/ from Go types
25+
task generate:docs # Regenerate docs/api/bgp.md from Go types
26+
task ci # Full local pipeline: build → lint → test:unit → test:e2e
27+
task clean # Remove ./bin/ and cover.out
2628
```
2729

2830
Run a single unit test package:
@@ -64,10 +66,11 @@ The `RouterTarget` struct (in `shared_types.go`) is embedded by resources that s
6466

6567
After changing kubebuilder markers (`// +kubebuilder:...`) or adding new types:
6668

67-
1. `task generate` — regenerates `zz_generated.deepcopy.go`
68-
2. `task manifests` — regenerates CRDs in `config/crd/`
69+
1. `task generate:methods` — regenerates `zz_generated.deepcopy.go`
70+
2. `task generate:manifests` — regenerates CRDs in `config/crd/`
71+
3. `task generate:docs` — regenerates `docs/api/bgp.md` from Go types (config in `.crd-ref-docs.yaml`)
6972

70-
Both are generated; never edit `zz_generated.deepcopy.go` or CRD YAML directly.
73+
Or run `task generate` to execute all three in order. All three are generated; never edit `zz_generated.deepcopy.go`, CRD YAML, or `docs/api/bgp.md` directly.
7174

7275
### Testing
7376

0 commit comments

Comments
 (0)