Skip to content

perf: reduce manager binary size - #564

Draft
gi8lino wants to merge 2 commits into
masterfrom
agent/shrink-cloudflare-client
Draft

perf: reduce manager binary size#564
gi8lino wants to merge 2 commits into
masterfrom
agent/shrink-cloudflare-client

Conversation

@gi8lino

@gi8lino gi8lino commented Jul 31, 2026

Copy link
Copy Markdown
Member

What changed

  • replace the root cloudflare.Client with a small local client containing only the DNS and Zones services used by the operator
  • construct Cloudflare request fields directly so production code no longer imports the root SDK package for convenience helpers
  • update controller call sites and the shared test client fixture to use the scoped client

Why

cloudflare.NewClient constructs every generated Cloudflare API service. The operator only uses DNS and Zones, but the root client made all of those service packages reachable in the manager binary.

For a stripped Linux/amd64 build using Go 1.26.5:

Bytes
Before 56,856,738
After 45,289,634
Saved 11,567,104 (20.3%)

The non-standard production dependency closure drops from 771 to 654 packages.

Validation

  • go vet ./...
  • credential-independent controller tests
  • all non-e2e, non-controller packages
  • CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags='-s -w' ./cmd
  • git diff --check

The full make test target reaches the Cloudflare integration cases, which require local CF_API_TOKEN and zone test credentials; those were not available in this environment. The repository's golangci-lint installer also stopped on an upstream archive checksum mismatch before linting began.

@gi8lino
gi8lino force-pushed the agent/shrink-cloudflare-client branch from 2b7503e to 8586413 Compare July 31, 2026 14:52
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