Repository navigation
Description
Summary
The release binaries grew from about 50MB to about 105MB. The release pipeline is not the cause. release.yml builds with the same flags as task build (CGO_ENABLED=0 -tags purego -ldflags "-w -s"), and a local task build at HEAD is also about 105MB.
The size grew with two features:
| Release | linux-amd64 | Cause |
|---|---|---|
| <= v0.230.3 | 50MB | |
| v0.231.0 | 71MB (+21) | The daemon's A2A server imports adk/server, which pulls in gin, sonic, minio, redis v9, mongo-driver, quic-go, cloudevents and mcp-golang |
| v0.239.0-rc.1 | 105MB (+34) | The teleport Kubernetes executor imports the full k8s.io/client-go/kubernetes clientset |
The clientset links 55 typed API-group clients. Through kubernetes/scheme, which discovery and every typed client import, it also links all 56 k8s.io/api groups. internal/agent/infrastructure/kubernetes needs it for only three things:
- Secret CRUD in
ensureSecret,ownSecretandDelete - the pod
portforwardURL inportforward.go Discovery().ServerVersion()inProbe
client-go/dynamic, rest, tools/clientcmd, tools/portforward and transport/spdy do not import the scheme. self.go already uses only the dynamic client.
Proposed change
All changes stay in internal/agent/infrastructure/kubernetes/:
-
Drop the
typed k8sclient.Interfacefield and thek8s.io/client-go/kubernetesimport. -
Add a core/v1 REST client that carries no scheme:
coreConfig := k8sdynamic.ConfigFor(restConfig) coreConfig.APIPath = "/api" coreConfig.GroupVersion = &k8sschema.GroupVersion{Version: "v1"} return k8srest.RESTClientFor(coreConfig)
-
Route Secrets through the dynamic client:
- Add
secretGVR = {Version: "v1", Resource: "secrets"}. - On Get and Create, convert between
corev1.Secretand unstructured withk8sruntime.DefaultUnstructuredConverter, which the file already uses for the pod spec. - On Create, set
TypeMeta{APIVersion: "v1", Kind: "Secret"}.
- Add
-
portforward.go: changee.typed.CoreV1().RESTClient().Post()toe.core.Post(). It builds the same URL. -
Probe: replacee.typed.Discovery().ServerVersion()withe.core.Get().AbsPath("/version").DoRaw(ctx)decoded intok8s.io/apimachinery/pkg/version.Info. -
environment_test.go: dropk8s.io/client-go/kubernetes/fake.- Add
secretGVR: "SecretList"to the dynamic fake's list kinds, and seed Secrets as unstructured objects. - Assert on
dynamic.Actions()only.
- Add
Measured impact
A go build -overlay prototype of the change above compiles and passes go vet:
- Stripped linux/amd64 drops from 110.4MB to 83.7MB, a saving of 26.7MB (-24%).
- Linked
k8s.io/apipackages drop from 56 to 1.
Out of scope
The +21MB from adk/server needs an upstream change in inference-gateway/adk:
- Make the redis and minio storage backends opt-in subpackages.
- Avoid gin, whose binding and render packages pull in ugorji, mongo bson and quic-go.
The CLI cannot trim that locally without dropping the daemon's A2A server.
Acceptance Criteria
-
go list -tags purego -deps ./cmd/inferlists nok8s.io/client-go/kubernetespackage and exactly onek8s.io/api/package (core/v1) -
task buildproduces a binary roughly 25MB smaller than before -
go test ./internal/agent/infrastructure/kubernetes/ ./cmd/daemon/...passes -
task precommit:runpasses - A teleport to a
kubernetesenvironment still works:- its Secret is created and owned by the Sandbox
- the port-forward connects
- the environment probe reports the
kubernetesversion
Activity
inference-gateway-releaser commentedon Nov 3, 2026
🎉 This issue has been resolved in version 0.241.0 🎉
The release is available on:
Your semantic-release bot 📦🚀