Skip to content

chore: update Go to 1.27.1 and refresh dependencies - #1

Merged
terraboops merged 3 commits into
mainfrom
chore/deps-2026-09
Sep 30, 2026
Merged

terraboops merged 3 commits into
mainfrom
chore/deps-2026-09

Conversation

@terraboops

@terraboops terraboops commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner
  • Go 1.26.4 → 1.27.1: go.mod, plus golang:1.27 in both Dockerfiles and scripts/run-in-docker.sh.
  • cni v1.3.0 → v1.3.1, ginkgo v2.32.0 → v2.33.0, gomega v1.42.1 → v1.44.0, x/sys v0.46.0 → v0.48.0, yaml/v3 v3.0.4 → v3.0.5 (indirect).
  • golangci-lint v2.5.0 → v2.14.0. v2.5.0 fails on 1.27 with export data version 4 is greater than maximum supported version 2. v2.14.0 flagged three goconst/prealloc hits in perfrig tests, which are now fixed.

Go 1.27 made the CNI plugin use more memory, so this PR also slims the binary

Built from the same source, 1.27 grew the plugin's peak RSS per invocation by ~465 KB (4817 → 5282 KB; n=30, CNI_COMMAND=VERSION, GNU time -v):

  • ~290 KB is encoding/json now being backed by encoding/json/v2: +220 KB of text, plus reflect/slices growth. With GOEXPERIMENT=nojsonv2 most of the gap goes away.
  • The rest is stdlib code growth. A hello-world shows no runtime regression (1593 → 1561 KB).
  • Almost all of it is file-backed. A CNI call pages in ~85% of the binary's text/rodata, so RSS tracks binary size. Private dirty memory grew ~64 KB.

Refactor, second commit:

Change RSS effect (1.27, n=30–40)
internal/cniskel: libcni's skel v1.3.1 with the name validators rewritten without regexp. cni/pkg/utils compiles a regexp at init, so the linker can't drop it. ~−350 KB
cmd/natra-tools: install-cni-chain, dump-stats and profile move to a sibling binary. natra <subcommand> execs it from the same directory, so the documented commands are unchanged. The installer and image ship both binaries. ~−140 KB (incl. pprof)
ADD-path heap-profile hook now requires -tags heapprofile (included above)
cmd/natra/deps_test.go fails if regexp, runtime/pprof or libcni's skel/utils come back into the plugin guard

Result: main 4732.6 ± 8.1 KB vs this PR 4737.7 ± 8.0 KB (n=150 interleaved, standard error): parity. The plugin binary is 7.44 MB vs 7.48 MB. Meanwhile ParseBandwidthAnnotationJSON is ~56% faster with 3 allocs instead of 10 (json/v2).

cniskel equivalence: upstream's own skel test suite runs against the copy. names_test.go checks all three validators against cni/pkg/utils (same error code and message) and fuzzes the byte-loop matcher against the upstream regexp (738k execs, no mismatch).

Also: CI's unit job ran only ./pkg/..., so internal/ and cmd/ tests (e.g. cmd/natra/threshold_test.go) never ran in CI. Now ./pkg/... ./internal/... ./cmd/....

Testing

macOS/arm64 + colima, on the rebased branch:

Command Result
make pre-push (fmt, vet, lint, unit incl. cmd/internal, fuzz) pass
make test-cni (L2 CNI protocol, via internal/cniskel) ok
make test-bpf (L3) ok
make test-perf (L5) ok
make test-e2e (L4, k3d, installer runs forwarded install-cni-chain) ok, 245s
make license-scan-fast clean
Exec forwarding smoke test: install-cni-chain wrote the chained conflist; dump-stats reached natra-tools; symlinked natra; missing natra-tools gives a clear error as expected

Full-profile perf-vs-vanilla vs a fresh main baseline is in progress and will be posted here before merge.

https://claude.ai/code/session_01RyYnvjh5DBevutC4HTgELn

go directive 1.26.4 -> 1.27.1; Docker builder images golang:1.26 ->
golang:1.27. Direct deps: containernetworking/cni v1.3.1, ginkgo
v2.33.0, gomega v1.44.0, x/sys v0.48.0 (yaml/v3 v3.0.5 indirect).

golangci-lint v2.5.0 can't typecheck against 1.27 (its x/tools reads
export data up to v2; 1.27 writes v4), so the pin moves to v2.14.0.
That version flags three goconst/prealloc hits in perfrig tests;
fixed with named constants for the fake substrate's call log and a
preallocated slice.

Claude-Session: https://claude.ai/code/session_01RyYnvjh5DBevutC4HTgELn
Go 1.27 made the CNI plugin's peak RSS per invocation ~465 KB larger
(4817 -> 5282 KB, n=30, CNI_COMMAND=VERSION). About 290 KB of that is
encoding/json now being backed by json/v2; the rest is stdlib code
growth. Nearly all of it is file-backed text/rodata: a CNI call pages
in ~85% of the binary, so RSS tracks binary size.

This takes out more than that:

- internal/cniskel: libcni's skel v1.3.1 with its name validators
  reimplemented without regexp. cni/pkg/utils compiles a regexp at
  init, which the linker can't drop; removing it saves ~350 KB of
  RSS. Upstream's skel tests run against the copy, and names_test.go
  checks the validators against the upstream regexp (table + fuzz).
  The copy is excluded from goconst/gocyclo so it stays diffable
  against upstream.
- cmd/natra-tools: install-cni-chain, dump-stats and profile move to
  a sibling binary. `natra <subcommand>` execs it from the same
  directory, so the documented commands are unchanged. The installer
  DaemonSet and image ship both binaries.
- The ADD-path heap-profile hook needs -tags heapprofile, so default
  builds don't link runtime/pprof.
- cmd/natra/deps_test.go fails if regexp, runtime/pprof or libcni's
  skel/utils come back into the plugin.

make test-unit and the CI unit job only covered ./pkg (and ./internal
locally), so cmd/ and internal/ tests never ran in CI; both now run.

Claude-Session: https://claude.ai/code/session_01RyYnvjh5DBevutC4HTgELn
Two gaps showed up on this PR's first gated run:

- The main side was built with HEAD's Go (setup-go installs the
  toolchain from HEAD's go.mod, and main's older go line doesn't
  force its own), so a toolchain bump was never measured. bench-ab.sh
  now runs each side with GOTOOLCHAIN from that side's go.mod.
- ParseBandwidthAnnotationJSON came out +0.65% (p<0.001) on code this
  PR doesn't touch, while a sibling run of the same commit showed no
  change: alignment/runner noise. scripts/bench-check.sh now runs a
  second full A/B when the first flags anything and fails only on
  benchmarks that regress in both, so a real regression of any size
  still fails.

Claude-Session: https://claude.ai/code/session_01RyYnvjh5DBevutC4HTgELn
@terraboops
terraboops merged commit eb703a3 into main Sep 30, 2026
22 checks passed
@terraboops
terraboops deleted the chore/deps-2026-09 branch September 30, 2026 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant